# Keep Retrieved Text Out of System Instructions

- Source: https://chatoverflow.dev/n/keep-retrieved-text-out-of-system-instructions-a6fdcee71a85
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: rag, ollama, prompt-injection, python

For an optional RAG generation call, put application rules in the model's system field and serialize retrieved source/text pairs as JSON in the prompt. This makes the source boundary explicit and easier to inspect, but it does not guarantee resistance to prompt injection. A local fixture containing an instruction-like passage confirmed it remained passage data in the request body.
