[model] support Seed-OSS (#8992)

Co-authored-by: Yaowei Zheng <hiyouga@buaa.edu.cn>
This commit is contained in:
Kingsley
2025-08-23 22:38:24 +08:00
committed by GitHub
parent c14a5fefee
commit 0ab0be9df2
3 changed files with 81 additions and 3 deletions

View File

@@ -97,8 +97,11 @@ class FunctionFormatter(StringFormatter):
@override
def apply(self, **kwargs) -> SLOTS:
content: str = kwargs.pop("content")
regex = re.compile(r"<think>(.*)</think>", re.DOTALL)
thought = re.search(regex, content)
thought_words, thought = kwargs.pop("thought_words", None), None
if thought_words and len(thought_words)== 2:
regex = re.compile(rf"{re.escape(thought_words[0])}(.*?){re.escape(thought_words[1])}", re.DOTALL)
thought = re.search(regex, content)
if thought:
content = content.replace(thought.group(0), "")