Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 5 additions & 44 deletions fern/knowledge-base/integrating-with-trieve.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,11 @@ slug: knowledge-base/integrating-with-trieve

# Using Trieve with Vapi

Vapi offers two ways to integrate with [Trieve](https://trieve.ai):
Vapi integrates with [Trieve](https://trieve.ai) through the BYOD (Bring Your Own Dataset) approach, allowing you to use your Trieve API key to import your existing Trieve datasets into Vapi.

1. **Direct Integration**: Create and manage Trieve datasets directly through Vapi
2. **BYOK (Bring Your Own Key)**: Use your Trieve API key to import your existing Trieve datasets into Vapi
## Integrating with Trieve

## Direct Integration with Trieve

When using Trieve directly through Vapi, you can create and manage datasets, but they'll be tied to Vapi's account. This approach offers:

- Quick setup with minimal configuration
- Basic dataset management through Vapi's API
- Limited customization options

### Setting up Direct Integration

1. Navigate to the [Vapi dashboard credentials page](https://dashboard.vapi.ai/keys)
2. Add your Trieve API key from [Trieve's dashboard](https://dashboard.trieve.ai/org/keys)
3. Create a new knowledge base with Trieve as the provider:

```json
{
"name": "my-trieve-kb",
"provider": "trieve",
"searchPlan": {
"scoreThreshold": 0.2,
"searchType": "semantic"
},
"createPlan": {
"type": "create",
"chunkPlans": [
{
"fileIds": ["file-123", "file-456"],
"websites": ["https://example.com"],
"targetSplitsPerChunk": 50,
"rebalanceChunks": true
}
]
}
}
```

## BYOK with Trieve (Recommended)

The BYOK approach offers more flexibility and control over your datasets. You can:
The BYOD approach offers flexibility and control over your datasets. You can:

- Fully manage your datasets in Trieve's native interface
- Use Trieve's advanced features like:
Expand Down Expand Up @@ -293,12 +254,12 @@ Use Trieve's search playground to:

1. Create your Trieve API key from [Trieve's dashboard](https://dashboard.trieve.ai/org/keys)
2. Add your Trieve API key to Vapi [Provider Credentials](https://dashboard.vapi.ai/keys)
![Add Trieve API key in Vapi](../static/images/knowledge-base/trieve-credential.png)
![Add Trieve API key in Vapi](../static/images/knowledge-base/trieve-credential.png)
3. Once your dataset is optimized in Trieve, import it to Vapi:

```json
{
"name": "trieve-byok",
"name": "trieve-dataset",
"provider": "trieve",
"searchPlan": {
"scoreThreshold": 0.2,
Expand Down
52 changes: 10 additions & 42 deletions fern/knowledgebase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,18 @@ Using a Knowledge Base with your voice AI assistant offers several benefits:

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

To create a Knowledge Base, follow these steps:
To create a Knowledge Base with Trieve, follow these steps:

### **Step 1: Upload Your Files**
### **Step 1: Create a Knowledge Base with Trieve**

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.

<Frame caption="Adding files to your Knowledge Base">
<img
src="./static/images/knowledge-base/files.png"
alt="Adding files to your Knowledge Base"
/>
</Frame>

Alternatively you can upload your files 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 along with the KB configurations.

1. Provider: [trieve](https://trieve.ai)
Vapi integrates with [Trieve](https://trieve.ai) using the BYOD (Bring Your Own Dataset) approach. First, create and optimize your dataset in Trieve (see our [Integrating with Trieve guide](knowledge-base/integrating-with-trieve) for detailed instructions), then import it to Vapi:

```bash
curl --location 'https://api.vapi.ai/knowledge-base' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"name": "v2",
"name": "trieve-dataset",
"provider": "trieve",
"searchPlan": {
"searchType": "semantic",
Expand All @@ -61,16 +40,8 @@ curl --location 'https://api.vapi.ai/knowledge-base' \
"scoreThreshold": 0.7
},
"createPlan": {
"type": "create",
"chunkPlans": [
{
"fileIds": ["<FILE_ID_1>", "<FILE_ID_2>"],
"websites": ["<WEBSITE_1>", "<WEBSITE_2>"],
"targetSplitsPerChunk": 50,
"splitDelimiters": [".!?\n"],
"rebalanceChunks": true
}
]
"type": "import",
"providerId": "<YOUR_TRIEVE_DATASET_ID>"
}
}'
```
Expand All @@ -91,15 +62,12 @@ curl --location 'https://api.vapi.ai/knowledge-base' \
- For Manhattan Distance, Euclidean Distance, and Dot Product: Excludes chunks above the threshold
- Set to 0 or omit for no threshold

##### Chunk Plan Options
##### Import Options

- **fileIds** (optional): Array of file IDs to include in the vector store
- **websites** (optional): Array of website URLs to crawl and include in the vector store
- **targetSplitsPerChunk** (optional): Number of splits per chunk. Default: `20`
- **splitDelimiters** (optional): Array of delimiters used to split text before chunking. Default: `[".!?\n"]`
- **rebalanceChunks** (optional): When true, evenly distributes remainder splits across chunks. For example, 66 splits with `targetSplitsPerChunk: 20` will create 3 chunks with 22 splits each. Default: `true`
- **providerId** (required): The ID of your Trieve dataset that you want to import
- **type** (required): Must be set to "import" for the BYOD approach

### **Step 3: Create an Assistant**
### **Step 2: 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.

Expand Down
Loading