bug: Fixed a bug when passing tools to Claude for tools that don't have any inputs

This commit is contained in:
2025-10-21 10:04:38 -06:00
parent 1b504e211a
commit a468ee1154
+14 -6
View File
@@ -286,14 +286,22 @@ pub fn claude_build_chat_completions_body(
body["tools"] = functions body["tools"] = functions
.iter() .iter()
.map(|v| { .map(|v| {
json!({ if v.parameters.type_value.is_none() {
json!({
"name": v.name, "name": v.name,
"description": v.description, "description": v.description,
"input_schema": v.parameters, "input_schema": { "type": "object", "properties": {}, "required": [] },
}) })
}) } else {
.collect(); json!({
} "name": v.name,
"description": v.description,
"input_schema": v.parameters,
})
}
})
.collect();
}
Ok(body) Ok(body)
} }