Enable LLMs to interact with external services and APIs
FunctionSchema
that works across all supported LLM providers. This makes it easy to define functions once and use them with any provider.
As a shorthand, you could also bypass specifying a function configuration at all and instead use “direct” functions. Under the hood, these are converted to FunctionSchema
s.
ToolsSchema
will be automatically converted to the correct format for your LLM provider through adapters.
FunctionSchema
or in a provider-specific format) and instead pass the function directly to your ToolsSchema
. Pipecat will auto-configure the function, gathering relevant metadata from its signature and docstring. Metadata includes:
FunctionCallParams
, followed by any others necessary for the function.
register_function
register_direct_function
FunctionCallParams
object contains all the information needed for handling function calls:
params
: FunctionCallParams
function_name
: Name of the called functionarguments
: Arguments passed by the LLMtool_call_id
: Unique identifier for the function callllm
: Reference to the LLM servicecontext
: Current conversation contextresult_callback
: Async function to return resultsparams.arguments
params.result_callback(result)
FunctionCallResultProperties
object passed to the result callback.
True
: Run LLM after function call (default if no other function calls in progress)False
: Don’t run LLM after function callNone
: Use default behavior