When passing a tool schema with ANY
nested map-like objects are not being returned properly. If I use AUTO
, however, it works as expected.
Here’s an example call that does not return the correct function call. Switching mode to AUTO resolves the problem.
I’m not sure why this inconsistency exists. Am I doing something wrong? It seems like a bug in the API.
curl -s -X POST \
"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite:generateContent?key=$GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"systemInstruction": {
"parts": [
{"text": "You are a helpful assistant. Keep responses concise."}
]
},
"contents": [
{
"role": "user",
"parts": [
{
"text": "FIll out a form with form id '\''jobApplication'\'' and entity references '\''person'\'' with keys '\''personId'\'' (12) and '\''personName'\'' (bob). YOU MUST FILL OUT THE KEYS"
}
]
}
],
"tools": [
{
"functionDeclarations": [
{
"name": "fillFrom",
"description": "Fill a form with data from specified entities. Be sure to provide all the required entities with their associated keys.",
"parameters": {
"type": "object",
"properties": {
"formId": {
"type": "string",
"description": "The ID of the form to fill"
},
"entityReferences": {
"type": "array",
"items": {
"type": "object",
"required": ["entityName", "keys"],
"properties": {
"entityName": { "type": "string" },
"keys": {
"type": "object",
"minProperties": 1,
"maxProperties": 1
}
}
}
}
},
"required": ["formId", "entityReferences"]
}
}
]
}
],
"toolConfig": {
"functionCallingConfig": {
"mode": "ANY"
}
},
"generationConfig": {
"temperature": 0.3,
"maxOutputTokens": 128
}
}'