fix: lint and format

This commit is contained in:
drbh 2025-07-07 16:14:00 +00:00
parent 71fbe88a30
commit b6540cea50
2 changed files with 15 additions and 5 deletions

View File

@ -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

View File

@ -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)