AI model answering questions outside of the context provided in the System Prompt (RAG process) #439
iAMSagar44
started this conversation in
General
Replies: 1 comment 2 replies
-
Hello @iAMSagar44,
What I suggest is to create a new prompt template for returning an empty Message when "similarDocuments.isEmpty()" something like: No documents found template: Update your code:
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am building an app using the RAG process. I have loaded some private documents and I am able to have a conversation with the AI model (I am using Open AI) about the data in the private documents and I am receiving satisfactory responses. The right data is being retrieved from the Vector database based on my query prompts (User Message).
But, when I ask a question which is completely outside the context of the documents loaded in the Vector database, then I am still receiving a response; in-spite of no documents being retrieved from the Vector database.
For e.g., when I ask a question like 'How many planets are there in our Solar System', I still get an answer from the AI model even if 0 documents (from the vector database) is passed into it as a System prompt. Any reason why this is happening?
Is there a way I can prevent the AI model from answering questions outside of the documents context?
This is my code for the Vector similarity search
This is my System Prompt
These are the logs when I ask a question outside of the context of the documents provided
Beta Was this translation helpful? Give feedback.
All reactions