Introduction
After creating and testing your function, the next step is to integrate it into your agent’s knowledge base so it can be used dynamically during conversations.Adding a function
You can add a function into the knowledge base in three ways:1. Type ”/” in the knowledge base card’s “Actions” field
- Begin typing ”/” in the “Actions” field of your knowledge base card to bring up the function context menu.
2. Right-click in the knowledge base card’s “Actions” field
- Right-click in the “Actions” field to access the function menu and select your desired function.
3. Click the add icon on the right side of the “Actions” box
- Use the ”+” icon on the right side of the “Actions” field to add a function.
Best practices
While invoking functions is powerful, it requires testing and iterative adjustments to achieve the desired behavior. Here’s a proven approach to guide your agent: When the user asks “where is my order,” do not respond until you have called{{fn:order_lookup}}
with an order number. If you don’t know their order number, you should ask first and then call {{fn:order_lookup}}
. You should ignore all other impulses and follow the response of the function to give back to the caller.
This methodology ensures the function is invoked appropriately and the response aligns with user expectations.
Testing your voice agent with example
Step 1: Save your voice agent
- Save your agent and click the Play button in the header to open the test chat panel.
Step 2: Test the invocation
- Ask a test question like “Where is my order?” and observe how the agent handles the interaction.
Step 3: Verify function calls
- In the test chat panel, click the settings button near the close icon and enable the “Functions” toggle to review the function calls and parameters used.