diff --git a/fern/changelog/2024-11-27.mdx b/fern/changelog/2024-11-27.mdx new file mode 100644 index 0000000..05c87e0 --- /dev/null +++ b/fern/changelog/2024-11-27.mdx @@ -0,0 +1,27 @@ +1. **New Knowledge Base API Endpoints**: You can now create a knowledge base with [`POST /knowledge-base`](https://api.vapi.ai/api#/Knowledge%20Base/KnowledgeBaseController_create), list knowledge bases with [`GET /knowledge-base`](https://api.vapi.ai/api#/Knowledge%20Base/KnowledgeBaseController_findAll) or [`GET /knowledge-base/{id}`](https://api.vapi.ai/api#/Knowledge%20Base/KnowledgeBaseController_findOne) for a specific knowledge base, update a knowledge base with [`PATCH /knowledge-base/{id}`](https://api.vapi.ai/api#/Knowledge%20Base/KnowledgeBaseController_update), or delete a knowledge base with [`DELETE /knowledge-base/{id}`](https://api.vapi.ai/api#/Knowledge%20Base/KnowledgeBaseController_remove). Refer to the [Vapi API endpoints](https://api.vapi.ai/api#/) for more details. + + + + + + +2. **Configure Custom Knowledge Bases for your Assistant**: Configure a custom knowledge base for your assistant in three steps by first uploading a file [through the dashboard](https://dashboard.vapi.ai/files) or [the API](https://api.vapi.ai/api#/Files/FileController_create), then [create a knowledge base](https://docs.vapi.ai/knowledgebase#step-2-create-a-knowledge-base), and lastly [updating your assistant](https://docs.vapi.ai/knowledgebase#step-3-create-an-assistant) with the knowledge base id. You can also assign a knowledge base to models like `GroqModel`, `VapiModel`, `GoogleModel`, and others using the new `knowledgeBaseId` property. + + +3. **Integration with Trieve Knowledge Base**: Vapi now supports [Trieve](https://trieve.ai/) as our first knowledge base provider. Refer to [our docs](https://docs.vapi.ai/knowledgebase#step-2-create-a-knowledge-base) for an example of how to use Trieve. + + +4. **Inflection AI Credential Management**: You can now manage Inflection AI credentials through the [updated providers credentials](https://dashboard.vapi.ai/keys) page. `Call.endedReason` also now enumerates new values like `'pipeline-error-inflection-ai-llm-failed'` to indicate specific Inflection AI errors. + + + + + + +5. **New Transfer Mode with Summary in SIP Header**: You can now configure `TransferPlan.mode` to `'blind-transfer-add-summary-to-sip-header'` to forward calls and include a summary in the SIP header called `X-Transfer-Summary`. You can also add custom SIP headers during a transfer call using the `sipHeaders` property in `TransferDestinationSip`. + + +6. **Azure Credential Service Default**: When creating or updating Azure credentials in the [updated providers credentials](https://dashboard.vapi.ai/keys), the `service` field now defaults to `'speech'`. + + +7. **Support for Cantonese in Deepgram Transcriber**: The `DeepgramTranscriber.language` option now includes `'zh-HK'` for Cantonese (Hong Kong). \ No newline at end of file diff --git a/fern/community/knowledgebase.mdx b/fern/community/knowledgebase.mdx index 2431403..adc06aa 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. This is currently available in Vapi via the API, and will be on the dashboard soon. -
- ## **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** @@ -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.", + "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/docs.yml b/fern/docs.yml index 7fecda0..a6e51ef 100644 --- a/fern/docs.yml +++ b/fern/docs.yml @@ -243,6 +243,8 @@ navigation: path: tools-calling.mdx - page: Prompting Guide path: prompting-guide.mdx + - page: Voice Fallback Plan + path: voice-fallback-plan.mdx - page: OpenAI Realtime path: openai-realtime.mdx - section: Glossary diff --git a/fern/knowledgebase.mdx b/fern/knowledgebase.mdx index 891415b..90f6cc4 100644 --- a/fern/knowledgebase.mdx +++ b/fern/knowledgebase.mdx @@ -5,60 +5,97 @@ 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. + +Our Knowledge Base is a collection of custom files 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 files 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** To create a Knowledge Base, follow these steps: -### **Step 1: Upload Your Documents** +### **Step 1: Upload Your Files** -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. +Navigate to Platform > Files and upload your custom files in Markdown, PDF, plain text, or Microsoft Word (.doc and .docx) format to Vapi's Knowledge Base. - -Adding documents to your Knowledge Base + + Adding files 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 files 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.", + "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 files**: Organize your files 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 files to ensure that your assistant can accurately understand and respond to user queries. +- **Keep your files up-to-date**: Regularly update your files 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. diff --git a/fern/static/images/changelog/inflection-ai.png b/fern/static/images/changelog/inflection-ai.png new file mode 100644 index 0000000..4490f6b Binary files /dev/null and b/fern/static/images/changelog/inflection-ai.png differ diff --git a/fern/static/images/changelog/knowledge-base-endpoints.png b/fern/static/images/changelog/knowledge-base-endpoints.png new file mode 100644 index 0000000..fea8449 Binary files /dev/null and b/fern/static/images/changelog/knowledge-base-endpoints.png differ diff --git a/fern/static/images/knowledge-base/files.png b/fern/static/images/knowledge-base/files.png new file mode 100644 index 0000000..669376b Binary files /dev/null and b/fern/static/images/knowledge-base/files.png differ diff --git a/fern/voice-fallback-plan.mdx b/fern/voice-fallback-plan.mdx new file mode 100644 index 0000000..8461983 --- /dev/null +++ b/fern/voice-fallback-plan.mdx @@ -0,0 +1,78 @@ +--- +title: Voice Fallback Plan +subtitle: Configure fallback voices that activate automatically if your primary voice fails. +slug: voice-fallback-plan +--- + + + Voice fallback plans can currently only be configured through the API. We are working on making this available through our dashboard. + + +## Introduction + +By default, if an assistant's primary voice experiences any failure, Vapi will automatically attempt to use other available voices to continue the call. While this ensures call continuity, you might want more control over which specific voices are used as fallbacks. + +Fallback plans give you precise control over the fallback sequence. Your assistant will sequentially fallback to only the voices you configure within your plan, in the exact order you specify. + +## How It Works + +When a voice failure occurs, Vapi will: +1. Detect the failure of the primary voice +2. If a custom fallback plan exists: + - Switch to the first fallback voice in your plan + - Continue through your specified list if subsequent failures occur + - Terminate only if all voices in your plan have failed +3. If no custom fallback plan is configured: + - Automatically switch to other available voices + - Continue attempting different voices + - Terminate only if all available voices have failed + +## Configuration + +Add the `fallbackPlan` property to your assistant's voice configuration, and specify the fallback voices within the `voices` property. +- Please note that fallback voices must be valid JSON configurations, and not strings. +- The order matters. Vapi will choose fallback voices starting from the beginning of the list. + +```json +{ + "voice": { + "provider": "openai", + "voiceId": "shimmer", + "fallbackPlan": { + "voices": [ + { + "provider": "cartesia", + "voiceId": "248be419-c632-4f23-adf1-5324ed7dbf1d" + }, + { + "provider": "playht", + "voiceId": "jennifer" + } + ] + } + } +} +``` + +Although **not recommended**, you may choose to disable the default fallback behavior by providing an empty list of voices in your fallback plan: + +```json +{ + "voice": { + "provider": "openai", + "voiceId": "shimmer", + "fallbackPlan": { + "voices": [] + } + } +} +``` + +## Best practices + +- Use different providers for your fallback voices to protect against provider-wide outages. +- Select voices with **similar characteristics** (tone, accent, gender) to maintain consistency in the user experience. + +## How will pricing work? + +There is no change to the pricing of the voices. Your call will not incur any extra fees while using fallback voices, and you will be able to see the cost for each voice in your end-of-call report. \ No newline at end of file