How to get a GPT to consistently reference the documents in the knowledge base?

I’ve uploaded a few documents to my GPTs knowledge base, and despite instructing it to always reference the documents when answering a question, it does not always give the “searching knowledge base” symbol and starts answering right away.

How can I have it consistently reference the knowledge base first before answering a question?

2 Likes

Had same need, using instructions as “search always in the knowledge” helped me a lot.
Put it on the top of instructions and try.

Regards

1 Like

No luck with that phrase, the GPT still doesn’t reliably say “searching my knowledge”.

What does work is after the first answer to tell it to “Have a look in the knowledge base” - then it does :thinking:

This setup is not ideal however.

From my experience; the more GPT is focused on one particular domain knowledge, the more that “searching my knowledge” phrase works.

Also “This GPT should always search it’s knowledge base before answering” can work better.

A recent update to the model fixed this, and my GPT is pretty great at referencing the knowledge base now. Thanks!

What do you expect the content to be? Was it what you expected? And what did GPT say? In many situations it is not necessary to check the knowledge retrieval every time and it will correctly answer what is in the file.

I was having the same problem. I deleted my “How would you like ChatGPT to respond?” in the “Customize ChatGPT.” I also unchecked Web Browsing in my Custom GPT Configuration, and it started only checking my documents in the knowledge base. Even though I have it in my instructions in my custom GPT, it still will not tell me which document it used unless I ask. Do you have any ideas?

1 Like

Try the following:

  1. Explicitly mention to the model in the instructions it has access to files in its knowledge.

  2. Also in the instructions, list the exact file name that should be accessed:

"When answering about x access file named x.txt"

I’m creating a custom GPT where the purpose is to specifically be a knowledge repository, so I only want it to refer to what is included in the knowledge section, not to extrapolate or pull data from elsewhere. That part of the prompt seems to be working fine.

However, I also want the user to be able to access / download the underlying pdf or word document (they are all publicly available documents) that was uploaded in the knowledge base so they can read further or view the source themselves.

The GPT does generate what looks like a clickable link, but there’s always an error which means I can’t actually download the document.

Is this intentional? Or an error?

55F31214-0CD0-4CB7-BD34-713D8AE95E63_4_5005_c

i had this same issue when creating a budget analysis gpt. so besides telling it to only use the knowledge base i made a rule that it has to cite the specific cell that it referenced for the answer, this worked pretty well but i still had some inconsistencies so i added conversation starters that i would use everytime to ground it further on the specific file i wanted it to reference for a given question. After doing this it works pretty much flawlessly.

Nice! Could you expand on those conversation starters?

There isnt really much to expand on it, its just the ones that you see in the above image. For the budget assistant GPT i have two separate excel files for a knowledge base. So i begin each new chat by clicking on the conversation starter that specifies the knowledge base that i want it to extract data from to answer my questions. So you’ll see above the two starters are… “I have a question about the 2024 budget spreadsheet” and “i have a questions about th 2024 call count spreadsheet”

Hey Jeevika!
Can you please share the prompt that is working for you?
i am trying to achieve the same but its not working for me, it does not search the knowledge file always.

Thanks

FWIW, I have been having this same problem with a GPT I created a few months ago. Nothing worked, so I ended up deleting the GPT and created a new one using the same files and prompt and now it works MUCH better.

I’ve made my Custom GPT, that’s an expert in Expo-managed React Native application development, work really well at responding with the contents of the relevant file in relation to the user’s message, by using the Custom Instructions written below, that reference the names of the attached files. In fact, I’ve found that with the Custom Instructions written below, it can even work correctly for attached files that I don’t reference in the Custom Instructions! Please note: For this GPT I’ve made, there are no attached example files relating to writing a switch statement or a for…in loop in JavaScript, which is why those two cases are good candidates for the last two example responses in which the GPT is shown to be responding with the message of “Couldn’t find relevant example file.”.

Custom Instructions:
This GPT will always respond with the contents of the most relevant attached example file printed out, based on the example responses shown below, except for if you can’t find a relevant attached example file in your knowledge base, in which case, you should respond by saying “Couldn’t find relevant example file.”. VERY IMPORTANT NOTE: If you can’t find a relevant attached example file, you must always respond with “Couldn’t find relevant example file.”.

# Example Responses
User: How do I get an item using `AsyncStorage`?
Response: asyncstorage-getitem.js file:...
---
User: How do I set an item using `AsyncStorage`?
Response: asyncstorage-setitem.js file:...
---
User: How do I create a data context helper function?
Response: createDataContext.js file:...
---
User: How do I use the createDataContext helper function?
Response: use-createDataContext.js file:...
---
User: How do I use `useFocusEffect`?
Response: useFocusEffect.js file:...
---
User: How do I run code when the current screen is focused on?
Response: useFocusEffect.js file:...
---
User: How do I hide just the title of a screen?
Response: screenOptions-headerTitleStyle-display-none.js file:...
---
User: How do I hide the header of a screen?
Response: screenOptions-headerShown-false.js file:...
---
User: How do I disable the animation for a transition from one screen to another in a stack navigator?
Response: screenOptions-animationEnabled-false.js file:...
---
User: How do I use a context's provider?
Response: use-context-provider-1.js file:...
or use-context-provider-2.js file:...
---
User: How do I navigate to a screen, outside of the context of a React component?
Response: navigation-outside-of-a-React-component.js file:...
---
User: How do I write a switch statement?
Response: Couldn't find relevant example file.
---
User: How do I write a for...in loop?
Response: Couldn't find relevant example file.
---
1 Like

I found that if I add the file name in Instructions, it references the file.