From 99a6b9b2b86436f1c64a0775764757cadc2d883d Mon Sep 17 00:00:00 2001 From: rumbleFTW <007rajdeepghosh@gmail.com> Date: Tue, 26 Nov 2024 19:03:36 +0530 Subject: [PATCH] docs: new knowledgebase --- fern/community/knowledgebase.mdx | 150 +++++++++++++++++---------- fern/customization/knowledgebase.mdx | 102 ++++++++++++------ fern/knowledgebase.mdx | 101 ++++++++++++------ 3 files changed, 235 insertions(+), 118 deletions(-) diff --git a/fern/community/knowledgebase.mdx b/fern/community/knowledgebase.mdx index 2431403..4b9090e 100644 --- a/fern/community/knowledgebase.mdx +++ b/fern/community/knowledgebase.mdx @@ -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. -
- ## **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. ### **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** @@ -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. -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. -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. + + Adding documents to your Knowledge Base + + +Alternatively you can upload your documents via the API. + +```bash +curl --location 'https://api.vapi.ai/file' \ +--header 'Authorization: Bearer ' \ +--form '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 ' \ +--data '{ + "name": "knowledge-base-test", + "provider": "trieve", + "searchPlan": { + "scoreThreshold": 0.1, + "searchType": "hybrid" + }, + "chunkPlan": { + "fileIds": [""] + } +}' +``` + +### **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/' \ +--header 'Content-Type: text/plain' \ +--header 'Authorization: Bearer ' \ +--data '{ + "model": { + "knowledgeBaseId": "", + "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.", # System prompt that defines the assistant's behavior and capabilities + "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. + - 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). 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. diff --git a/fern/knowledgebase.mdx b/fern/knowledgebase.mdx index 891415b..4b9090e 100644 --- a/fern/knowledgebase.mdx +++ b/fern/knowledgebase.mdx @@ -5,26 +5,18 @@ subtitle: >- assistants. slug: knowledgebase --- - - ## **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. ### **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** @@ -35,30 +27,75 @@ 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. -Adding documents to your Knowledge Base + 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. - - -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. +Alternatively you can upload your documents via the API. + +```bash +curl --location 'https://api.vapi.ai/file' \ +--header 'Authorization: Bearer ' \ +--form '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 ' \ +--data '{ + "name": "knowledge-base-test", + "provider": "trieve", + "searchPlan": { + "scoreThreshold": 0.1, + "searchType": "hybrid" + }, + "chunkPlan": { + "fileIds": [""] + } +}' +``` + +### **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/' \ +--header 'Content-Type: text/plain' \ +--header 'Authorization: Bearer ' \ +--data '{ + "model": { + "knowledgeBaseId": "", + "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.", # System prompt that defines the assistant's behavior and capabilities + "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. + - 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). -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. \ No newline at end of file +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.