Merge pull request #3431 from pipecat-ai/mb/update-realtime-examples-transcript-handler

Update GeminiLiveLLMService to push thought frames, update 26a for new transcript events
This commit is contained in:
Mark Backman
2026-01-13 17:10:40 -05:00
committed by GitHub
3 changed files with 38 additions and 20 deletions

View File

@@ -44,6 +44,9 @@ from pipecat.frames.frames import (
LLMMessagesAppendFrame,
LLMSetToolsFrame,
LLMTextFrame,
LLMThoughtEndFrame,
LLMThoughtStartFrame,
LLMThoughtTextFrame,
LLMUpdateSettingsFrame,
StartFrame,
TranscriptionFrame,
@@ -1455,10 +1458,19 @@ class GeminiLiveLLMService(LLMService):
await self._set_bot_is_responding(True)
await self.push_frame(LLMFullResponseStartFrame())
self._bot_text_buffer += text
self._search_result_buffer += text # Also accumulate for grounding
frame = LLMTextFrame(text=text)
await self.push_frame(frame)
# Check if this is a thought
if part.thought:
# Gemini Live emits fully-formed thoughts rather than chunks,
# so bracket each thought in start/end frames
await self.push_frame(LLMThoughtStartFrame())
await self.push_frame(LLMThoughtTextFrame(text))
await self.push_frame(LLMThoughtEndFrame())
else:
# Regular text response
self._bot_text_buffer += text
self._search_result_buffer += text # Also accumulate for grounding
frame = LLMTextFrame(text=text)
await self.push_frame(frame)
# Check for grounding metadata in server content
if msg.server_content and msg.server_content.grounding_metadata: