for funciton calling, we want to dynamically chang...
# ask-ai
b
for funciton calling, we want to dynamically change function descripoint, how to achieve?
t
Thanks for reaching out, Gaurab. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks for reaching out! Could you please share a bit more about what you’re looking for? Are you trying to dynamically change the description of a function within a particular LiveKit feature or API? I’d love to understand your situation better, so feel free to provide any details about the feature or use case you’re working on. I’m here to help!
b
Copy code
@llm.ai_callable(
        description=(
            "<description>"
        )
    )

I am talking about this description
t
Thank you for your question! I’d love to help clarify how the
@llm.ai_callable
decorator works in LiveKit Agents v0.x. In this version, the function description is set when you define the function — it can come from the function’s docstring or a static parameter in the decorator, but unfortunately, it can’t be changed dynamically at runtime. Good news though! LiveKit Agents v1.0 brings some exciting improvements with the
@function_tool
decorator and the flexible
function_tool()
factory function. These let you create tools programmatically with dynamic descriptions, names, and parameters based on your application’s needs. Plus, you can update the available tools on the fly using the
update_tools()
method, which means you can change tool descriptions dynamically as well. If you’re sticking with v0.x for now, I understand that dynamically changing the description isn’t directly supported. One possible workaround could be registering a new function with the updated description and managing it manually, though this isn’t officially supported through a public API. Overall, if dynamic descriptions are important for your project, upgrading to v1.0 would be the best way to go. Please feel free to reach out if you’d like any help with the upgrade or have more questions — I’m here to support you! Sources: Agents 0.x migration guide | LiveKit Docs | Function calling with Voice Agents | LiveKit Docs | livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/llm.py | Tool definition and use | LiveKit Docs
b
write the above in 2-3 lines
t
Hi there! I wanted to share a quick tip about the
@llm.ai_callable
decorator in LiveKit Agents v0.x — it doesn’t support changing function descriptions dynamically at runtime. But no worries! If you upgrade to v1.0, you’ll find the new
@function_tool
decorator and
function_tool()
factory function really handy for creating tools with descriptions you can customize programmatically. If you'd like, I’m here to help you with the upgrade or anything else you need!