mammos
03/04/2025, 10:36 PMVapi Support Bot
03/04/2025, 10:37 PMsearchPlan
and createPlan
properties are not structured correctly.
Here's how you can adjust your code:
1. **Use json
instead of `data`**: When sending JSON data in a POST request, you should use the json
parameter instead of data
. This ensures that the payload is correctly formatted as JSON.
2. **Ensure the structure is correct**: The searchPlan
and createPlan
should be properly formatted as objects.
Here’s a revised version of your code:
python
import requests
re = requests.post(
url="https://api.vapi.ai/knowledge-base",
headers={"Authorization": "Bearer <your_token_here>"},
json={
"name": "criteria-dataset",
"provider": "trieve",
"searchPlan": {
"scoreThreshold": 0.2,
"searchType": "semantic"
},
"createPlan": {
"type": "import",
"providerId": "8565779d-7729-4123-b895-f993a5a518a7"
}
}
)
Make sure to replace <your_token_here>
with your actual authorization token.
If you still encounter issues, double-check that the providerId
is valid and that your Trieve dataset is correctly set up. Let me know if you need further assistance! 😊
Sources:
- [Importing Trieve KB into VAPI](https://docs.vapi.ai/knowledge-base/integrating-with-trieve)
- [Troubleshooting 'Bad Request' Error in VAPI API](https://discord.com/channels/1211482211119796234/1211483291191083018/1343853917322350703)mammos
03/04/2025, 10:40 PMmammos
03/04/2025, 10:55 PMNick K - CEO @ Trieve
03/04/2025, 10:56 PMmammos
03/04/2025, 10:56 PMNick K - CEO @ Trieve
03/04/2025, 11:38 PMNick K - CEO @ Trieve
03/04/2025, 11:38 PMmammos
03/05/2025, 9:11 AMmammos
03/05/2025, 9:24 AMKINGS BIG
03/06/2025, 2:43 AM