Bug fix of thinking llm in vllm (#3510)

This commit is contained in:
dog-last
2025-10-03 19:13:08 +05:30
committed by GitHub
parent 346d89d244
commit 51ce6f1347
3 changed files with 122 additions and 2 deletions
+4 -1
View File
@@ -43,7 +43,9 @@ def remove_code_blocks(content: str) -> str:
"""
pattern = r"^```[a-zA-Z0-9]*\n([\s\S]*?)\n```$"
match = re.match(pattern, content.strip())
return match.group(1).strip() if match else content.strip()
match_res=match.group(1).strip() if match else content.strip()
return re.sub(r"<think>.*?</think>", "", match_res, flags=re.DOTALL).strip()
def extract_json(text):
@@ -182,3 +184,4 @@ def sanitize_relationship_for_cypher(relationship) -> str:
sanitized = sanitized.replace(old, new)
return re.sub(r"_+", "_", sanitized).strip("_")