Update GeminiLiveLLMService to push Thought frames when thought content is returned

This commit is contained in:
Mark Backman
2026-01-13 14:13:00 -05:00
parent d0f227189c
commit 15bc1dd999

View File

@@ -44,6 +44,9 @@ from pipecat.frames.frames import (
LLMMessagesAppendFrame, LLMMessagesAppendFrame,
LLMSetToolsFrame, LLMSetToolsFrame,
LLMTextFrame, LLMTextFrame,
LLMThoughtEndFrame,
LLMThoughtStartFrame,
LLMThoughtTextFrame,
LLMUpdateSettingsFrame, LLMUpdateSettingsFrame,
StartFrame, StartFrame,
TranscriptionFrame, TranscriptionFrame,
@@ -1455,6 +1458,15 @@ class GeminiLiveLLMService(LLMService):
await self._set_bot_is_responding(True) await self._set_bot_is_responding(True)
await self.push_frame(LLMFullResponseStartFrame()) await self.push_frame(LLMFullResponseStartFrame())
# 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(signature=part.thought_signature))
else:
# Regular text response
self._bot_text_buffer += text self._bot_text_buffer += text
self._search_result_buffer += text # Also accumulate for grounding self._search_result_buffer += text # Also accumulate for grounding
frame = LLMTextFrame(text=text) frame = LLMTextFrame(text=text)