fix: set context before update settings for live

This commit is contained in:
Abhishek Kumar 2026-04-07 18:46:17 +05:30
parent e04ce4e852
commit 6a473a9db5

View file

@ -174,13 +174,13 @@ class PipecatEngine:
tools_schema = ToolsSchema(standard_tools=functions)
self.context.set_tools(tools_schema)
await self.llm._update_settings(LLMSettings(system_instruction=system_prompt))
# For Gemini Live, set context on the LLM before _update_settings so that
# _connect (triggered by reconnect) can read tools from it.
if hasattr(self.llm, "_context") and not self.llm._context and self.context:
self.llm._context = self.context
await self.llm._update_settings(LLMSettings(system_instruction=system_prompt))
def _format_prompt(self, prompt: str) -> str:
"""Delegate prompt formatting to the shared workflow.utils implementation."""