RAG & Knowledge Retrieval5.0 · 0 ratings

RAG Test-Set Generator From Documents

Generates a graded evaluation set of question-answer-source triples for testing a retrieval pipeline.

Structured-OutputFew-ShotStep-by-Step

Prompt

ROLE: You are an evaluation engineer building a ground-truth test set for a RAG system.

CONTEXT:
Source documents with IDs: [DOCUMENTS]
Difficulty mix wanted (easy/medium/hard): [DIFFICULTY_MIX]
Number of items to generate: [N]

TASK:
1. From the documents, generate diverse QA pairs whose answers are fully supported by the text.
2. Include a mix of types: single-passage factual, multi-hop (requires combining two passages), and negative cases (questions the corpus cannot answer, expecting a refusal).
3. For each answerable item, record the gold source ID(s) and the exact supporting span.
4. Label each item with difficulty and the reasoning type required.

OUTPUT FORMAT (JSON array):
[{"question": "...", "expected_answer": "...", "gold_source_ids": [...], "supporting_span": "...", "type": "single|multi-hop|negative", "difficulty": "easy|medium|hard"}]

CONSTRAINTS:
- Every answerable item's answer must be verifiable from the cited span; no invented facts.
- Negative-case questions must be realistic and clearly unanswerable from the corpus.
- Avoid trivially keyword-matchable questions for the hard tier; require paraphrase or synthesis.

How to use this prompt

  1. 1

    Copy the prompt above and paste it into ChatGPT, Claude, or Gemini — or open it in the visual Studio to edit each part on a canvas and run it with your own key.

  2. 2

    Replace any bracketed placeholders with your specifics. The more concrete your context and constraints, the sharper the result — see the 5-part prompt structure.

  3. 3

    Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.

Techniques in this prompt

Structured Output

Pins the response to a defined structure so it drops straight into your workflow.

Learn this technique
Few-Shot

Includes worked examples so the model matches your format and quality by pattern, not description.

Learn this technique
Step-by-Step

Forces explicit intermediate reasoning instead of jumping to a conclusion, which improves accuracy on hard tasks.

Learn this technique

Recommended models

claudegpt-4ogemini

Build on this prompt

Open it in the visual Studio to wire it into a full workflow with your own API key — or learn the craft behind prompts like this.

More in RAG & Knowledge Retrieval