How to Build Custom Tools for Your AI Voice Assistants | VAPI Tutorial
Science & Technology
How to Build Custom Tools for Your AI Voice Assistants | VAPI Tutorial
Hello everyone, today we are going to be walking through how to use VAP tools. As many of you know, functions have been deprecated in VAP and I've heard from a lot of you who watched my last 40-minute VAP tutorial that you needed some assistance with navigating these new tools. Well, don't worry, in this video I'll be doing just that. We'll cover what they are, how they work, and how you can build your own tools using a cool example.
For those of you who don't know, my name is Jonas Massie, founder of Espinat AI. We turbocharge businesses by leveraging cutting-edge AI technology to streamline business operations and enhance customer experiences. But without further ado, let's get straight into this video!
Introduction to VAP Tools
First and foremost, what are tools? Tools are the same as functions; they just follow older syntax as per the OpenAI spec. A tool structure includes the type, messages, function details, any asynchronous behavior, and a server URL. The function defines the tool's purpose and parameters. So if you were met with this orange box following my last video, we now have tools in place. Tools can be customized and expanded to create more interactive and efficient user experiences within your VAP assistant.
How VAP Tools Work
VAP tools work by allowing the assistant to perform specific tasks through configured functions. Each tool includes the type, messages, function details, and a server URL. When a tool is called, the assistant sends an HTTP request to our server URL, which then processes this function and returns a JSON response. This enables VAP to handle more complex tasks and provide interactive user experiences.
Setting Up VAP Tools – Example: Pizza Store Assistant
Let's head over to our VAP dashboard and get into building one for ourselves. There are some tutorials out there on VAP's new tools, but for this example, we'll be doing the same only for a slightly more complex use case to give sort of a more detailed understanding of tools and real-world utility that they can provide.
First up, we need to create an assistant. Our assistant today will be a pizza store that will receive calls and query our database to return a user's last order details or create a new one if they don't exist. I'll just name it Pizza Assistant and we can use a blank template. Hit "Create Assistant."
For this new assistant, we can enter our first message and system prompt. We'll change the provider to a cheaper version of GPT 2.40 cluster, or you can use Mini now. VAP has GPT 40 Mini Cluster, which is good for smaller specific use cases and is very cheap to run as well.
First message can say something like, "Hi, this is Tony's Pizza, how can I help?" A very generic pizza store name. The system prompt is pretty simple but essentially gives it a task which is to act as a receptionist that will receive inbound customer calls.
We'll use a simple spreadsheet for our database:
Custom ID | Name | Number | Last Order |
---|---|---|---|
1 | Joe | 04123456789 | 2x Garlic Bread, 1x Large Pepperoni |
2 | Jane | 04567891234 | 1x Veg Taco, 2x Chicken Wings |
What we're doing is we're going to be querying the number to get the customer details and more specifically their last order and then we're going to return the results.
We need to create a tool. Head over to "Tools" and hit "New Tool." We have three options here: Provide a backend endpoint, Make endpoint, and Go High Level workflow URL. We'll use Make endpoint. In Make, set up a webhook like so, add your webhook URL, and hit save.
Building the Schema and Tool
The schema is how our request is structured. Properties here and their descriptions are what the assistant needs to collect. For this example, it's going to be our customer's phone number.
After building the schema, hit "Save." The tool name will be "database." This is what we'll call in our system prompt. The description can be something like "Check the database for an existing customer" and hit create.
Implementing Google Sheets Query in Make
Now we'll query our database using Google Sheets with the webhook response containing the details. Set up a Google Sheets search rows module in Make. This could be an Excel or a more complex database, but for simplicity, we'll use Google Sheets.
Implement filters to determine if the customer exists and route responses accordingly. Make sure to include the asynchronous flag when creating a tool in VAP so it waits for our server response.
Testing the Assistant
Let's test the assistant. Running our Make scenario should successfully return the last order if the customer's phone number exists in the database or prompt for a new order if it doesn't.
Conclusion
Today, we covered what these tools are, how they work, and built one using a pizza restaurant example. I hope this answered some of your questions from the previous tutorial. If you have any further questions regarding these AI voice assistants, drop a comment below. Don't forget to subscribe to stay ahead of the AI curve. Exciting content like cloning myself coming soon.
For businesses looking to integrate this technology, visit our website to work with us. Until next week, take care!
Keywords
- VAP tools
- AI assistant
- Pizza store assistant
- Google Sheets
- Webhook
- Asynchronous behavior
- JSON response
- AI voice assistant
- Tools customization
FAQ
Q: What are VAP tools?
- A: Tools in VAP are similar to functions but follow older syntax. They help perform specific tasks through configured functions following the OpenAI spec.
Q: How do VAP tools work?
- A: The assistant sends an HTTP request to a server URL, processes a function, and returns a JSON response. This allows handling more complex tasks and interactive user experiences.
Q: What is the process to set up a tool in VAP?
- A: First, create an assistant, then define its initial message and system prompt. Create a tool by providing a backend or Make endpoint and build the schema for the request.
Q: Can I use databases other than Google Sheets?
- A: Yes, you can use different databases such as Excel or more complex systems.
Q: How do you handle asynchronous behavior in VAP tools?
- A: Include an asynchronous flag when creating the tool, ensuring the assistant waits for the server to respond before proceeding.