nemo_voice_agent.utils.tool_calling.mixins

View as Markdown

Module Contents

Classes

NameDescription
ToolCallingMixinA mixin class for tool calling.

Functions

NameDescription
register_direct_tools_to_llmRegister direct tools to the LLM.

API

class nemo_voice_agent.utils.tool_calling.mixins.ToolCallingMixin()

A mixin class for tool calling. Subclasses must implement the setup_tool_calling method to register all available tools using self.register_direct_function(). Then the __init__ method of the subclass should call the setup_tool_calling method to register the tools.

available_tools
dict[str, DirectFunction]

Return a dictionary of available tools, where the key is the tool name and the value is the direct function.

nemo_voice_agent.utils.tool_calling.mixins.ToolCallingMixin.register_direct_function(
function_name: str,
function: pipecat.adapters.schemas.direct_function.DirectFunction
)

Register a direct function to be called by the LLM.

Parameters:

function_name
str

The name of the function to register.

function
DirectFunction

The direct function to register.

nemo_voice_agent.utils.tool_calling.mixins.ToolCallingMixin.setup_tool_calling()

Setup the tool calling mixin by registering all available tools using self.register_direct_function().

nemo_voice_agent.utils.tool_calling.mixins.register_direct_tools_to_llm(
llm: pipecat.services.openai.llm.OpenAILLMService,
context: pipecat.processors.aggregators.llm_context.LLMContext,
tool_mixins: list[nemo_voice_agent.utils.tool_calling.mixins.ToolCallingMixin] = [],
tools: list[pipecat.adapters.schemas.direct_function.DirectFunction] = [],
cancel_on_interruption: bool = True
) -> None

Register direct tools to the LLM. Args: llm: The LLM service to use. context: The LLM context to use. tools: The list of tools (instances of either DirectFunction or ToolCallingMixin) to use.