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
41 changes: 35 additions & 6 deletions fern/community/knowledgebase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Navigate to Platform > Files and upload your custom files in Markdown, PDF, plai

<Frame caption="Adding files to your Knowledge Base">
<img
src="/static/images/knowledge-base/files.png"
src="./static/images/knowledge-base/files.png"
alt="Adding files to your Knowledge Base"
/>
</Frame>
Expand All @@ -43,18 +43,22 @@ curl --location 'https://api.vapi.ai/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.
Use the ID of the uploaded file to create a Knowledge Base along with the KB configurations.

1. Provider: [trieve](https://trieve.ai)

```bash
curl --location 'http://localhost:3001/knowledge-base' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Bearer 4beb7e10-f4be-4588-be65-712235f07f68' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"name": "v2",
"provider": "trieve",
"searchPlan": {
"scoreThreshold": 0.2,
"searchType": "semantic"
"searchType": "semantic",
"topK": 3,
"removeStopWords": true,
"scoreThreshold": 0.7
},
"createPlan": {
"type": "create",
Expand All @@ -63,13 +67,38 @@ curl --location 'http://localhost:3001/knowledge-base' \
"fileIds": ["<FILE_ID_1>", "<FILE_ID_2>"],
"websites": ["<WEBSITE_1>", "<WEBSITE_2>"],
"targetSplitsPerChunk": 50,
"splitDelimiters": [".!?\n"],
"rebalanceChunks": true
}
]
}
}''
}'
```

#### Configuration Options

##### Search Plan Options

- **searchType** (required): The search method used for finding relevant chunks. Available options:
- `fulltext`: Traditional text search
- `semantic`: Semantic similarity search
- `hybrid`: Combines fulltext and semantic search
- `bm25`: BM25 ranking algorithm
- **topK** (optional): Number of top chunks to return. Default varies by implementation
- **removeStopWords** (optional): When true, removes common stop words from the search query. Default: `false`
- **scoreThreshold** (optional): Filters out chunks based on their similarity score:
- For cosine distance: Excludes chunks below the threshold
- For Manhattan Distance, Euclidean Distance, and Dot Product: Excludes chunks above the threshold
- Set to 0 or omit for no threshold

##### Chunk Plan 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`

### **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.
Expand Down
39 changes: 34 additions & 5 deletions fern/customization/knowledgebase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,22 @@ curl --location 'https://api.vapi.ai/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.
Use the ID of the uploaded file to create a Knowledge Base along with the KB configurations.

1. Provider: [trieve](https://trieve.ai)

```bash
curl --location 'http://localhost:3001/knowledge-base' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Bearer 4beb7e10-f4be-4588-be65-712235f07f68' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"name": "v2",
"provider": "trieve",
"searchPlan": {
"scoreThreshold": 0.2,
"searchType": "semantic"
"searchType": "semantic",
"topK": 3,
"removeStopWords": true,
"scoreThreshold": 0.7
},
"createPlan": {
"type": "create",
Expand All @@ -63,13 +67,38 @@ curl --location 'http://localhost:3001/knowledge-base' \
"fileIds": ["<FILE_ID_1>", "<FILE_ID_2>"],
"websites": ["<WEBSITE_1>", "<WEBSITE_2>"],
"targetSplitsPerChunk": 50,
"splitDelimiters": [".!?\n"],
"rebalanceChunks": true
}
]
}
}''
}'
```

#### Configuration Options

##### Search Plan Options

- **searchType** (required): The search method used for finding relevant chunks. Available options:
- `fulltext`: Traditional text search
- `semantic`: Semantic similarity search
- `hybrid`: Combines fulltext and semantic search
- `bm25`: BM25 ranking algorithm
- **topK** (optional): Number of top chunks to return. Default varies by implementation
- **removeStopWords** (optional): When true, removes common stop words from the search query. Default: `false`
- **scoreThreshold** (optional): Filters out chunks based on their similarity score:
- For cosine distance: Excludes chunks below the threshold
- For Manhattan Distance, Euclidean Distance, and Dot Product: Excludes chunks above the threshold
- Set to 0 or omit for no threshold

##### Chunk Plan 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`

### **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.
Expand Down
39 changes: 34 additions & 5 deletions fern/knowledgebase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,22 @@ curl --location 'https://api.vapi.ai/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.
Use the ID of the uploaded file to create a Knowledge Base along with the KB configurations.

1. Provider: [trieve](https://trieve.ai)

```bash
curl --location 'http://localhost:3001/knowledge-base' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Bearer 4beb7e10-f4be-4588-be65-712235f07f68' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"name": "v2",
"provider": "trieve",
"searchPlan": {
"scoreThreshold": 0.2,
"searchType": "semantic"
"searchType": "semantic",
"topK": 3,
"removeStopWords": true,
"scoreThreshold": 0.7
},
"createPlan": {
"type": "create",
Expand All @@ -63,13 +67,38 @@ curl --location 'http://localhost:3001/knowledge-base' \
"fileIds": ["<FILE_ID_1>", "<FILE_ID_2>"],
"websites": ["<WEBSITE_1>", "<WEBSITE_2>"],
"targetSplitsPerChunk": 50,
"splitDelimiters": [".!?\n"],
"rebalanceChunks": true
}
]
}
}''
}'
```

#### Configuration Options

##### Search Plan Options

- **searchType** (required): The search method used for finding relevant chunks. Available options:
- `fulltext`: Traditional text search
- `semantic`: Semantic similarity search
- `hybrid`: Combines fulltext and semantic search
- `bm25`: BM25 ranking algorithm
- **topK** (optional): Number of top chunks to return. Default varies by implementation
- **removeStopWords** (optional): When true, removes common stop words from the search query. Default: `false`
- **scoreThreshold** (optional): Filters out chunks based on their similarity score:
- For cosine distance: Excludes chunks below the threshold
- For Manhattan Distance, Euclidean Distance, and Dot Product: Excludes chunks above the threshold
- Set to 0 or omit for no threshold

##### Chunk Plan 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`

### **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.
Expand Down
Loading