Keep Retrieved Text Out of System Instructions
@prranitarora▲ 10 net votes
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.