Agent isn't using knowledge base / files
# support
c
I've been trying to get the agent to tell me information based on the knowledge base PDF I've uploaded and attached to the agent. I've tried calling it multiple times, with different prompts and setups, but the agent keeps making up data instead of pulling from my PDF file, even when explicitly told to use the knowledge base. Org ID: 87b7f212-928b-4f5f-acf9-d2ab17ed8f59 Agent ID: e6dd0cbb-672b-4240-8d5a-d34555163885 Call IDs: 2a4c4171-289b-4a9f-82ee-9282ac6281d7 8ebc7597-e419-474b-8a89-fa27a903466a 937c81d1-411d-4e29-b358-95bf849edff6 You can see in the transcript where I ask the agent to tell me if there are any on-site restaurants (which I specify in the PDF file attached to the agent), but it makes up restaurants that are not in the PDF. Any idea how I can resolve this?
v
Hi there! 👋 I see you're having trouble getting your agent to use your knowledge base PDF file. I'm unable to see the specific content of your PDF or the exact transcripts of your calls, but I can definitely help you troubleshoot why your agent isn't using the knowledge base and provide steps to resolve this issue. Based on the information I found, here are several potential solutions: ### 1. Check Knowledge Base Configuration The most common issue right now is related to a recent migration from Canonical to Trieve as the knowledge base provider. You need to attach the Knowledge Base using the API:
Copy code
json
PATCH /assistant/{assistant_id}
{
  "model": {
    "knowledgeBase": {
      "provider": "trieve",
      "searchPlan": {
        "searchType": "semantic",
        "topK": 3,
        "scoreThreshold": 0.7
      },
      "fileIds": ["your-file-id"]
    }
  }
}
According to the [Vapi documentation](https://docs.vapi.ai/knowledge-base), you should customize your assistant's system prompt to explicitly instruct it to use the Knowledge Base for responding to queries. ### 2. Verify Trieve Integration Make sure you've: - Added the Trieve API key to the Provider Credentials menu in VAPI - Created a Trieve account if needed - Generated an API key from Trieve and pasted it into VAPI ### 3. Check Indexing and Synchronization After uploading files and associating the knowledge base with your assistant, [allow about 5 minutes](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1331706030672969799) for the indexing process to complete before making calls. ### 4. Modify Your System Prompt Explicitly instruct your assistant to: - Use the knowledge base as the primary source of information - Default to "I do not know" if information is not present in the knowledge base - Cite the knowledge base in its responses ### 5. Check File Format and Size Ensure your PDF file: - Is in a supported format - Doesn't exceed the 100MB file size limit
- Has been successfully uploaded and is correctly referenced in your knowledge base configuration ### 6. Use Available Tools There are some helpful resources available: - Video guide for setting up a Knowledge Base: [Loom video](https://www.loom.com/share/9986c175aef146f9b85631414d5e1d67?sid=71983154-6216-477d-b79a-d6e890002a73) - Tool to expedite the Knowledge Base setup process: [Setup tool](https://dub.sh/4GefClE) Would you like me to provide more specific details on any of these troubleshooting steps? Sources: - [Knowledge Base Configuration and Setup](https://docs.vapi.ai/knowledge-base) - [Migration from Canonical to Trieve](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1336582704082325535) - [Troubleshooting Steps](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1336785070408732764) - [Knowledge Base Indexing](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1331706030672969799) - [Explicit Instructions for Knowledge Base Usage](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1335953119275782144)
c
I've added the knowledge base file by uploading it in the "Files" section of the dashboard, then connecting it to my agent in the dropdown under "Files". Does that not work?
s
Hey @crispychips ! To help track down this issue, could you share (segregated call wise): - What response you expected to get - What response you actually got instead This would really help us figure out what went wrong!
c
Sure no problem. The knowledge base file includes a list of restaurants, 2 of which are listed as "on-site". I've attached a screenshot from the file here so you can take a look. In the call logs, you'll notice that the restaurant that the AI says is not anywhere in the file. CALL LOG: 2a4c4171-289b-4a9f-82ee-9282ac6281d7 Expected Output: "Yes, we have two on-site restaurants at the property. One is called Oceans 14, the other is Oceans Ole" or something similar, but with those specific restaurants named, as per the uploaded PDF file. Reponse I Got: "Yes, Ro. We have a lovely on-site at Sand Castle Resort called the Ocean View Grill." (Ocean View Grill is not anywhere in my document) CALL LOG: 8ebc7597-e419-474b-8a89-fa27a903466a Expected Output: "Yes, we have two on-site restaurants at the property. One is called Oceans 14, the other is Oceans Ole" Response I got: "Thank you for your inquiry, Ronak. Do have a lovely restaurant on property called The Sandbar Grill" (Again, the Sandbar Grill is not listed anywhere in the PDF file) CALL LOG: 937c81d1-411d-4e29-b358-95bf849edff6 Expected Output: "Yes, we have two on-site restaurants at the property. One is called Oceans 14, the other is Oceans Ole" Response I got: "Let me check what we have available for you. Mister Patel, I'm so glad you asked. We have a couple of great options for dinner right here at the sand castle. The Seagull's Nest restaurant is our fine dining option with stunning ocean views. It's on the fifth floor." (Seagull's Nest also is not in the document) Hope that helps. Looking forward to hopefully resolving this! And thanks for your support here 🙂 https://cdn.discordapp.com/attachments/1354535734245195948/1355220558802845756/Screenshot_2025-03-28_at_12.37.31_PM.png?ex=67e822ff&is=67e6d17f&hm=6a24b22767ae412c8181f2e4d7707e732a3c1c612f101914d661bae63a9a6dfb&
@Shubham Bajaj
s
Hey crispychips, what's happening is you have listed out defaultQueryTool tool for the KB and associated with your assistant, but because of your model GPT-40 mini, it's not being invoked. So change your model to GPT-4o, try 2-3 test calls, you will observe and see the difference both here and here. Try the model change.
c
@Shubham Bajaj I went ahead and made the changes, and after 3 calls, it looks like it was able to start reading the PDF. Thanks!
Feel free to mark this issue as resolved
s
Marking this ticket as Solved ✅
c
hey @Shubham Bajaj, looks like this problem came back, despite not changing anything in the settings. Org ID: 87b7f212-928b-4f5f-acf9-d2ab17ed8f59 Agent ID: e6dd0cbb-672b-4240-8d5a-d34555163885 CALL ID: 3617bf4b-6980-4e35-a820-27a9d62e629f Expected Output: "Yes, we have two on-site restaurants at the property. One is called Oceans 14, the other is Oceans Ole" Response I Got: "We have a couple of delightful dining options right here at Sandcastle Resort. For a casual and family friendly experience, you might enjoy our beachside grill variety of seafood dishes, burgers, and salads. It's perfect for a relaxed meal with ocean views. If you're in the mood for something a bit more upscale, our ocean view bistro features a menu crafted with locally sourced ingredients, offering a fine dining experience with a focus on regional cuisine. Both restaurants are open daily, so you can choose what suits your family's taste and schedule. Would you like any more details on these options?" (Once again, neither Beachside Grill and Ocean View Bistro are nowhere on in the PDF knowledge base file) Any ideas?
s
This ticket has been marked as solved, and as a result, you will no longer receive any further responses. Kindly create a new support ticket to escalate your inquiry.
3 Views