incalculable-airplane-38849
07/29/2025, 9:40 PMtall-airline-16756
07/29/2025, 9:41 PMtall-airline-16756
07/29/2025, 9:41 PMexclude_function_call argument in the .copy() method for chat_ctx in LiveKit.
The method signature is:
def copy(
self,
*,
exclude_function_call: bool = False,
exclude_instructions: bool = False,
exclude_empty_message: bool = False,
tools: NotGivenOr[Sequence[FunctionTool | RawFunctionTool | str | Any]] = NOT_GIVEN,
) -> ChatContext:
When exclude_function_call=True, the method excludes items with type "function_call" and "function_call_output" from the copied context. By default, this parameter is set to False, meaning function calls are included unless explicitly excluded.
This parameter is often used in scenarios like:
• Excluding function calls when reconnecting in the OpenAI Realtime API.
• Copying chat context between agents while excluding function call history. Sources: livekit-agents/livekit/agents/voice/generation.py