The ToolConfig part is not totally broken, it’s that ANY is broken. If you give gemini-1.5-flash-latest a useless (“do-nothing”) ToolConfig that specifies AUTO, the functionCall
comes through.
This is an example - it can be copied and posted as is:
{
"contents": [
{
"parts": [
{
"text": "Which prime number is larger than 277?"
}
],
"role": "user"
},
{
"parts": [
{
"text": "Here's how to find a prime number larger than 277:\n\n* **Understanding Prime Numbers:** A prime number is a whole number greater than 1 that has only two divisors: 1 and itself. \n* **Checking Numbers:** Start by checking the numbers just larger than 277. You can use a calculator or mental math to see if they are divisible by any smaller numbers. \n* **The Next Prime:** The next prime number after 277 is **281**. \n\nLet me know if you'd like to find more prime numbers! \n"
}
],
"role": "model"
},
{
"parts": [
{
"text": "Which theaters in Mountain View, CA show Barbie movie?"
}
],
"role": "user"
}
],
"tools": [
{
"function_declarations": [
{
"name": "find_theatersAPIToolModuleIPA",
"description": "\n find theaters based on location and optionally movie title which is currently playing in theaters\n ",
"parameters": {
"type": "object",
"properties": {
"movie": {
"type": "string",
"description": "Any movie title"
},
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"date": {
"type": "string",
"description": "When is the movie showing"
}
},
"required": [
"location"
]
}
},
{
"name": "find_moviesAPIToolModuleIPA",
"description": "\n find movie titles currently playing in theaters based on any description, genre or title words.\n ",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"description": {
"type": "string",
"description": "Any kind of description including category or genre or title words. Example: romantic comedy; Example: Star Wars; Example: Crime drama; Example: Science Fiction"
}
},
"required": [
"description"
]
}
}
]
}
],
"tool_config": {
"function_calling_config": {
"mode": "AUTO"
}
},
"safetySettings": [
{
"category": "HARM_CATEGORY_HARASSMENT",
"threshold": "BLOCK_LOW_AND_ABOVE"
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"threshold": "BLOCK_LOW_AND_ABOVE"
},
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"threshold": "BLOCK_MEDIUM_AND_ABOVE"
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold": "BLOCK_ONLY_HIGH"
}
],
"generationConfig": {
"temperature": 1.0,
"topP": 0.95,
"topK": 40,
"maxOutputTokens": 2048
}
}
And yes, the timing for unadvertised breaking of the environment just before people present their code is a recurring annoyance; as I recall they broke everyone using Go one day before the submission deadline the last time around by introducing the usageMetadata
in the response, which the Go library could not deserialize.