File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 18
18
19
19
from lmdeploy .serve .openai .tool_parser import ToolParser , ToolParserManager
20
20
from lmdeploy .serve .openai .tool_parser .utils import extract_intermediate_diff
21
+ from lmdeploy .serve .openai .tool_parser import ToolParser
21
22
22
23
23
24
class ToolCall (BaseModel ):
@@ -230,9 +231,7 @@ def extract_tool_calls(
230
231
tool_calls = tool_calls ,
231
232
content = text if len (text ) > 0 else "" ,
232
233
)
233
- elif (
234
- self .tool_start_token not in text and self .tool_end_token in text
235
- ) or tools :
234
+ elif self .tool_start_token not in text and self .tool_end_token in text :
236
235
# 如果 tool_start_token 不在 text 但是 tool_end_token 在text
237
236
logger .debug ("tool_parse tool_start_token 不在 text" )
238
237
pattern = r"\{[^{}]*\{[^{}]*\}[^{}]*\}|{[^{}]*}"
@@ -266,7 +265,7 @@ def extract_tool_calls(
266
265
)
267
266
268
267
269
- def tool_parser (full_text : str , tool_parser , tools , ret ):
268
+ def tool_parser (full_text : str , tool_parser : ToolParser , tools , ret ):
270
269
tool_call_info = tool_parser .extract_tool_calls (full_text , tools )
271
270
tools_called = tool_call_info .tools_called
272
271
text , tool_calls = tool_call_info .content , tool_call_info .tool_calls
You can’t perform that action at this time.
0 commit comments