Using the Query Tool for Knowledge Bases
Learn how to configure and use the query tool to enhance your voice AI assistants with custom knowledge bases.
What is the Query Tool?
The Query Tool is a powerful feature that allows your voice AI assistant to access and retrieve information from custom knowledge bases. By configuring a query tool with specific file IDs, you can enable your assistant to provide accurate and contextually relevant responses based on your custom data.
Benefits of Using the Query Tool
- Enhanced contextual understanding: Your assistant can access specific knowledge to answer domain-specific questions.
- Improved response accuracy: Responses are based on your verified information rather than general knowledge.
- Customizable knowledge retrieval: Configure multiple knowledge bases for different topics or domains.
Currently, the Query Tool only supports Google as a provider with the gemini-1.5-flash model for knowledge base retrieval.
How to Configure a Query Tool for Knowledge Bases
Step 1: Upload Your Files
Before creating a query tool, you need to upload the files that will form your knowledge base. You can upload files via the API:
After uploading, you’ll receive file IDs that you’ll need for the next step.
Step 2: Create a Query Tool
Use the following API call to create a query tool that references your knowledge base files:
The description
field in the knowledge base configuration helps your
assistant understand when to use this particular knowledge base. Make it
descriptive of the content.
Step 3: Attach the Query Tool to Your Assistant
After creating the query tool, you’ll receive a tool ID. Use this ID to attach the tool to your assistant:
Option 1: Using the API
When using the PATCH request, you must include the entire model object, not just the toolIds field. This will overwrite any existing model configuration.
Option 2: Using the Dashboard
- Navigate to the Assistant section in your Vapi dashboard
- Select the assistant you want to configure
- Go to the Tools section
- Add the query tool by selecting it from the available tools
- Save and publish your assistant

Advanced Configuration Options
Multiple Knowledge Bases
You can configure multiple knowledge bases within a single query tool:
Knowledge Base Description
The description field helps your assistant understand when to use a particular knowledge base. Make it specific and clear:
Best Practices for Query Tool Configuration
- Organize by topic: Create separate knowledge bases for distinct topics to improve retrieval accuracy.
- Use descriptive names: Name your knowledge bases clearly to help your assistant understand their purpose.
- Keep descriptions specific: Write clear descriptions that tell the assistant exactly when to use each knowledge base.
- Update regularly: Refresh your knowledge bases as information changes to ensure accuracy.
- Test thoroughly: After configuration, test your assistant with various queries to ensure it retrieves information correctly.
For optimal performance, keep individual files under 300KB and ensure they contain clear, well-structured information.
By following these steps and best practices, you can effectively configure the query tool to enhance your voice AI assistant with custom knowledge bases, making it more informative and responsive to user queries.