mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: Add query parameters to /run_live for advanced run configurations
The /run_live websocket endpoint now accepts proactive_audio, enable_affective_dialog, and enable_session_resumption as query parameters. These parameters control the corresponding settings within the RunConfig used for the live session Close #4263 Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 865441673
This commit is contained in:
committed by
Copybara-Service
parent
1de65cf314
commit
f90adff8c5
@@ -1541,6 +1541,9 @@ class AdkWebServer:
|
||||
modalities: List[Literal["TEXT", "AUDIO"]] = Query(
|
||||
default=["AUDIO"]
|
||||
), # Only allows "TEXT" or "AUDIO"
|
||||
proactive_audio: bool | None = Query(default=None),
|
||||
enable_affective_dialog: bool | None = Query(default=None),
|
||||
enable_session_resumption: bool | None = Query(default=None),
|
||||
) -> None:
|
||||
await websocket.accept()
|
||||
|
||||
@@ -1557,7 +1560,22 @@ class AdkWebServer:
|
||||
|
||||
async def forward_events():
|
||||
runner = await self.get_runner_async(app_name)
|
||||
run_config = RunConfig(response_modalities=modalities)
|
||||
run_config = RunConfig(
|
||||
response_modalities=modalities,
|
||||
proactivity=(
|
||||
types.ProactivityConfig(proactive_audio=proactive_audio)
|
||||
if proactive_audio is not None
|
||||
else None
|
||||
),
|
||||
enable_affective_dialog=enable_affective_dialog,
|
||||
session_resumption=(
|
||||
types.SessionResumptionConfig(
|
||||
transparent=enable_session_resumption
|
||||
)
|
||||
if enable_session_resumption is not None
|
||||
else None
|
||||
),
|
||||
)
|
||||
async with Aclosing(
|
||||
runner.run_live(
|
||||
session=session,
|
||||
|
||||
Reference in New Issue
Block a user