Skip to content

Commit

Permalink
docs: new knowledgebase (#65)
Browse files Browse the repository at this point in the history
* docs: new knowledgebase

* unnecessary comments
  • Loading branch information
rumbleFTW authored Nov 27, 2024
1 parent 4a259f5 commit 2f05480
Show file tree
Hide file tree
Showing 3 changed files with 237 additions and 120 deletions.
150 changes: 94 additions & 56 deletions fern/community/knowledgebase.mdx
Original file line number Diff line number Diff line change
@@ -1,63 +1,101 @@
---
title: Knowledgebase
subtitle: Videos showcasing Vapi out in the wild.
slug: community/knowledgebase
title: Creating Custom Knowledge Bases for Your Voice AI Assistants
subtitle: >-
Learn how to create and integrate custom knowledge bases into your voice AI
assistants.
slug: knowledgebase
---

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

Here are some videos made by people in our community showcasing what Vapi can do:
Our Knowledge Base is a collection of custom documents that contain information on specific topics or domains. By integrating a Knowledge Base into your voice AI assistant, you can enable it to provide more accurate and informative responses to user queries. This is currently available in Vapi via the API, and will be on the dashboard soon.

<div class="video-grid">
<iframe
src="https://www.youtube.com/embed/9MD1VM7038Q?si=G1at__w9gAm0dqEA"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen
/>
<iframe
src="https://www.youtube.com/embed/xCdfLSrwbjc?si=xn1jIHmV4J7VTsTr"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen
/>
<iframe
width="100%"
height="315"
src="https://www.youtube.com/embed/g0SKKwBpp7g?si=b8uXyopKo9fZYowX"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen
/>
### **Why Use a Knowledge Base?**

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

- **Improved accuracy**: By integrating custom documents into your assistant, you can ensure that it provides accurate and up-to-date information to users.
- **Enhanced capabilities**: A Knowledge Base enables your assistant to answer complex queries and provide detailed responses to user inquiries.
- **Customization**: With a Knowledge Base, you can tailor your assistant's responses to specific domains or topics, making it more effective and informative.

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

<iframe
width="100%"
height="315"
src="https://www.youtube.com/embed/4_9IOCiC7hc"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen
To create a Knowledge Base, follow these steps:

### **Step 1: Upload Your Documents**

Navigate to Overview > Documents and upload your custom documents in Markdown, PDF, plain text, or Microsoft Word (.doc and .docx) format to Vapi's Knowledge Base.

<Frame caption="Adding documents to your Knowledge Base">
<img
src="https://cdn.hashnode.com/res/hashnode/image/upload/v1715628063841/rSrWDQ6YM.png"
alt="Adding documents to your Knowledge Base"
/>
</div>

## Send Us Your Video

Have a video showcasing Vapi that you want us to feature? Let us know:

<CardGroup cols={2}>
<Card
title="Send Us Your Video"
icon="video-arrow-up-right"
iconType="solid"
href="https://tally.so/r/3yD9Wx"
>
Send us your video showcasing what Vapi can do, we'd like to feature it.
</Card>
</CardGroup>
</Frame>

Alternatively you can upload your documents via the API.

```bash
curl --location 'https://api.vapi.ai/file' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--form 'file=@"<PATH_TO_YOUR_FILE>"'
```

### **Step 2: Create a Knowledge Base**

Use the ID of the uploaded file to create a Knowledge Base. Currently we support [trieve](https://trieve.ai) as a provider.

```bash
curl --location 'https://api.vapi.ai/knowledge-base' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"name": "knowledge-base-test",
"provider": "trieve",
"searchPlan": {
"scoreThreshold": 0.1,
"searchType": "hybrid"
},
"chunkPlan": {
"fileIds": ["<FILE_ID>"]
}
}'
```

### **Step 3: Create an Assistant**

Create a new assistant in Vapi and, on the right sidebar menu. Add the Knowledge Base to your assistant via the PATCH endpoint. Also make sure you customize your assistant's system prompt to utilize the Knowledge Base for responding to user queries.

```bash
curl --location --request PATCH 'https://api.vapi.ai/assistant/<ASSISTANT_ID>' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"model": {
"knowledgeBaseId": "<KNOWLEDGE_BASE_ID>",
"temperature": 0.2,
"provider": "openai",
"model": "gpt-4o",
"messages": [
{
"content": "You are a smart assistant who responds to user queries using the information you know, or information supplied by outside context.",
"role": "system"
}
]
}
}'
```

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

- **Organize Your documents**: Organize your documents by topic or category to ensure that your assistant can quickly retrieve relevant information.
- **Use Clear and concise language**: Use clear and concise language in your documents to ensure that your assistant can accurately understand and respond to user queries.
- **Keep your documents up-to-date**: Regularly update your documents to ensure that your assistant provides the most accurate and up-to-date information.

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

By following these guidelines, you can create a comprehensive Knowledge Base that enhances the capabilities of your voice AI assistant and provides valuable information to users.
104 changes: 73 additions & 31 deletions fern/customization/knowledgebase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,20 @@ title: Creating Custom Knowledge Bases for Your Voice AI Assistants
subtitle: >-
Learn how to create and integrate custom knowledge bases into your voice AI
assistants.
slug: customization/knowledgebase
slug: knowledgebase
---

<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/i5mvqC5sZxU"
title="Vapi's Knowledge Base"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
></iframe>

## **What is Vapi's Knowledge Base?**
Our Knowledge Base is a collection of custom documents that contain information on specific topics or domains. By integrating a Knowledge Base into your voice AI assistant, you can enable it to provide more accurate and informative responses to user queries.

Our Knowledge Base is a collection of custom documents that contain information on specific topics or domains. By integrating a Knowledge Base into your voice AI assistant, you can enable it to provide more accurate and informative responses to user queries. This is currently available in Vapi via the API, and will be on the dashboard soon.

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

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

* **Improved accuracy**: By integrating custom documents into your assistant, you can ensure that it provides accurate and up-to-date information to users.
* **Enhanced capabilities**: A Knowledge Base enables your assistant to answer complex queries and provide detailed responses to user inquiries.
* **Customization**: With a Knowledge Base, you can tailor your assistant's responses to specific domains or topics, making it more effective and informative.
- **Improved accuracy**: By integrating custom documents into your assistant, you can ensure that it provides accurate and up-to-date information to users.
- **Enhanced capabilities**: A Knowledge Base enables your assistant to answer complex queries and provide detailed responses to user inquiries.
- **Customization**: With a Knowledge Base, you can tailor your assistant's responses to specific domains or topics, making it more effective and informative.

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

Expand All @@ -34,26 +26,76 @@ To create a Knowledge Base, follow these steps:

Navigate to Overview > Documents and upload your custom documents in Markdown, PDF, plain text, or Microsoft Word (.doc and .docx) format to Vapi's Knowledge Base.

<Image src="https://cdn.hashnode.com/res/hashnode/image/upload/v1715628063841/rSrWDQ6YM.png" alt="Adding documents to your Knowledge Base" />

### **Step 2: Create an Assistant**

Create a new assistant in Vapi and, on the right sidebar menu, select the document you've just added to the Knowledge Base feature.
<Image src="https://cdn.hashnode.com/res/hashnode/image/upload/v1715628223370/e18L04yRk-.png" alt="Adding documents to your assistant" />


### **Step 3: Configure Your Assistant**

Customize your assistant's system prompt to utilize the Knowledge Base for responding to user queries.
<Frame caption="Adding documents to your Knowledge Base">
<img
src="https://cdn.hashnode.com/res/hashnode/image/upload/v1715628063841/rSrWDQ6YM.png"
alt="Adding documents to your Knowledge Base"
/>
</Frame>

Alternatively you can upload your documents via the API.

```bash
curl --location 'https://api.vapi.ai/file' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--form 'file=@"<PATH_TO_YOUR_FILE>"'
```

### **Step 2: Create a Knowledge Base**

Use the ID of the uploaded file to create a Knowledge Base. Currently we support [trieve](https://trieve.ai) as a provider.

```bash
curl --location 'https://api.vapi.ai/knowledge-base' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"name": "knowledge-base-test",
"provider": "trieve",
"searchPlan": {
"scoreThreshold": 0.1,
"searchType": "hybrid"
},
"chunkPlan": {
"fileIds": ["<FILE_ID>"]
}
}'
```

### **Step 3: Create an Assistant**

Create a new assistant in Vapi and, on the right sidebar menu. Add the Knowledge Base to your assistant via the PATCH endpoint. Also make sure you customize your assistant's system prompt to utilize the Knowledge Base for responding to user queries.

```bash
curl --location --request PATCH 'https://api.vapi.ai/assistant/<ASSISTANT_ID>' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"model": {
"knowledgeBaseId": "<KNOWLEDGE_BASE_ID>",
"temperature": 0.2,
"provider": "openai",
"model": "gpt-4o",
"messages": [
{
"content": "You are a smart assistant who responds to user queries using the information you know, or information supplied by outside context.",
"role": "system"
}
]
}
}'
```

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

* **Organize Your documents**: Organize your documents by topic or category to ensure that your assistant can quickly retrieve relevant information.
* **Use Clear and concise language**: Use clear and concise language in your documents to ensure that your assistant can accurately understand and respond to user queries.
* **Keep your documents up-to-date**: Regularly update your documents to ensure that your assistant provides the most accurate and up-to-date information.
- **Organize Your documents**: Organize your documents by topic or category to ensure that your assistant can quickly retrieve relevant information.
- **Use Clear and concise language**: Use clear and concise language in your documents to ensure that your assistant can accurately understand and respond to user queries.
- **Keep your documents up-to-date**: Regularly update your documents to ensure that your assistant provides the most accurate and up-to-date information.

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

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

0 comments on commit 2f05480

Please sign in to comment.