Issue changing default voice in Gemini2 live api
Description of the bug:
I'm using the code in live_api_starter.py to test out the multimodal live api and build from there. The basic code works. Based on the documentation in https://ai.google.dev/api/multimodal-live#sessions I am attempting to change the default voice but it seems to be not working if I use the format mentioned in the API documentation:
My code snippet:
MODEL = "models/gemini-2.0-flash-exp"
MODE = args.mode
client = genai.Client(http_options={"api_version": "v1alpha"})
CONFIG = {
"generation_config": {
"response_modalities": ["AUDIO"],
"speech_config": {
"voice_config": {
"prebuilt_voice_config": {
"voice_name": "Charon"
}
}
},
}
}
Error message:
Traceback (most recent call last):
File "/Users/rishi/Projects/gemini_live/new.py", line 393, in
Actual vs expected behavior:
No response
Any other information you'd like to share?
No response
I had the same issue. Try this instead. It worked for me.
"generation_config": { "response_modalities": ["AUDIO"], "speech_config": "Charon" }
, "speech_config": "Charon"
I had the same issue. Try this instead. It worked for me.
"generation_config": { "response_modalities": ["AUDIO"], "speech_config": "Charon" }
that works, thanks @ThashilNaidoo !
but i also noticed the report is triaged as a bug so hopefully they can fix the issue and/or clarify which one is the correct usage
Hi, thanks for reporting this. I just looked into it and this is fixed in the latest release (0.4).
Both methods work now.
Hi, thanks for reporting this. I just looked into it and this is fixed in the latest release (0.4).
Both methods work now.
I tried both and neither are working for me
Invalid JSON payload received. Unknown name "prebuilt_voice_config " at 'setup.generati; then sent 1007 (invalid frame payload data) Request trace id: 74133fd7e2c07425, Invalid JSON payload received. Unknown name "prebuilt_voice_config " at 'setup.generati
conn = await es.enter_async_context(
connect(
f'wss://{HOST}/ws/google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContent?key={API_KEY}')
)
print('
initial_request = {
'setup': {
'model': MODEL,
'system_instruction': {
"parts": [
{
"text": SYSTEM_MESSAGE
}
]
},
"tools": {'function_declarations': [pay_bill_tool, get_quote_tool]},
"generation_config": {
"response_modalities": ["AUDIO"],
"speech_config": {
"voice_config": {
"prebuilt_voice_config ": {
"voice_name": "Puck"
}
}
}
}
},
}
Let me try this
Hi, I just checked on my end and it is working as expected. Please refer to the documentation, and let me know if you are still experiencing the issue.
Thanks
Marking this issue as stale since it has been open for 14 days with no activity. This issue will be closed if no further activity occurs.
This issue was closed because it has been inactive for 27 days. Please post a new issue if you need further assistance. Thanks!