mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-09 03:14:53 +00:00
fix: lint and format
This commit is contained in:
parent
71fbe88a30
commit
b6540cea50
@ -46,6 +46,12 @@ async def test_flash_gemma3_defs(flash_gemma3, response_snapshot):
|
|||||||
seed=42,
|
seed=42,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert response.choices[0].message.tool_calls[0]["function"]["name"] == "classify_weather"
|
assert (
|
||||||
assert response.choices[0].message.tool_calls[0]["function"]["arguments"] == '{"weather":"sunny"}'
|
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
|
assert response == response_snapshot
|
||||||
|
@ -96,9 +96,13 @@ impl ToolGrammar {
|
|||||||
if ref_str.starts_with("#/$defs/") {
|
if ref_str.starts_with("#/$defs/") {
|
||||||
// Replace $defs with $functions/{func.name}/$defs to handle
|
// Replace $defs with $functions/{func.name}/$defs to handle
|
||||||
// function-specific definitions
|
// function-specific definitions
|
||||||
new_obj.insert("$ref".to_string(), Value::String(
|
new_obj.insert(
|
||||||
ref_str.replace("#/$defs/", &format!("#/$functions/{}/$defs/", func.name))
|
"$ref".to_string(),
|
||||||
));
|
Value::String(ref_str.replace(
|
||||||
|
"#/$defs/",
|
||||||
|
&format!("#/$functions/{}/$defs/", func.name),
|
||||||
|
)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Value::Object(new_obj)
|
Value::Object(new_obj)
|
||||||
|
Loading…
Reference in New Issue
Block a user