Assistant not using knowledgebase
# support
s
Previously, when it was the files that were showing up on the dashboard, I was able to create assistants that actually use those files. Now that its switched to knowledge bases, it doesnt seem like the assistant is taking the knowledgebase into account. My assistant id is 0b6821d2-c5f8-4d81-8227-fd0262081db1. The api seems to have the correct knowledgebase in it but its still not utilizing the information present in the files when the call starts. How do i fix this?
v
It sounds like you're having some trouble with your assistant not utilizing the knowledge base after the switch from files. Here are some steps you can take to troubleshoot and hopefully resolve the issue: 1. **Check Knowledge Base Configuration**: Ensure that the knowledge base is correctly linked to your assistant. You can verify this by checking the Knowledge Base ID associated with your assistant. Make sure there are no typos or errors in the ID. 2. **Review API Calls**: Double-check the API calls you're making to ensure they are correctly formatted and include all necessary parameters. Sometimes, misconfigured API calls can lead to issues. 3. **Verify File IDs**: Make sure that the
fileIds
in your knowledge base configuration are correctly referencing the actual files you want the assistant to use. If the IDs are incorrect, the assistant won't be able to access the information. 4. **Permissions Check**: Ensure that your assistant has the necessary permissions to access the knowledge base. There might be restrictions preventing it from retrieving the information. 5. **Logging and Error Review**: Look at the logs for any errors or indications of what might be going wrong during the information retrieval process. 6. **Synchronization Delays**: After making changes, it may take some time for the settings to propagate. If you've recently made changes, give it a little time and then test again. 7. **API Key Validation**: Ensure that your API key is valid and has the appropriate permissions for accessing the knowledge base. If you've gone through these steps and are still having issues, it might be worth reaching out to VAPI support for more in-depth assistance. Let me know if you need any more help! 😊 Sources: - [Knowledge Base Configuration and API Guidance](https://discord.com/channels/1211482211119796234/1211483291191083018/1336051824402239579)
- [Common Issues Preventing Access to the Knowledge Base in VAPI](https://discord.com/channels/1211482211119796234/1211483291191083018/1336051824402239579) - [Troubleshooting Assistance from Discord Conversations and Logs](https://discord.com/channels/1211482211119796234/1211483291191083018/1334114042876264518)
s
verified the following. The assistant has the correct knowledge base id and the knowledge base has the correct files present. But the files arent being actually used in the conversation.
l
@Shraddha can you do a GET to the knowledge base via Vapi API and show me what is returned? Specifically what (if anything) is in the "searchPlan" section
s
Copy code
{
  "id": "b1aa3484-cfb8-480f-a919-1b73905ebb5a",
  "orgId": "8706fbfe-bbeb-445f-b2dc-960ea7a13cbe",
  "name": "KB_0b6821d2-c5f8-4d81-8227-fd0262081db1_1740949942418",
  "provider": "trieve",
  "createdAt": "2025-03-02T21:12:28.168Z",
  "updatedAt": "2025-03-02T21:12:28.168Z",
  "searchPlan": {
    "topK": 3,
    "searchType": "semantic",
    "scoreThreshold": 0.7,
    "removeStopWords": true
  },
  "createPlan": {
    "type": "create",
    "chunkPlans": [
      {
        "fileIds": [
          "9cec82d8-f19e-41f0-9d5f-61b7238d21c9",
          "4a8b1acf-b1f3-4c11-9307-547b84fb843a"
        ],
        "websites": [],
        "rebalanceChunks": true,
        "splitDelimiters": [
          ".!?\n"
        ],
        "targetSplitsPerChunk": 50
      }
    ],
    "providerId": "6c598893-110f-4ca9-8cca-01a8656e761c"
  }
}
Guessing that the searchPlan parameters are off. Can I set it using the uI? What do you recommend setting these values to?
l
I don't think you can set it through the UI, do you use your own Trieve API Key or just through Vapi?
If the query to the knowledge base doesn't return any results above your "score threshold" then it will seem like the assistant is not using the knowledge base
I would change it to "searchType": "hybrid" and a "scoreThreshold" : 0 From Trieve: "Hybrid combines fulltext and semantic results into one large set and then uses a separate model called a re-ranker to order them. It gives you precision of keyword search with the natural language awareness of semantic in one query." However when you use hybrid the "scores" are like "0.00001" so you need to set to 0, but it works really well. IF you want to keep using "semantic" I would at least change the threshold to 0.1
But setting the threshold to 0 and testing again will at least let you be able to tell if that's the problem or not
s
Thanks! This is helpful
k
Hey! To help track down this issue, could you share: - The call ID This would really help us figure out what went wrong!
s
dd84bfbf-746f-418a-8cc0-b5a1738bb209 This is a recent one. Its still not taking the files into account during the conversation.Can you please check why?
This is the assistant id c9f2b822-76d2-4b2b-bd61-bb7b95a21929
My assistant e5d3e7f5-cb59-443a-a8c2-3e7aa958642a has both a knowledgebaseid 57982102-2ceb-4034-9f8b-b3c260b0f4e5 and fileids and the two doesnt correspond to each other. The knowledgebaseid has 2 different fileids under it than what is under the assistant.
k
Apologies for the delay in response. What's happening is KB is returning zero chunks, and eventually KB content is not used for returning the responses. Now I see your two knowledge base but it will be good to use either of them.
Copy code
"knowledgeBase": {
    "fileIds": [
      "2d0e74f1-43f3-4a12-a15b-3863c25eeefa",
      "db2bd439-16f4-4070-9e46-fb4d6dc73c91"
    ],
    "provider": "google"
  },
  "knowledgeBaseId": "57982102-2ceb-4034-9f8b-b3c260b0f4e5",
Now looking at the knowledge base ID, I don't see enough chunks got created which means queries couldn't meet the criteria of score threshold 0.7. I suggest creating the Trieve KB again with default create and search plan and then it will work. https://cdn.discordapp.com/attachments/1345877354588667956/1347708162127564811/Screenshot_2025-03-08_at_4.39.58_AM.png?ex=67ccce89&is=67cb7d09&hm=dab277c368ec1aec5ea21b08ab4eb9bc6730ec687bb031f2f1e0311dd5f7844a&