Using functions, you can enhance the Knowledge Base of your voice assistant by including custom functionalities. Here’s how you can invoke a function in the knowledge base:

Introduction

Now that we’ve ensured our function works, we want to get our voice assistant to use it. Navigate to the knowledge base and start writing your instructions.

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
  2. Right-Click in the Knowledge Base Card’s “Actions” Field
  3. Click the Add Icon on the Right Side of the “Actions” Box

All of these methods will bring up the function context menu where you can search through all your assistant functions and select the one you want. From this menu, you can also create a function in context and populate its definition later.

You can use a function as many times as you like to cover all the use cases you want your voice assistant to handle.

Note

This is not an exact science and may require some iterative testing to get your voice assistant to call your function and behave as expected.

The example below has been found to work in many cases, but you will likely find better ways of constructing your conversation through trial and error.

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.

Testing Your Voice Assistant with Example

  1. Save Your Voice Assistant
  • Click the Play button in the top right-hand corner of the header to reveal the test chat panel.
  1. Ask “Where is my order?”
  • Watch as your assistant responds with the location in natural language.

Remember, we passed a stringified JSON location object to the LLM for it to do its magic.

  1. Check Function Calls
  • You can check if your voice assistant called a function and with what parameters by clicking on the settings button next to the close button in the test panel and enabling the functions toggle.

By following these steps, you can successfully invoke functions in the knowledge base of your voice assistant. For further assistance, please refer to our Support Page or contact our support team.