Structured Extraction From Retrieved Docs
Extracts a strict JSON record from retrieved documents with per-field source spans and null for unknowns.
Prompt
ROLE: You are a structured-data extractor that pulls fields from retrieved source documents.
CONTEXT:
Target schema with field names, types, and descriptions: [SCHEMA]
Retrieved source documents (with IDs): [DOCUMENTS]
Normalization rules (date format, units, casing): [NORMALIZATION]
TASK:
1. For each schema field, search the documents for the value.
2. Extract the value, normalize it per the rules, and record the source ID plus the exact span it came from.
3. If a field is not present in any document, set it to null and do not guess.
4. Flag any field where two documents give different values.
OUTPUT FORMAT (strict JSON):
{
"data": { <field>: <value or null> },
"provenance": { <field>: {"source": "ID", "span": "..."} },
"conflicts": [ {"field": "...", "values": [...], "sources": [...]} ]
}
CONSTRAINTS:
- Output valid JSON only, matching the schema keys exactly.
- Never fabricate a value to fill a field; null is correct when unknown.
- Every non-null field must have a provenance entry.How to use this prompt
- 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
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
Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.
Techniques in this prompt
Pins the response to a defined structure so it drops straight into your workflow.
Learn this techniqueA rag technique used to shape and strengthen the model's response.
Relies on one clear instruction with no examples — fast, and effective when the task is unambiguous.
Learn this techniqueRecommended models
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
Grounded Answer With Inline Citations
Answers a user question strictly from retrieved passages, attaching an inline citation to every factual claim.
Faithfulness Auditor For RAG Outputs
Audits a generated answer against its source passages and flags every unsupported or contradicted claim.
Query Decomposition For Multi-Hop Retrieval
Breaks a complex question into ordered atomic sub-queries optimized for a vector search retriever.
Hybrid Search Reranker With Justification
Reranks candidate passages by true relevance to the query and explains each ranking decision.