-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
pipecat version
0.0.98
Python version
3.12.3
Operating System
macOs
Issue description
I ran into a runtime error when trying to unregister a tool that I registered manually (using register_function + ToolsSchema).
It looks like unregister_function correctly removes the Python handler from the execution list, but it doesn't remove the JSON schema from the LLMContext. This leaves the LLM thinking the tool is still available. If the LLM tries to call it later in the conversation, Pipecat crashes (or errors out) because the handler is gone.
This is inconsistent with unregister_direct_function, which seems to clean up both the handler and the schema automatically.
Reproduction steps
- Register a function manually: llm.register_function("get_weather", weather_handler).
- Add the schema to the context: context = LLMContext(..., tools=[weather_schema]).
- Start the bot.
- In the middle of the flow, call llm.unregister_function("get_weather").
- Ask the bot a question that triggers that tool.
Expected behavior
I expected unregister_function to either:
- Automatically remove the schema from the context (like the direct method does).
- Or at least warn me that I need to manually clean up the schema myself.
Actual behavior
The function handler is removed silently. The LLM still sees the tool in its system prompt, attempts to call it, and the bot fails because no handler exists for "get_weather".
Logs
