Removing Message Prefix When Using Knowledge Base
# support
m
When attaching a knowledge base to my Agent, I noticed that Vapi adds the prefix
Here's my final query:
to all user messages. Which confuses the Agent into saying
Please proceed with your final query
. Is there a way to turn this off?
l
I have noticed this too and would also love a solution
@Mohab how did you identify the prefix on the user messages? My assistant is doing the same thing re saying "your final query" back to the caller, but I don't actually see the prefixs in the messages, logs, or transcripts
m
Yeah the prefix is "Here's my final query:" I would like to remove it very much because the Agent keeps referring to the "final query"
I identified it by creating a custom model and intercepting the payload which Vapi sends to the LLM. This video is useful:

https://www.youtube.com/watch?v=-1xWhYmOT0A

l
okay awesome, I've been trying to figure out all the weird things Vapi does to understand what "special stuff" they add to prompts, messages, etc so I can try and account for it, SUPER helpful, thank you!
s
Hey! To help track down this issue, could you share: - The call ID - What response you expected to get - What response you actually got instead This would really help us figure out what went wrong!
s
@LLMUser995 This is not an wierd instead RAG Template whcih is helpful for LLMs to generate better responses.
m
I can't find the call ID, and it is difficult to produce as it just happens non-deterministically. But I believe if you look into the code you'll find that when using a knowledge base, Vapi adds a prefix of
Here is my final query:
to the user's message before sending to the LLM. Which sometimes trick the LLM into saying
Please proceed with your final query
s
Hey @Mohab this is our RAG template we add this to ensure LLM answers to the user question using KB content. It's complete thoughtfull to use this RAG template. As of know there is no alternative to change/toggle this template for KB on demand.