From c0f44457e93b9dd6bf67e9c526f25b8290d96eb3 Mon Sep 17 00:00:00 2001
From: rumbleFTW <007rajdeepghosh@gmail.com>
Date: Wed, 29 Jan 2025 23:28:45 +0530
Subject: [PATCH] More docs on Trieve configs
---
fern/community/knowledgebase.mdx | 41 ++++++++++++++++++++++++----
fern/customization/knowledgebase.mdx | 39 ++++++++++++++++++++++----
fern/knowledgebase.mdx | 39 ++++++++++++++++++++++----
3 files changed, 103 insertions(+), 16 deletions(-)
diff --git a/fern/community/knowledgebase.mdx b/fern/community/knowledgebase.mdx
index 9dbb855fa..d1b931113 100644
--- a/fern/community/knowledgebase.mdx
+++ b/fern/community/knowledgebase.mdx
@@ -28,7 +28,7 @@ Navigate to Platform > Files and upload your custom files in Markdown, PDF, plai
@@ -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 ' \
--data '{
"name": "v2",
"provider": "trieve",
"searchPlan": {
- "scoreThreshold": 0.2,
- "searchType": "semantic"
+ "searchType": "semantic",
+ "topK": 3,
+ "removeStopWords": true,
+ "scoreThreshold": 0.7
},
"createPlan": {
"type": "create",
@@ -63,13 +67,38 @@ curl --location 'http://localhost:3001/knowledge-base' \
"fileIds": ["", ""],
"websites": ["", ""],
"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.
diff --git a/fern/customization/knowledgebase.mdx b/fern/customization/knowledgebase.mdx
index dc8d2a4fb..d1b931113 100644
--- a/fern/customization/knowledgebase.mdx
+++ b/fern/customization/knowledgebase.mdx
@@ -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 ' \
--data '{
"name": "v2",
"provider": "trieve",
"searchPlan": {
- "scoreThreshold": 0.2,
- "searchType": "semantic"
+ "searchType": "semantic",
+ "topK": 3,
+ "removeStopWords": true,
+ "scoreThreshold": 0.7
},
"createPlan": {
"type": "create",
@@ -63,13 +67,38 @@ curl --location 'http://localhost:3001/knowledge-base' \
"fileIds": ["", ""],
"websites": ["", ""],
"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.
diff --git a/fern/knowledgebase.mdx b/fern/knowledgebase.mdx
index dc8d2a4fb..d1b931113 100644
--- a/fern/knowledgebase.mdx
+++ b/fern/knowledgebase.mdx
@@ -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 ' \
--data '{
"name": "v2",
"provider": "trieve",
"searchPlan": {
- "scoreThreshold": 0.2,
- "searchType": "semantic"
+ "searchType": "semantic",
+ "topK": 3,
+ "removeStopWords": true,
+ "scoreThreshold": 0.7
},
"createPlan": {
"type": "create",
@@ -63,13 +67,38 @@ curl --location 'http://localhost:3001/knowledge-base' \
"fileIds": ["", ""],
"websites": ["", ""],
"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.