agents icon indicating copy to clipboard operation
agents copied to clipboard

function calling is not working for gemini-2.5-flash-preview-native-audio-dialog

Open shirosh opened this issue 1 year ago • 44 comments

function calling is not working for gemini-2.5-flash-preview-native-audio-dialog model selection. Please fix it. Because this model can support many languages.

shirosh avatar May 22 '25 06:05 shirosh

this is a model issue.. please file the issue with Google Gemini

davidzhao avatar May 22 '25 06:05 davidzhao

this is a model issue.. please file the issue with Google Gemini

Could you point me to where I should open an issue? I'll gladly do it but what repo? Gemini realtime somewhere?

schedawg74 avatar May 22 '25 18:05 schedawg74

I'm not certain as this is Google.. but https://github.com/googleapis/python-genai might be a good spot

davidzhao avatar May 22 '25 18:05 davidzhao

Thx!

https://github.com/googleapis/python-genai/issues/843

schedawg74 avatar May 22 '25 18:05 schedawg74

Hi @davidzhao according to https://github.com/googleapis/python-genai/issues/843 they asking to set response_modalities to AUDIO.

Can you look into that? Better if you can enable all genai SDK features for LiveKit as well.

shirosh avatar May 23 '25 08:05 shirosh

yup, it's always been set to AUDIO. see code

davidzhao avatar May 23 '25 15:05 davidzhao

@davidzhao They're saying it should work, not sure if you could step in here? https://github.com/googleapis/python-genai/issues/843#issuecomment-2905784742

schedawg74 avatar May 23 '25 23:05 schedawg74

will reopen the issue and debug on our side to see if it's a genai version issue.

davidzhao avatar May 24 '25 04:05 davidzhao

validated that the livekit side is sending it the right tool definitions. It does look like tool calls works sometimes.. other times the model seems to ignore it. I updated to the latest genai version in #2390, but it's unclear if that helps.

furthermore, there's confirmation that this is reproducible with Google's ADK as well.

based on the comment, it seems that the model has trouble calling functions for native audio input.

davidzhao avatar May 25 '25 17:05 davidzhao

I can confirm it is still not working tools are not being called when using

"gemini-2.5-flash-preview-native-audio-dialog"

but they do work when using

"gemini-2.5-flash-exp-native-audio-thinking-dialog"

if anyone finds a way to fix this please sure this new model is really a few steps ahead of everything else we want to get this into production

mercuryyy avatar May 30 '25 03:05 mercuryyy

@davidzhao

I tested google-genai 1.17.0 Seems to preform better 4/10 times the tool calling gets executed compared to 1/10 with 1.16.1

I'v been digging into this for a few hours i can't to find the source of the issue.

"gemini-2.0-flash-live-001" <-- works perfectly fine 10/10 times "gemini-2.5-flash-preview-native-audio-thinking-dialog" <-- works 7/10 times

"gemini-2.5-flash-preview-native-audio-dialog" <-- Does not work consistent or anywhere close

mercuryyy avatar May 30 '25 11:05 mercuryyy

Update:

Tool Calling using

"https://aistudio.google.com"

using "gemini-2.5-flash-preview-native-audio-thinking-dialog"

Now works every single time.

But still not working using the API, its not a model problem it has something to do with genai sdk or livekit sdk

mercuryyy avatar May 30 '25 23:05 mercuryyy

the difference might be transcripts.. can you try livekit while disabling input or output audio transcripts?

davidzhao avatar May 31 '25 06:05 davidzhao

@davidzhao

you mean inside session.start? room_output_options=RoomOutputOptions(transcription_enabled=True)

mercuryyy avatar May 31 '25 11:05 mercuryyy

no. in model options

RealtimeModel(
    input_audio_transcription=None,
    output_audio_transcription=None,
)

davidzhao avatar Jun 01 '25 16:06 davidzhao

@davidzhao

Tried with

                            input_audio_transcription=None,
                            output_audio_transcription=None,

No change still not executing the tool calls.

Also tried with the latest "google-genai==1.18.0" (released yesterday) still no change

I think there is an issue in how livekit is initiating the tool call in the gemini live sdk rather then the gemini live sdk itself.

mercuryyy avatar Jun 02 '25 02:06 mercuryyy

I think there is an issue in how livekit is initiating the tool call in the gemini live sdk rather then the gemini live sdk itself.

That is highly unlikely due to:

  • the same code works with Gemini 2.0 flash
  • the issue is confirmed without using agents framework

davidzhao avatar Jun 02 '25 06:06 davidzhao

@davidzhao

I got this response from google

"try enabling grounding with google search. For us it worked. It probably triggers their python env in the backend while the function calling doesn't (probably a bug on their end)."

Is enabling grounding with google search supported in the livekit sdk ?

mercuryyy avatar Jun 12 '25 15:06 mercuryyy

+1!

IngLP avatar Jun 12 '25 15:06 IngLP

@davidzhao

I got this response from google

"try enabling grounding with google search. For us it worked. It probably triggers their python env in the backend while the function calling doesn't (probably a bug on their end)."

Is enabling grounding with google search supported in the livekit sdk ?

@mercuryyy , When grounding is enabled , does this work 10/10 times?

vaibhavard avatar Jun 13 '25 07:06 vaibhavard