Skip to content

Commit d5bd8d9

Browse files
seanzhougooglecopybara-github
authored andcommitted
chore: Clean up the invocation context initialization logic for LIVE
1. Removed dead code: The if not run_config.response_modalities: branch was never executed since run_live already sets the default (https://github.com/google/adk-python/blob/19de45b3250d09b9ec16c45788e7d472b3e588c2/src/google/adk/runners.py#L947-L948). 2. Simplified condition: Changed from checking 'TEXT' not in ... to 'AUDIO' in ... Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com> PiperOrigin-RevId: 853274401
1 parent 96c5db5 commit d5bd8d9

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/google/adk/runners.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,23 +1381,15 @@ def _new_invocation_context_for_live(
13811381
"""Creates a new invocation context for live multi-agent."""
13821382
run_config = run_config or RunConfig()
13831383

1384-
# For live multi-agent, we need model's text transcription as context for
1385-
# next agent.
1384+
# For live multi-agents system, we need model's text transcription as
1385+
# context for the transferred agent.
13861386
if self.agent.sub_agents and live_request_queue:
1387-
if not run_config.response_modalities:
1388-
# default
1389-
run_config.response_modalities = ['AUDIO']
1390-
if not run_config.output_audio_transcription:
1391-
run_config.output_audio_transcription = (
1392-
types.AudioTranscriptionConfig()
1393-
)
1394-
elif 'TEXT' not in run_config.response_modalities:
1387+
if 'AUDIO' in run_config.response_modalities:
13951388
if not run_config.output_audio_transcription:
13961389
run_config.output_audio_transcription = (
13971390
types.AudioTranscriptionConfig()
13981391
)
13991392
if not run_config.input_audio_transcription:
1400-
# need this input transcription for agent transferring in live mode.
14011393
run_config.input_audio_transcription = types.AudioTranscriptionConfig()
14021394
return self._new_invocation_context(
14031395
session,

0 commit comments

Comments
 (0)