[BUGFIX] Mistral tool call parser v11+ (#30332)

Signed-off-by: juliendenize <julien.denize@mistral.ai>
This commit is contained in:
Julien Denize
2025-12-09 15:55:38 +01:00
committed by GitHub
parent ee14644ba9
commit 5c213d2899
2 changed files with 30 additions and 18 deletions

View File

@@ -615,6 +615,7 @@ def test_extract_tool_calls_streaming(
"single_tool_weather",
"multiple_tool_calls",
"content_before_tool",
"complex",
],
argnames=["model_output", "expected_tool_calls", "expected_content"],
argvalues=[
@@ -673,6 +674,21 @@ def test_extract_tool_calls_streaming(
],
"bla",
),
(
# Complex
"""[TOOL_CALLS]bash{"command": "print(\\"hello world!\\")\\nre.compile(r\'{}\')"}""", # noqa: E501
[
ToolCall(
function=FunctionCall(
name="bash",
arguments=json.dumps(
{"command": "print(\"hello world!\")\nre.compile(r'{}')"}
),
)
)
],
"",
),
],
)
def test_extract_tool_calls_streaming_one_chunk(