From b6540cea50dd076f8f378feddeee93044655bf34 Mon Sep 17 00:00:00 2001 From: drbh Date: Mon, 7 Jul 2025 16:14:00 +0000 Subject: [PATCH] fix: lint and format --- integration-tests/models/test_tool_def.py | 10 ++++++++-- router/src/infer/tool_grammar.rs | 10 +++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/integration-tests/models/test_tool_def.py b/integration-tests/models/test_tool_def.py index e8fee258..2aa6c82e 100644 --- a/integration-tests/models/test_tool_def.py +++ b/integration-tests/models/test_tool_def.py @@ -46,6 +46,12 @@ async def test_flash_gemma3_defs(flash_gemma3, response_snapshot): seed=42, ) - assert response.choices[0].message.tool_calls[0]["function"]["name"] == "classify_weather" - assert response.choices[0].message.tool_calls[0]["function"]["arguments"] == '{"weather":"sunny"}' + assert ( + response.choices[0].message.tool_calls[0]["function"]["name"] + == "classify_weather" + ) + assert ( + response.choices[0].message.tool_calls[0]["function"]["arguments"] + == '{"weather":"sunny"}' + ) assert response == response_snapshot diff --git a/router/src/infer/tool_grammar.rs b/router/src/infer/tool_grammar.rs index a9072030..eea2f55e 100644 --- a/router/src/infer/tool_grammar.rs +++ b/router/src/infer/tool_grammar.rs @@ -96,9 +96,13 @@ impl ToolGrammar { if ref_str.starts_with("#/$defs/") { // Replace $defs with $functions/{func.name}/$defs to handle // function-specific definitions - new_obj.insert("$ref".to_string(), Value::String( - ref_str.replace("#/$defs/", &format!("#/$functions/{}/$defs/", func.name)) - )); + new_obj.insert( + "$ref".to_string(), + Value::String(ref_str.replace( + "#/$defs/", + &format!("#/$functions/{}/$defs/", func.name), + )), + ); } } Value::Object(new_obj)