If there are multiple tools available, is there a ...
# ask-ai
m
If there are multiple tools available, is there a way to prioritize a subset of tools to be always used by the agent?
t
Thanks for reaching out, AI. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Could you please clarify what you mean by prioritizing a subset of tools? Are you referring to configuring LiveKit to prioritize certain tools for agents, or are you asking about best practices for agents to prioritize tools during their workflow?
m
Yes i want to set few tools to be aclled always by the agent
t
Hey there! Let's talk about how you can customize LiveKit to make your agents even more awesome by prioritizing specific tools. We'll use the super handy
tool_choice
parameter in the
ModelSettings
class, which lets you tell the system exactly which tools you want to shine. Here's a friendly example of how you can set this up:
Copy code
@dataclass
class ModelSettings:
    tool_choice: NotGivenOr[llm.ToolChoice] = NOT_GIVEN
    """The tool choice to use when calling the LLM."""
And guess what? The
Agent
class is also super flexible. When you're setting up your agent, you can define tool preferences right in the initialization parameters:
Copy code
def __init__(
    self,
    *,
    instructions: str,
    chat_ctx: NotGivenOr[llm.ChatContext | None] = NOT_GIVEN,
    tools: list[llm.FunctionTool | llm.RawFunctionTool] | None = None,
    # other parameters...
) -> None:
By tweaking these settings, you'll have your agents working exactly the way you want. Sounds cool, right? If you need any help putting this into practice, I'm totally here for you – just give me a shout! Sources: GitHub::LiveKit Agents | livekit-agents/livekit/agents/voice/agent.py | GitHub:: LiveKit Composite Repo | livekit/agents/livekit-agents/livekit/age...
m
Can you explain with an example
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
m
Hey there! Let's talk about how you can customize LiveKit to make your agents even more awesome by prioritizing specific tools. We'll use the super handy
tool_choice
parameter in the
ModelSettings
class, which lets you tell the system exactly which tools you want to shine. Here's a friendly example of how you can set this up:
Copy code
@dataclass
class ModelSettings:
    tool_choice: NotGivenOr[llm.ToolChoice] = NOT_GIVEN
    """The tool choice to use when calling the LLM."""
And guess what? The
Agent
class is also super flexible. When you're setting up your agent, you can define tool preferences right in the initialization parameters:
Copy code
def __init__(
    self,
    *,
    instructions: str,
    chat_ctx: NotGivenOr[llm.ChatContext | None] = NOT_GIVEN,
    tools: list[llm.FunctionTool | llm.RawFunctionTool] | None = None,
    # other parameters...
) -> None:
By tweaking these settings, you'll have your agents working exactly the way you want. Sounds cool, right? If you need any help putting this into practice, I'm totally here for you – just give me a shout! Use this as context
Hey