Skip to content

Commit 9989fe2

Browse files
authored
Merge pull request #906 from pipecat-ai/mb/docs-pr-4709
Document @tool_options on register_function and switcher defaults
2 parents 2f9fe1e + d2c6bc0 commit 9989fe2

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

api-reference/server/utilities/service-switchers/llm-switcher.mdx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,12 @@ llm_switcher.register_function(
9595
parameter.
9696
</ParamField>
9797

98-
<ParamField path="cancel_on_interruption" type="bool" default="True">
98+
<ParamField path="cancel_on_interruption" type="bool | None" default="None">
9999
Whether to cancel this function call when a user interruption occurs. When
100100
`False`, the call is treated as asynchronous: the LLM continues the
101101
conversation immediately without waiting for the result, and the result is
102-
injected later via a developer message.
102+
injected later via a developer message. Defaults to `None`, which falls back
103+
to the handler's `@tool_options` value, then to `True`.
103104
</ParamField>
104105

105106
<ParamField path="timeout_secs" type="float | None" default="None">
@@ -131,11 +132,12 @@ llm_switcher.register_direct_function(
131132
The direct function to register. Must follow the DirectFunction protocol.
132133
</ParamField>
133134

134-
<ParamField path="cancel_on_interruption" type="bool" default="True">
135+
<ParamField path="cancel_on_interruption" type="bool | None" default="None">
135136
Whether to cancel this function call when a user interruption occurs. When
136137
`False`, the call is treated as asynchronous: the LLM continues the
137138
conversation immediately without waiting for the result, and the result is
138-
injected later via a developer message.
139+
injected later via a developer message. Defaults to `None`, which falls back
140+
to the handler's `@tool_options` value, then to `True`.
139141
</ParamField>
140142

141143
<ParamField path="timeout_secs" type="float | None" default="None">

pipecat/learn/function-calling.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ context = LLMContext(tools=[weather_function])
261261
llm.register_function("get_current_weather", fetch_weather_from_api)
262262
```
263263

264+
If the handler carries [`@tool_options`](#per-tool-options-with-@tool_options), `register_function` honors it the same way bundling does — or pass `cancel_on_interruption` / `timeout_secs` to `register_function` directly to override.
265+
264266
To remove the tool, un-advertise it with an [`LLMSetToolsFrame`](#changing-tools-mid-conversation); call `llm.unregister_function(...)` only afterward, since unregistering a still-advertised tool leaves the LLM able to call a handler that's no longer there.
265267

266268
This is uncommon — bundling keeps a tool and its handler together — but the option is there when you need to manage registration directly.

0 commit comments

Comments
 (0)