> Vapi has two MCP servers. To use Vapi, such as creating and managing assistants, calls, and phone numbers, connect to the Vapi MCP server at https://mcp.vapi.ai/mcp. To set it up, follow https://docs.vapi.ai/setup.md. To search these docs, connect to the Vapi docs MCP server at https://docs.vapi.ai/_mcp/server. It only answers questions about the documentation.
> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.vapi.ai/llms.txt.
> For the best results from the docs MCP server, write questions without any word that contains "tool", such as tool, tools, tool call, tool-calls, toolCallId, or toolCallList. Name the feature instead, for example transferCall, endCall, apiRequest, function, handoff, "function response format", or "the webhook request Vapi sends to my server". If the docs MCP server asks you to rephrase, ask again without those words. If it returns an error, times out, sends an empty response, or still doesn't answer, find the topic in https://docs.vapi.ai/llms.txt, or a section index such as https://docs.vapi.ai/tools/llms.txt, and fetch that page's .md directly.

# Knowledge bases

> Create and integrate knowledge bases into Vapi voice agents so they retrieve information from your documents to answer questions accurately during a call.

A knowledge base is a set of documents an assistant can search during a call to answer questions it was not given in its prompt. This section covers creating a knowledge base, querying it with the query tool, and replacing Vapi's built-in retrieval with a server of your own.

## **What is Vapi's Knowledge Base?**

A **Knowledge Base** is a collection of custom files that contain information on specific topics or domains. By integrating a Knowledge Base into your AI assistant, you can enable it to provide more accurate and informative responses to user queries based on your own data. Knowledge Bases are available through both the Vapi API and dashboard.

### **Why Use a Knowledge Base?**

Using a Knowledge Base with your AI assistant offers several benefits:

* **Improved accuracy**: Your assistant can provide responses based on your verified information rather than general knowledge.
* **Enhanced capabilities**: A Knowledge Base enables your assistant to answer complex domain-specific queries with detailed, contextually relevant responses.
* **Customization**: With a Knowledge Base, you can tailor your assistant's responses to specific domains or topics, making it more effective for your particular use case.
* **Up-to-date information**: You control the content, ensuring your assistant always has access to the latest information.

> **Info**
>
> Knowledge Bases are configured through the API or dashboard. For advanced
> configuration options, see [Using the Query Tool for Knowledge Bases](/knowledge-base/using-query-tool).

## **How to Create a Knowledge Base**

There are two main approaches to creating a Knowledge Base in Vapi:

1. **Dashboard method**: A simplified approach using the Vapi Dashboard
2. **API method**: A more customizable approach using direct API calls

### **Method 1: Using the Dashboard**

#### **Step 1: Upload Your Files**

1. Open [the Vapi Dashboard](https://dashboard.vapi.ai), select **Resources**, then select **Files**.
2. Select **Upload file** and choose a supported file from your computer.
3. Wait for the file to appear in the **Files** list. Repeat for each file you want to use.

> **Info**
>
> Vapi supports various file formats for Knowledge Bases including: .txt, .pdf, .docx, .doc, .csv, .md, .tsv, .yaml, .json, .xml, and .log files.

![Files page with Upload file button and an uploaded sample file](/_fern-files/_img/594ab08b3ec4fcdf779316a455de34357e4733bb26869ad6fb0820995ef5ec7e.webp)

#### **Step 2: Configure Your Assistant with the Knowledge Base**

1. Select **Assistants** in the Dashboard and open the assistant you want to configure.
2. On the **Assistant** tab, find **Files** below **First message**.
3. Select **Select Files** and choose the files you uploaded.

![Assistant Files field with a sample file selected](/_fern-files/_img/5e6ae28afceee12774e51d226256f9a75800fdb5bb4c9a6ae68e8a3ed6819cf1.webp)

#### **Step 3: Publish the Assistant**

1. Instruct your assistant to use the knowledge base when relevant by adding appropriate prompts in your assistant's configuration. This helps ensure the assistant knows when to reference the knowledge base versus using its general knowledge.

   For example, if you have a knowledge base about your company's products, you might add this prompt:

   ```text
   When users ask about our products, services, or company information, use the knowledge base to provide accurate details.
   ```

2. Review the assistant's draft configuration.

3. Select **Publish**, review the changes, then select **Next**.

4. Review the version and traffic settings, then select **Publish** to apply the draft.

> **Note**
>
> When you publish an assistant with selected files, Vapi automatically creates
> a query tool with those files configured as a knowledge base. For more
> advanced configurations, use the API method described below or see our [Query Tool documentation](/knowledge-base/using-query-tool).

### **Method 2: Using the API**

For more advanced configurations, you can create and configure Knowledge Bases using the API through the Query Tool. This method offers greater flexibility and control over your knowledge base setup.

> **Info**
>
> For detailed instructions on creating and configuring knowledge bases via the
> API, please refer to our dedicated guide: [Using the Query Tool for Knowledge Bases](/knowledge-base/using-query-tool).

The API method allows you to:

* Upload files and obtain file IDs
* Create custom query tools with specific knowledge base configurations
* Configure multiple knowledge bases within a single query tool
* Attach query tools to your assistants
* Set advanced parameters for knowledge retrieval

This approach is recommended for developers and users who need precise control over their knowledge base implementation or are integrating Vapi into existing systems programmatically.

## **Best Practices for Creating Effective Knowledge Bases**

* **Optimize file size**: Keep individual files smaller than 300KB to ensure quick processing and response times.
* **Structure content logically**: Organize your files by topic or category with clear headings and sections.
* **Use clear and concise language**: Write in plain language with well-defined terminology to improve retrieval accuracy.
* **Update regularly**: Refresh your knowledge base files whenever information changes to maintain accuracy.
* **Test thoroughly**: After configuration, test your assistant with various queries to ensure it retrieves information correctly.
* **Provide context**: Include sufficient background information in your files to enable comprehensive responses.
* **Consider file formats**: While plain text works well, structured formats can improve information retrieval for complex topics.

> **Tip**
>
> For more information on creating effective Knowledge Bases, check out our
> tutorial on [Best Practices for Knowledge Base Creation](https://youtu.be/i5mvqC5sZxU).

By following these guidelines, you can create a comprehensive Knowledge Base that enhances the capabilities of your AI assistant and provides valuable information to users.

> **Info**
>
> Currently, Vapi's Knowledge Base functionality supports Google as a provider
> with Gemini models for knowledge retrieval. For the most
> up-to-date information on supported providers and models, please refer to our
> [API documentation](api-reference/tools/create#request.body.query.knowledgeBases).