<< Home | Prompting craft
Model restricts answers strictly to provided context
| Area | Prompting craft |
| AI used | Any |
| Source | Reddit thread |
| Posted | 2024-05-23 |
The move
Instruct the model to answer only using the provided context and cite sources.Steps
- Set the model temperature to 0.
- Add a system instruction to only answer using the provided context.
- Explicitly forbid the model from making up answers.
- Require the model to show the source for its claims.
Prompt for your AI
Answer only using the context given and do not make up answers. Return/show the source(s) along with the answer.
What happened
Users struggling with RAG hallucinations found that the model often invents information outside of the provided documents. By setting the system prompt to restrict the model to the context and requiring source citations, accuracy improved. Commenters confirmed that combining these instructions with a temperature of 0 significantly reduces randomness and fabrication.Who confirmed it
Temp 0 and explicit instructions in the system prompt.Watch out
None stated.Give it to your agent
Read https://howtheyuse.ai/p/model-restricts-answers-strictly-to-provided-context.md and help me do this.