RAG chatbot

Hi Everyone,

I have created a RAG for the HR policy document so that the chatbot can answer any user queries related to our company’s HR policy. However, when I ask a question about the policy, the chatbot searches general information on the web instead of retrieving answers from my vector database, unless I specifically the company name.

please assist how to force the AI to read only from my document

Hey @SHU_SHU hope all is good. Welcome to the community.

The way to make your agent to always retrieve is to instruct it to do so directly. You can use constructs like:

  • “never search for information online”
  • “never use sources other than”
  • “always perform search on the provided knowledge base”
  • 'only use provided knowledge base to find answers"
  • etc

This is how you make them do things - by instructing in the prompt.

3 Likes

Can you share you current system prompt so we can help you enhance it

Thanks, for you reply, since i am starting the journey in the AI agent ,please assist me where shout i add those instruction

Thank, Wouter, below is the system prompt

Question: {{$json[“message”]}}

CONTEXT (from HR Policy DB):
{{$json[“retrievedDocs”]}}

Oh ok no this is not enough to get accurate information. Can you share your workflow in a code block. There is a few ways to implement this so just want to see what you have currently so we can improve it for you

Hi Jabbso,

Would you get a chance to look into my query ?

If you expand the query with what’s inside the variables… maybe :slight_smile:
just showing us your variable names doesn’t provide enough context

Hi Wouter

this is the system massage

never search for information online
never use sources other than
always perform search on the provided knowledge base in the vector store
only use provided knowledge base to find answers

Please share your entire workflow. In n8n select all nodes and copy, then paste it here by clicking the code button

image

Hi Wouter

this the code used in the system massage

Question: {{$json[“message”]}}

CONTEXT (from HR Policy DB):
{{ $json[“retrievedDocs”] && $json[“retrievedDocs”].length > 0 ? $json[“retrievedDocs”] : “I didn’t find” }}

Hey @SHU_SHU please share your entire workflow with us.