Bug fix of thinking llm in vllm (#3510)
This commit is contained in:
@@ -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("_")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user