Tool_config mode "ANY" is not working on gemini-1.5-flash

I’ve noticed that setting tool_config to “ANY” when using gemini-1.5-flash behaves like “AUTO”. “any” mode is expected to force responses with a function call. Instead, it behaves like “auto” mode which calls functions when the model decides to.

Here’s a sample code with faked data reproducing the bug:

Hello @aitor,
I’m also experiencing this issue consistently. When using gemini-1.5-flash with tool_config set to “ANY”, I’ve noticed that it behaves like “AUTO” instead of forcing function calls. However, I’ve had no problems when using the gemini-1.5-pro model with the same “system message” and user prompts.

My simple system message is:

CONTEXT:
you are an helpful assistant.
you are provided a function.

TASK:
your task is to normally answer the user request. If user request is an assistance or booking request you must call function.

PROMPT is:

In about 10 words, write a poem about a little white cat

Function definition:

{
  "name": "helpdesk_request",
  "description": "send a support request email to a specific HelpDesk department",
  "parameters": {
    "type": "object",
    "properties": {
      "email": {
        "type": "string",
        "format": "enum",
        "enum": [
          "network@helpdesk.local",
          "hardware@helpdesk.local",
          "email@helpdesk.local",
          "booking@helpdesk.local",
          "other@helpdesk.local"
        ],
        "description": "email address for specific helpdesk departments, you must choose the right email address based on user request. For booking request output Date: and Time: or From:/To: fields"
      },
      "subject": {
        "type": "string",
        "description": "short email subject, based on user request"
      },
      "body": {
        "type": "string",
        "description": "a bulleted list of user requests"
      }
    },
    "required": [
      "email",
      "subject",
      "body"
    ]
  }
}

RESPONSE gemini-1.5-flash with tool_config set to “ANY”:

function call: no                                                                               
                                                                                                                                                                                                 Tiny paws, white fur so bright,                                                                 
A playful spirit, day and night. 

RESPONSE gemini-1.5-pro with tool_config set to “ANY”:

function call: yes

function name: helpdesk_request
function args: {"body":"- write a poem about a little white cat\\n- the poem should be about 10 words long","email":"other@helpdesk.local","subject":"User request"}

Have you tried using gemini-1.5-pro with the same system message, prompt and function definition? If it works, then I think it is really a bug.

Ciao