Fix a bug in function_calling.py

This commit is contained in:
Shuguang Chen 2024-12-05 12:06:56 -08:00
parent 09f7e1e604
commit a5bd005411

View file

@ -358,15 +358,16 @@ class ArchFunctionHandler(ArchBaseHandler):
for token in response:
token_content = token.choices[0].delta.content.strip()
if has_tool_call is None and token_content != "<tool_call>":
has_tool_call = False
response.close()
break
else:
has_tool_call = True
if token_content:
if has_tool_call is None and token_content != "<tool_call>":
has_tool_call = False
response.close()
break
else:
has_tool_call = True
if has_tool_call is True:
model_response += token_content
if has_tool_call is True:
model_response += token_content
# start parameter gathering if the model is not generating a tool call
if has_tool_call is False: