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
.iter()
.map(|v| {
json!({
if v.parameters.type_value.is_none() {
json!({
"name": v.name,
"description": v.description,
"input_schema": v.parameters,
})
})
.collect();
}
"input_schema": { "type": "object", "properties": {}, "required": [] },
})
} else {
json!({
"name": v.name,
"description": v.description,
"input_schema": v.parameters,
})
}
})
.collect();
}
Ok(body)
}