mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
Merge PR #444: fix: add missing re.DOTALL flag to DeepSeek V3 tool call parser
Authored by PercyDikec. Fixes #443. Without re.DOTALL, the regex .* doesn't match newlines, so multi-line JSON arguments (the normal case) silently fail to parse. Every other parser in the codebase that matches across lines already uses re.DOTALL.
This commit is contained in:
commit
936fda3f9e
1 changed files with 2 additions and 1 deletions
|
|
@ -38,7 +38,8 @@ class DeepSeekV3ToolCallParser(ToolCallParser):
|
||||||
|
|
||||||
# Regex captures: type, function_name, function_arguments
|
# Regex captures: type, function_name, function_arguments
|
||||||
PATTERN = re.compile(
|
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,
|
||||||
)
|
)
|
||||||
|
|
||||||
def parse(self, text: str) -> ParseResult:
|
def parse(self, text: str) -> ParseResult:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue