bug: Fixed a bug when passing tools to Claude for tools that don't have any inputs
This commit is contained in:
+14
-6
@@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user