GPT-4o
⚙️ Technical
Intermediate
Structured Data Extraction Prompt
Extract consistently structured data from unstructured text using prompt techniques that specify schema, handle missing values, and validate output format.
The Prompt
# Structured Data Extraction Prompt You are a data engineering specialist. Design a prompt that extracts structured data from [SOURCE TEXT TYPE] — emails, articles, contracts, transcripts, or web pages. ## Schema Definition Define the extraction schema: - Field name, data type, and description for each field to extract - Which fields are required vs. optional - Accepted value formats (date format, currency format, enum values) - Default or null behavior when a field is not present in the source ## Extraction Prompt Template Write the extraction prompt for [SOURCE TEXT TYPE] that: - Presents the schema clearly before the source text - Instructs the AI to output valid JSON matching the schema - Handles multiple records in a single source (return an array) - Includes instructions for ambiguous or missing values ## Validation Instructions Add a validation step to the prompt where the AI checks its own output before returning: - All required fields are present - Data types match the schema - No values are fabricated if not found in the source text ## Test Case Provide a sample [SOURCE TEXT TYPE] and show the exact JSON output the prompt should produce.
📝 Fill in the blanks
Replace these placeholders with your own content:
[SOURCE TEXT TYPE]
How to use this prompt
1
Copy the prompt
Click "Copy Prompt" above to copy the full prompt text to your clipboard.
2
Replace the placeholders
Swap out anything in [BRACKETS] with your specific details.
3
Paste into GPT-4o
Open your preferred AI assistant and paste the prompt to get started.