mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: Fix transcript finish
Merge https://github.com/google/adk-python/pull/3324 **Problem:** ADK seems to not pass output/input transcription `finished` flag from the Gemini. **Solution:** Relaxation of checking conditions of valid llm_response for input/output transcription. ### Testing Plan Unit test `test_receive_transcript_finished` checks if input/output transcription message with no text but `finished` flag is received. **Unit Tests:** - [x] I have added or updated unit tests for my change. - [x] All unit tests pass locally. <img width="785" height="373" alt="image" src="https://github.com/user-attachments/assets/6d870e9f-1372-4808-91a9-38578c1b3729" /> **Manual End-to-End (E2E) Tests:** Configure Gemini Agent to produce input & output transcriptions. Observe incoming transcript messages - to see if the finished flag appears at the end agents & users statement. ### Checklist - [x] I have read the [CONTRIBUTING.md](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) document. - [x] I have performed a self-review of my own code. - [x] I have commented my code, particularly in hard-to-understand areas. - [x] I have added tests that prove my fix is effective or that my feature works. - [x] New and existing unit tests pass locally with my changes. - [x] I have manually tested my changes end-to-end. - [x] Any dependent changes have been merged and published in downstream modules. ### Additional context The mentioned `finished` flag can be obtained in native Gemini APIs like via Websocket but not via ADK. Co-authored-by: Hangfei Lin <hangfei@google.com> COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/3324 from ChrisQlasty:fix/transcript_finish e7b8e5e5f5fac1d2dfd495f2dbadb19ed4328b0c PiperOrigin-RevId: 828987996
This commit is contained in:
committed by
Copybara-Service
parent
f167890d00
commit
8dd5a79b29
@@ -165,18 +165,12 @@ class GeminiLlmConnection(BaseLlmConnection):
|
||||
yield self.__build_full_text_response(text)
|
||||
text = ''
|
||||
yield llm_response
|
||||
if (
|
||||
message.server_content.input_transcription
|
||||
and message.server_content.input_transcription.text
|
||||
):
|
||||
if message.server_content.input_transcription:
|
||||
llm_response = LlmResponse(
|
||||
input_transcription=message.server_content.input_transcription,
|
||||
)
|
||||
yield llm_response
|
||||
if (
|
||||
message.server_content.output_transcription
|
||||
and message.server_content.output_transcription.text
|
||||
):
|
||||
if message.server_content.output_transcription:
|
||||
llm_response = LlmResponse(
|
||||
output_transcription=message.server_content.output_transcription
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user