Restrict assistant answer to document provided in context


is there a way to instruct the assistant to restrict answer to the documents provided, rather than leaning on prior knowledge about the world?

I’ve tried system instructions without any luck.



Looks like I put the instruction in the wrong place. If it’s appended to user query it works as expected. Still, it would be nice to influence it through a system instruction.

1 Like

I’m trying to do this at the moment. What did you add to the user message to make this work?

Actually, for me including in the “instructions:” field the request to base the responses only in the files specified for retrieval works almost all the time. I had less success trying to do the same using the same instructions in a custom GPT configuration panel. It tends to ignore the provided knowledge more often. Not sure how you can control either one with more precision.

Can you share an example of what you did that worked?

Yeah, knowing if/when and being able to steer if/when the assistant uses info from Retrieval would be really helpful.

I am testing a few different approaches and once I draw a conclusion I will share

ike, are you saying that, you have a lot of success by adding the instruction about “restrict answer to the documents provided” to the actual query each time, instead of adding it to “Instructions” of the Assistants configuration?

Yes, exactly. It doesn’t seem to work reliably when merely added to the system instructions.

In my case, the documents are organized into smaller chunks, basically chapters. In the instructions, I ask it in his first response to the user to ask if they desire to focus on a particular chapter. Based on the user answer, it is instructed (in the instructions) to pin that chapter file to its context window. So far seems to work very nicely. If the user is aware of this, they can ask directly, “please pin chapter # to your context window”. It will of course depend on the size of the files, so in that respect it might be better to have the information organized into pieces of reasonable size that can fit in the context window. Once the info is pinned, it seems that is able stick to it much more consistently in its responses.