fix: fix interruption handling for Gemini Live

1. Fixes #236
2. Fix run_inference for variable extraction for Gemini Live
This commit is contained in:
Abhishek Kumar 2026-04-15 19:29:07 +05:30
parent 14e6f29f2f
commit e31b38122e
12 changed files with 48 additions and 15 deletions

View file

@ -60,6 +60,7 @@ class PipecatEngine:
*,
task: Optional[PipelineTask] = None,
llm: Optional["LLMService"] = None,
inference_llm: Optional["LLMService"] = None,
context: Optional[LLMContext] = None,
workflow: WorkflowGraph,
call_context_vars: dict,
@ -75,6 +76,12 @@ class PipecatEngine:
):
self.task = task
self.llm = llm
# LLM used for out-of-band inference (variable extraction, context
# summarization). Falls back to the pipeline LLM when not provided.
# In realtime mode the pipeline LLM is a speech-to-speech service
# that does not implement run_inference, so a separate text LLM
# must be passed in.
self.inference_llm = inference_llm or llm
self.context = context
self.workflow = workflow
self._call_context_vars = call_context_vars

View file

@ -63,7 +63,7 @@ class ContextSummarizationManager:
orphaned tool calls from previous nodes) with a concise summary.
"""
context = self._engine.context
llm = self._engine.llm
llm = self._engine.inference_llm
current_node = self._engine._current_node
try:

View file

@ -203,12 +203,12 @@ class VariableExtractionManager:
# current node's system prompt that build_chat_completion_params
# would otherwise prepend.
# ------------------------------------------------------------------
llm_response = await self._engine.llm.run_inference(
llm_response = await self._engine.inference_llm.run_inference(
extraction_context, system_instruction=system_prompt
)
# Get model name for tracing
model_name = getattr(self._engine.llm, "model_name", "unknown")
model_name = getattr(self._engine.inference_llm, "model_name", "unknown")
if ensure_tracing():
tracer = trace.get_tracer("pipecat")
@ -221,7 +221,7 @@ class VariableExtractionManager:
]
add_llm_span_attributes(
span,
service_name=self._engine.llm.__class__.__name__,
service_name=self._engine.inference_llm.__class__.__name__,
model=model_name,
operation_name="llm-variable-extraction",
messages=tracing_messages,