mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix: use non-greedy regex in DeepSeek V3 parser for multi-tool calls (#1300)
The greedy `.*` captures with `re.DOTALL` cause `findall()` to merge multiple tool calls into a single match — silently dropping all but the last tool call. Switching to `.*?` (non-greedy) fixes extraction when models return multiple tool calls in one response. Adds test coverage for the DeepSeek V3 parser including a multi-tool call regression test. Co-authored-by: Himess <semihcvlk53@gmail.com>
This commit is contained in:
parent
a0f0f4fe52
commit
2ff03ebafe
2 changed files with 53 additions and 1 deletions
|
|
@ -38,7 +38,7 @@ class DeepSeekV3ToolCallParser(ToolCallParser):
|
|||
|
||||
# Regex captures: type, function_name, function_arguments
|
||||
PATTERN = re.compile(
|
||||
r"<|tool▁call▁begin|>(?P<type>.*)<|tool▁sep|>(?P<function_name>.*)\n```json\n(?P<function_arguments>.*)\n```<|tool▁call▁end|>",
|
||||
r"<|tool▁call▁begin|>(?P<type>.*?)<|tool▁sep|>(?P<function_name>.*?)\n```json\n(?P<function_arguments>.*?)\n```<|tool▁call▁end|>",
|
||||
re.DOTALL,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue