File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -253,7 +253,7 @@ def extract_tool_calls(
253253 tools ,
254254 ) -> ExtractedToolCallInformation :
255255 text = model_output
256- if self .tool_start_token in text :
256+ if self .tool_start_token in text and self . tool_end_token in text :
257257 logger .debug ("tool_parse tool_start_token 在 text" )
258258 # get tool_call in text
259259 match_result_list = re .findall (self .pattern , text , re .DOTALL )
@@ -279,7 +279,7 @@ def extract_tool_calls(
279279 tool_calls = tool_calls ,
280280 content = text if len (text ) > 0 else "" ,
281281 )
282- elif self .tool_start_token not in text and self .tool_end_token in text :
282+ elif self .tool_start_token in text or self .tool_end_token in text :
283283 # 如果 tool_start_token 不在 text 但是 tool_end_token 在text
284284 logger .debug ("tool_parse tool_start_token 不在 text" )
285285 pattern = r"\{[^{}]*\{[^{}]*\}[^{}]*\}|{[^{}]*}"
You can’t perform that action at this time.
0 commit comments