Ch Adeel
03/29/2025, 12:41 AMVapi Support Bot
03/29/2025, 12:42 AMVapi Support Bot
03/29/2025, 12:42 AMhttps://api.vapi.ai/knowledge-base
with the following JSON body:
json
{
"provider": "trieve",
"createPlan": {
"type": "create",
"chunkPlans": [
{
"fileIds": [],
"websites": ["your_website_url_here"]
}
]
}
}
Make sure to include these headers:
- Authorization: Bearer <your_token>
- Content-Type: application/json
Replace "your_website_url_here"
with the actual URL of the website you want to use as a knowledge base. You can include multiple URLs in the websites
array if needed.
## Updating Your Agent with the Knowledge Base
After creating the knowledge base, you'll receive a Knowledge Base ID. You'll then need to update your agent with this ID using a PATCH request to https://api.vapi.ai/assistant/ID
(where ID is your assistant's ID):
json
{
"model": {
"provider": "anthropic", // or "openai" depending on your model
"model": "claude-3-5-sonnet-20241022", // or your preferred model
"knowledgeBaseId": "your_knowledge_base_id"
}
}
Replace "your_knowledge_base_id"
with the actual Knowledge Base ID you received from the previous step.
## Additional Tips
- The effectiveness of using website URLs can vary depending on the website's complexity and format. Text-based websites with clear headings generally perform better.Ch Adeel
03/29/2025, 2:12 PMKyle
03/30/2025, 9:33 AMjson
1. **Create a Knowledge Base via API**:
```bash
curl -X POST https://api.vapi.ai/knowledge-base \
-H "Authorization: Bearer <your-api-key>" \
-H "Content-Type: application/json" \
-d '{
"provider": "trieve",
"name": "My Website Knowledge Base",
"vectorStoreSearchPlan": {
"searchType": "semantic",
"topK": 3,
"removeStopWords": true
},
"vectorStoreCreatePlan": {
"type": "create",
"chunkPlans": [
{
"websites": ["https://www.example.com", "https://docs.example.com"]
}
]
}
}'
2. **Link the Knowledge Base to an Assistant**:
- Update your assistant configuration to include the knowledge base ID
- Configure the assistant to use the knowledge base for relevant queries
```