update knowledge base using serverSDK
# support
m
Hey guys! @Vapi @Shubham Bajaj I'm trying to update the files linked to a KB. I sent this request from the playground: // Update Knowledge Base (PATCH /knowledge-base/:id) const response = await fetch("https://api.vapi.ai/knowledge-base/50970299-8d32-405e-8bca-ba39c411c78e", { method: "PATCH", headers: { "Authorization": "Bearer 7d5636a4-00d....b54c6c6", "Content-Type": "application/json" }, body: JSON.stringify({ "provider": "trieve", "createPlan": { "type": "create", "chunkPlans": [ { "fileIds": [ "b7d07008-ea4d-465a-99ab-32bf905a643e" ], "websites": [] } ] }, "name": "MisterAI KB" }), }); const body = await response.json(); console.log(body); However it said: { "message": [ "property provider should not exist" ], "error": "Bad Request", "statusCode": 400 } It seems like I was able to send the request successfully to update the file IDs when NOT using the playground (since the playground doesn't allow us to get rid of the "provider" parameter. ) Also, how come I can use the Trieve knowledge base without having signed up for Trieve?
c
You are not sending the request properly, you will need to modify the model propertly completely then it will work.
m
Not sure what you mean? When I get rid of the "provider":"trieve" parameter in the PATCH call and then check the KB again, it shows it updated the fileID properly. I was just pointing the fact that the playground shows me an error because it forces us to pass the provider parameter. Are you saying the file isn't actually updated because Trieve didn't get the update?
Also, how come I can use the Trieve knowledge base without having signed up for Trieve?
@Shubham Bajaj @Sahil Do I actually need a Trieve API key in my account? It was working yesterday but today no matter what I do it's not pulling the file from my Trieve KB. I don't get an error when updating the KB either and the Assistant shows it's connected to the KB.
Actually I've tried with my own API key, setting up the KB on trieve, importing it and attaching to my assistant in the dashboard and It's still not pulling from the kb: here's a log, any idea why? 2b82bfb5-39af-4643-8d44-901b70a4012f
c
Hey, it would be easier if you use it via this Also, just make sure to remove the previous KB settings.
m
@Sahil ok, I can do that in the immediate but when I check my assistant with the server SDK it shows me that it's linked to my kb, when I check the kb it shows it contains the proper fileID, yet when I test my bot it doesn't pull any KB. Are you suggesting that the KB POST/PATCH calls don't work anymore, even when importing or creating with trieve? It was working 2 days ago... When will that be fixed? I'm building a platform which needs to allow people to upload files to their kb...
@Sahil @Shubham Bajaj I submitted the form above with all the right info, the KB shows properly as part of my assistant, there's a file in it, everything is setup properly. Yet everytime I call it's not pulling any information. Here's a call ID: 2ff45848-c532-4eb6-80ec-2ce9075992a0 Even with a pretty clear prompt it's not working. Can you help tell me what's wrong?
s
@Mistermanu#000 can you try another call with search-threshold set to 0.5-0.7? Do let us know how it goes?
next
Copy code
json
    "search_plan": {
      "searchType": "hybrid",
      "scoreThreshold": 0.7
    },
current
Copy code
json
    "search_plan": {
      "searchType": "hybrid",
      "scoreThreshold": 0.2
    },
