fix: change LlmResponse to use Content for transcriptions

The transcription change breaks the multi-agent transfer during live/bidi.

Updates `GeminiLlmConnection` to populate the `content` field of `LlmResponse` with `types.Content` and `types.Part` objects for both input and output transcriptions, instead of using dedicated transcription fields. Also removes a debug print from `audio_cache_manager.py`.

the transcription is not fully ready to be used yet so roll back the transcription change.

PiperOrigin-RevId: 799851950
This commit is contained in:
Hangfei Lin
2025-08-26 21:12:34 -07:00
committed by Copybara-Service
parent bcf0dda8bc
commit 3b997a0a07
2 changed files with 13 additions and 3 deletions
@@ -141,7 +141,6 @@ class AudioCacheManager:
Returns:
True if the cache was successfully flushed, False otherwise.
"""
print('flush cache')
if not invocation_context.artifact_service or not audio_cache:
logger.debug('Skipping cache flush: no artifact service or empty cache')
return False
+13 -2
View File
@@ -164,8 +164,14 @@ class GeminiLlmConnection(BaseLlmConnection):
message.server_content.input_transcription
and message.server_content.input_transcription.text
):
user_text = message.server_content.input_transcription.text
parts = [
types.Part.from_text(
text=user_text,
)
]
llm_response = LlmResponse(
input_transcription=message.server_content.input_transcription,
content=types.Content(role='user', parts=parts)
)
yield llm_response
if (
@@ -180,8 +186,13 @@ class GeminiLlmConnection(BaseLlmConnection):
# We rely on other control signals to determine when to yield the
# full text response(turn_complete, interrupted, or tool_call).
text += message.server_content.output_transcription.text
parts = [
types.Part.from_text(
text=message.server_content.output_transcription.text
)
]
llm_response = LlmResponse(
output_transcription=message.server_content.output_transcription
content=types.Content(role='model', parts=parts), partial=True
)
yield llm_response