summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/vertexai.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/client/vertexai.rs b/src/client/vertexai.rs
index cc7e464..a4c4050 100644
--- a/src/client/vertexai.rs
+++ b/src/client/vertexai.rs
@@ -353,7 +353,18 @@ pub fn gemini_build_chat_completions_body(
}
if let Some(functions) = functions {
- body["tools"] = json!([{ "functionDeclarations": *functions }]);
+ // Gemini doesn't support functions with parameters that have empty properties, so we need to patch it.
+ let function_declarations: Vec<_> = functions.into_iter().map(|function| {
+ if function.parameters.is_empty_properties() {
+ json!({
+ "name": function.name,
+ "description": function.description,
+ })
+ } else {
+ json!(function)
+ }
+ }).collect();
+ body["tools"] = json!([{ "functionDeclarations": function_declarations }]);
}
Ok(body)