-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
models[Component] Issues related to model support[Component] Issues related to model support
Description
** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.
Describe the bug
Is gemini-2.5-flash-preview-tts supported ?
when creating:
generate_content_config = GenerateContentConfig(
temperature=0.5,
response_modalities=["AUDIO"],
)
root_agent = Agent(
model="gemini-2.5-flash-preview-tts",
name="some name",
description="some desc",
instruction=agent_instruction,
output_key="user_mood",
generate_content_config=generate_content_config,
)and then run run_async
class VoiceAgentCreator(AgentRunnerCreator):
def __init__(self, session_id: str, agent: Agent, app_name: str):
super().__init__(session_id, agent, app_name)
async def create(self) -> None:
await self.init_session()
self.init_runner()
self.init_speech_config()
self.init_run_config()
def init_speech_config(self) -> None:
self.speech_config = types.SpeechConfig(
voice_config=types.VoiceConfig(
prebuilt_voice_config=types.PrebuiltVoiceConfig(voice_name="Puck")
),
language_code="pl-PL"
)
def init_run_config(self):
self.run_config = RunConfig(
speech_config=self.speech_config
)
------ then in the code after init I call:
async def call_voice_agent(voice_agent: VoiceAgentCreator, text: str):
async for _event in voice_agent.runner.run_async(
user_id=voice_agent.session.user_id,
session_id=voice_agent.session.id,
new_message=types.Content(role="user", parts=[types.Part.from_text(text=text)]),
run_config=voice_agent.run_config,
):
if _event.content and _event.content.parts:
_part = _event.content.parts[0]
audio_data = _part.inline_data and _part.inline_data.data
if audio_data:
return {
"mime_type": "audio/pcm",
"data": base64.b64encode(audio_data).decode("ascii"),
"role": "model",
}which should send message via websocket to by played on website
message = await call_voice_agent(voice_agent, part.text)
await websocket.send_text(json.dumps(message))but I got error 500 from server
To Reproduce
Steps to reproduce the behavior:
- use
gemini-2.5-flash-preview-ttsas agent model - put query to the model and send it via websocket
Expected behavior
On website I should hear agent response
Desktop (please complete the following information):
- OS: Macbook
- Python version(python -V): 3.13
- ADK version(pip show google-adk): 1.1.1
Additional context
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 244, in run_asgi
result = await self.app(self.scope, self.asgi_receive, self.asgi_send) # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/starlette/applications.py", line 112, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/starlette/middleware/errors.py", line 152, in __call__
await self.app(scope, receive, send)
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/starlette/routing.py", line 714, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/starlette/routing.py", line 734, in app
await route.handle(scope, receive, send)
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/starlette/routing.py", line 362, in handle
await self.app(scope, receive, send)
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/starlette/routing.py", line 95, in app
await wrap_app_handling_exceptions(app, session)(scope, receive, send)
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/starlette/routing.py", line 93, in app
await func(session)
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/fastapi/routing.py", line 383, in app
await dependant.call(**solved_result.values)
File "/Users/pretbc/Workspace/mood-mate/app/main.py", line 294, in websocket_endpoint
await asyncio.gather(agent_to_client_task, client_to_agent_task)
File "/Users/pretbc/Workspace/mood-mate/app/main.py", line 195, in agent_to_client_messaging
message = await call_voice_agent(voice_agent, part.text)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pretbc/Workspace/mood-mate/app/main.py", line 201, in call_voice_agent
async for _event in voice_agent.runner.run_async(
...<16 lines>...
}
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/google/adk/runners.py", line 197, in run_async
async for event in invocation_context.agent.run_async(invocation_context):
...<2 lines>...
yield event
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/google/adk/agents/base_agent.py", line 147, in run_async
async for event in self._run_async_impl(ctx):
yield event
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/google/adk/agents/llm_agent.py", line 278, in _run_async_impl
async for event in self._llm_flow.run_async(ctx):
self.__maybe_save_output_to_state(event)
yield event
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 279, in run_async
async for event in self._run_one_step_async(invocation_context):
last_event = event
yield event
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 305, in _run_one_step_async
async for llm_response in self._call_llm_async(
...<8 lines>...
yield event
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 520, in _call_llm_async
async for llm_response in llm.generate_content_async(
...<16 lines>...
yield llm_response
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/google/adk/models/google_llm.py", line 146, in generate_content_async
response = await self.api_client.aio.models.generate_content(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
)
^
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/google/genai/models.py", line 7453, in generate_content
response = await self._generate_content(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
model=model, contents=contents, config=parsed_config
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/google/genai/models.py", line 6447, in _generate_content
response_dict = await self._api_client.async_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'post', path, request_dict, http_options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/google/genai/_api_client.py", line 799, in async_request
result = await self._async_request(http_request=http_request, stream=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/google/genai/_api_client.py", line 743, in _async_request
await errors.APIError.raise_for_async_response(response)
File "/Users/pretbc/Workspace/mood-mate/.venv/lib/python3.13/site-packages/google/genai/errors.py", line 131, in raise_for_async_response
raise ServerError(status_code, response_json, response)
google.genai.errors.ServerError: 500 INTERNAL. {'error': {'code': 500, 'message': 'An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting', 'status': 'INTERNAL'}}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
models[Component] Issues related to model support[Component] Issues related to model support