Skip to content

Commit 6248684

Browse files
committed
updated the query tool docs
1 parent c442256 commit 6248684

File tree

2 files changed

+45
-12
lines changed

2 files changed

+45
-12
lines changed

fern/knowledge-base/migrating-from-trieve.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ Create a query tool using your file IDs:
275275
276276
For detailed instructions, see our [Query Tool documentation](/knowledge-base/using-query-tool).
277277
278+
<Warning>
279+
**Don't forget**: You must update your assistant's system prompt to explicitly name the tool to use. Add instructions like: "When users ask about products or support topics, use the 'knowledge-search' tool to search the knowledge base." Replace 'knowledge-search' with your actual tool function name.
280+
</Warning>
281+
278282
<CodeBlocks>
279283
```bash title="cURL"
280284
curl --location 'https://api.vapi.ai/tool' \
@@ -288,8 +292,8 @@ curl --location 'https://api.vapi.ai/tool' \
288292
"knowledgeBases": [
289293
{
290294
"provider": "google",
291-
"name": "migrated-knowledge-base",
292-
"description": "Migrated knowledge base from Trieve containing product documentation and support information",
295+
"name": "product-support-documentation",
296+
"description": "Contains comprehensive information about our products, services, features, pricing, and technical support documentation. Includes troubleshooting guides and company information.",
293297
"fileIds": [
294298
"FILE_ID_1",
295299
"FILE_ID_2",
@@ -309,8 +313,8 @@ const queryTool = await vapi.tools.create({
309313
knowledgeBases: [
310314
{
311315
provider: "google",
312-
name: "migrated-knowledge-base",
313-
description: "Migrated knowledge base from Trieve containing product documentation and support information",
316+
name: "product-support-documentation",
317+
description: "Contains comprehensive information about our products, services, features, pricing, and technical support documentation. Includes troubleshooting guides and company information.",
314318
fileIds: [
315319
"FILE_ID_1",
316320
"FILE_ID_2",

fern/knowledge-base/using-query-tool.mdx

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Create a query tool that references your knowledge base files:
5353
- **Tool Name**: "Product Query"
5454
- **Knowledge Bases**: Add your knowledge base with:
5555
- **Name**: `product-kb`
56-
- **Description**: "Use this knowledge base when the user asks or queries about the product or services"
56+
- **Description**: "Contains comprehensive product information, service details, and company offerings"
5757
- **File IDs**: Select the files you uploaded in Step 1
5858

5959
#### Option 2: Using the API
@@ -73,7 +73,7 @@ curl --location 'https://api.vapi.ai/tool/' \
7373
{
7474
"provider": "google",
7575
"name": "product-kb",
76-
"description": "Use this knowledge base when the user asks or queries about the product or services",
76+
"description": "Contains comprehensive product information, service details, and company offerings",
7777
"fileIds": [
7878
"41a2bd44-d13c-4914-bbf7-b19807dd2cf4",
7979
"ef82ae15-21b2-47bd-bde4-dea3922c1e49"
@@ -99,7 +99,8 @@ After creating the query tool, you need to attach it to your assistant:
9999
2. Select the assistant you want to configure
100100
3. Go to the **Tools** section
101101
4. Click **Add Tool** and select your query tool from the dropdown
102-
5. Save and publish your assistant
102+
5. **Update the system prompt** to instruct when to use the tool (see examples below)
103+
6. Save and publish your assistant
103104

104105
#### Option 2: Using the API
105106

@@ -125,6 +126,10 @@ curl --location --request PATCH 'https://api.vapi.ai/assistant/ASSISTANT_ID' \
125126
just the toolIds field. This will overwrite any existing model configuration.
126127
</Warning>
127128

129+
<Note>
130+
**Don't forget**: After attaching the tool via API, you must also update your assistant's system prompt (in the `messages` array) to instruct when to use the tool by name. See the system prompt examples below.
131+
</Note>
132+
128133
<Frame caption="Adding a query tool to your assistant">
129134
<img
130135
src="../static/images/knowledge-base/query-tool.png"
@@ -143,31 +148,55 @@ You can configure multiple knowledge bases within a single query tool:
143148
{
144149
"provider": "google",
145150
"name": "product-documentation",
146-
"description": "Use this knowledge base for product specifications and features",
151+
"description": "Contains detailed product specifications, feature descriptions, and technical details",
147152
"fileIds": ["file-id-1", "file-id-2"]
148153
},
149154
{
150155
"provider": "google",
151156
"name": "troubleshooting-guide",
152-
"description": "Use this knowledge base for troubleshooting and support questions",
157+
"description": "Contains troubleshooting guides, support procedures, and problem resolution steps",
153158
"fileIds": ["file-id-3", "file-id-4"]
154159
}
155160
]
156161
```
157162

158163
### **Knowledge Base Description**
159164

160-
The description field helps your assistant understand when to use a particular knowledge base. Make it specific and clear:
165+
The description field should explain what content the knowledge base contains:
161166

162167
```json
163-
"description": "Use this knowledge base when the user asks about pricing, subscription plans, or billing information"
168+
"description": "Contains pricing information, subscription plans, and billing documentation"
164169
```
165170

171+
### **Assistant System Prompt Integration**
172+
173+
<Warning>
174+
**Important**: You must explicitly instruct your assistant in its system prompt about when to use the query tool. The knowledge base description alone is not sufficient for the assistant to know when to search.
175+
</Warning>
176+
177+
Add clear instructions to your assistant's system messages, **explicitly naming the tool**:
178+
179+
```json
180+
{
181+
"role": "system",
182+
"content": "You are a helpful customer support assistant. When users ask about products, pricing, features, or need troubleshooting help, use the 'knowledge-search' tool to search our knowledge base for accurate information. Always call the knowledge-search tool before providing answers to ensure accuracy."
183+
}
184+
```
185+
186+
<Note>
187+
**Be specific**: Replace `'knowledge-search'` with your actual tool's function name from the query tool configuration.
188+
</Note>
189+
190+
**Example system prompt instructions with specific tool names:**
191+
- **Product Support**: "When users ask about product features, specifications, or troubleshooting, use the 'product-support-search' tool to find relevant information."
192+
- **Billing Questions**: "For any questions about pricing, billing, or subscription plans, use the 'billing-query' tool to find the most current information."
193+
- **Technical Documentation**: "When users need API documentation, code examples, or integration help, use the 'api-docs-search' tool to search the technical knowledge base."
194+
166195
## **Best Practices for Query Tool Configuration**
167196

168197
- **Organize by topic**: Create separate knowledge bases for distinct topics to improve retrieval accuracy.
169198
- **Use descriptive names**: Name your knowledge bases clearly to help your assistant understand their purpose.
170-
- **Keep descriptions specific**: Write clear descriptions that tell the assistant exactly when to use each knowledge base.
199+
- **Include system prompt instructions**: Always add explicit instructions to your assistant's system prompt about when to use the query tool.
171200
- **Update regularly**: Refresh your knowledge bases as information changes to ensure accuracy.
172201
- **Test thoroughly**: After configuration, test your assistant with various queries to ensure it retrieves information correctly.
173202

0 commit comments

Comments
 (0)