m
@Shubham Bajaj I'll try again but I did one call a few minutes ago and saw the KB showing up again! Nothing changed on my end...I'll keep you posted to confirm
@Shubham Bajaj Yes still no luck, I've set the score to 0.7 too and no change. Here's the call ID: 51ecb395-a9ce-4ea7-b16a-a8a4671a58c0 I didn't see the kb getting pulled. This one worked a few hours ago when the score was still at 0.2, not sure the difference. 9fc7a2db-0c88-4fc8-9cf0-b08b216a5971
c
Hey MisterManu#000, putting your ticket in investigation to identify possible cause of inconsistentency.
m
@Shubham Bajaj any updates on this one? It seems like a generalized issue no? I see lots of people claiming their kb is setup properly but the A.I is not fetching...
g
same problem here...kb is setup properly but the A.I is not fetching...
m
@Shubham Bajaj @Sahil I know you guys are working on the new dashboard but there was a solution provided which was to use Trieve and somehow it doesn't seem to be working for a bunch of people. Is this gonna be fixed this week? next month? I was planning to go live with a customer this week but without a working KB it's a bit more limiting...
g
@Shubham Bajaj @Mistermanu#000 I want to update that i tried the BYOK with Trieve implementation and it is now working correctly
m
@Shubham Bajaj so after looking at Trieve's logs I actually see the knowledge base being requested but trieve just not finding anything. I think the issue is because it's not understanding me properly (maybe because I have an accent when I speak). For example I asked "Im looking for rental assistance" and the AI responded by asking in what city, I responded "I'm in Pasadena" and here's the query I see in Trieve: query: "Hi. And do you have any organization that could help with rent?. I mean, uh, Pasadena." remove_stop_words: true score_threshold: 0.4 search_type: "hybrid" Do you know how to improve the query that gets sent to Trieve? Here's the call log if you need: 4ee4308b-923b-4e1b-a7f5-0494890d1355
I lowered the score threshold to 0.02 and it's still not pulling results when the score I had was 0.03, here's what Trieve shows: Request Parameters get_total_pages: true highlight_options: {"highlight_delimiters":["?",".","!"],"highlight_max_length":8,"highlight_max_num":3,"highlight_results":true,"highlight_strategy":"exactmatch","highlight_threshold":0.8,"highlight_window":0,"post_tag":"","pre_tag":""} page: 1 page_size: 10 query: "Hi. And do you have any organization that could help with rent?. I mean, uh, Pasadena." scoring_options: {"fulltext_boost":null,"semantic_boost":null} search_type: "hybrid" sort_options: {"location_bias":null,"mmr":null,"recency_bias":null,"sort_by":null,"tag_weights":null,"use_weights":null} typo_options: {"correct_typos":false,"disable_on_word":[],"one_typo_word_range":{"max":null,"min":4},"prioritize_domain_specifc_words":true,"two_typo_word_range":{"max":null,"min":6}}
It seems that it's not pulling from the KB again anymore because I updated my prompt through the dashboard and I saw the DELETE request show up. I think my assistant is back to supabase or whatever you said during OH...
c
Hey as said during the office hours the DB has nothing to with the assistant and KB the words came out were reaction to my action where i forgot the db has been migrated.
Let me check with Trieve team on this.
m
@Shubham Bajaj oh ok. Well the point is that you changed something to my assistant during OH then it started retreiving from the KB, after that i updated my prompt in the dashboard and it stopped retreiving from Trieve.
s
@Mistermanu#000 I didn't made any change to your assistant, i suggested to tweak the search plan threshold.
m
oh. ok well it's just weird then! I had it down to Hybrid search with 0.02 score and it didn't pull show the result that was scored 0.03. Then I changed the search type to semantic and changed the score to 0.4 using your api and it stopped pulling any search from Trieve. But like I said i think it stopped pulling from Trieve after I updated the prompt in the dashboard. It's still not pulling from it now...
s
@Mistermanu#000 checking if this is resolved after office hours.
m
@Shubham Bajaj It worked when I used a new dataset in trieve. But after like 20 or 30min it stopped working and I didn't see any logs in Trieve from the AI. I'm not sure what happened, during those 30min I updated my prompt, tried different models (it seemed like Anthropic was not working with the KB but Gemini was), then changed the score and search type for the kb and then after that I didn't see any logs in Trieve. I've been trying to look for support but I don't see any options in Trieve...Do you have any support contact or do we just go through you?
It's fixed now, for the record, the issue was not passing the dataset_id everytime I make a PATCH update to the KB...
c
marked this ticket as solved. Resolved the issue with Mistermanu#000 over the DM. It turns out he’s not sending the dataset ID.
3 Views