mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
feat: Granular Per Agent Speech Configuration
Merge https://github.com/google/adk-python/pull/3170 Addresses Feature Request: #3116 This PR adds a `speech_config` to the **LLM Agent configuration** for the **live use case**. When an **asynchronous LLM** call is made to the **Gemini Live API**, it prioritizes the most specific agent configuration's speech_config. If that is null, it then uses the run configuration's speech_config. Unit tests have been added to verify this behavior. COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/3170 from qyuo:bidi_agent_speech_config af1bd277d4f95c4a7d9aa0b16828ba3de826ce08 PiperOrigin-RevId: 822305427
This commit is contained in:
committed by
Copybara-Service
parent
2a901d12f4
commit
409df1378f
@@ -35,7 +35,10 @@ class StreamingMode(Enum):
|
||||
|
||||
|
||||
class RunConfig(BaseModel):
|
||||
"""Configs for runtime behavior of agents."""
|
||||
"""Configs for runtime behavior of agents.
|
||||
|
||||
The configs here will be overriden by agent-specific configurations.
|
||||
"""
|
||||
|
||||
model_config = ConfigDict(
|
||||
extra='forbid',
|
||||
|
||||
@@ -60,6 +60,8 @@ class Gemini(BaseLlm):
|
||||
|
||||
model: str = 'gemini-2.5-flash'
|
||||
|
||||
speech_config: Optional[types.SpeechConfig] = None
|
||||
|
||||
retry_options: Optional[types.HttpRetryOptions] = None
|
||||
"""Allow Gemini to retry failed responses.
|
||||
|
||||
@@ -269,6 +271,9 @@ class Gemini(BaseLlm):
|
||||
self._live_api_version
|
||||
)
|
||||
|
||||
if self.speech_config is not None:
|
||||
llm_request.live_connect_config.speech_config = self.speech_config
|
||||
|
||||
llm_request.live_connect_config.system_instruction = types.Content(
|
||||
role='system',
|
||||
parts=[
|
||||
|
||||
Reference in New Issue
Block a user