AI Glossary / Prompting and human-AI interaction / Beginner
Extraction prompt
Definition
An extraction prompt is an instruction that asks an AI model to pull specific facts out of a piece of text, such as names, dates, amounts or categories, and return them in a fixed, predictable format. It is not a summary or a rewrite. The aim is to turn unstructured text into structured fields. Teams define the fields, formats and rules for missing data in different ways.
What it means
Much business information arrives as free text: invoices, emails, contracts, support tickets, call notes. People read these and type the key facts into a system. An extraction prompt asks a model to do the reading and hand back only the facts you asked for, laid out the same way every time.
The value is consistency. A good extraction prompt names each field, says what format it should take, and says what to do when the text does not contain the answer. The output can then be checked, stored in a spreadsheet or database, and passed to the next step in a process, usually with a person reviewing the doubtful cases.
How it works
You write the prompt in parts. First, the task: read the text below and extract the listed fields. Second, the schema: each field name, its type (text, number, date) and its format, for example a date written as year-month-day. Third, the rules: copy values exactly as written, do not guess, and return null or a fixed marker such as NOT_FOUND when a field is absent. Fourth, the source text, clearly separated from the instructions so the model does not mistake text from a document for a command.
Many teams add one or two short examples of input and desired output, and ask for a machine-readable layout such as JSON. Some model platforms can also enforce a schema, so the reply always fits the structure. Practice varies, and a schema check in your own code is a sensible backstop either way.
The model predicts the answer from the text and your instructions. It can still misread a table, confuse two similar dates or fill a gap with a plausible value. That is why extraction is tested against a set of documents where the right answers are already known, and why uncertain results are routed to a person.
Three practical examples
- Finance team: An accounts payable team pastes the text of a supplier invoice into a prompt. It asks for supplier name, invoice number, invoice date, total and currency, with null for anything missing. The returned fields are checked against the purchase order before payment.
- Retailer: A retailer receives free-text customer emails about damaged goods. The prompt extracts order number, product name, type of damage and whether the customer wants a refund or a replacement. The results fill a returns queue that staff work through.
- Support desk: A support team uses an extraction prompt on incoming tickets to pull out the product version, the error message quoted by the customer and the urgency the customer states. Tickets are then routed to the right group without anyone retyping details.
Think of it this way
Think of a clerk with a printed form who reads a letter and fills in only the boxes on the form, leaving a box blank when the letter does not say. The analogy stops working because a clerk knows when they are unsure and will usually ask, while a model may fill a box with a confident but wrong value unless you tell it not to and check its work.
Worked example
Suppose a prompt extracts four fields from the sentence: Invoice 4471 from Northgate Supplies, dated 12 March 2025, total 1,850.00 USD. The requested output has supplier, invoice_number, invoice_date and total. The model returns supplier: Northgate Supplies, invoice_number: 4471, invoice_date: 2025-03-12, total: 1850.00. All four fields are filled.
Now test it on 20 sample invoices where a person has already entered the correct values. That gives 20 x 4 = 80 field values. A reviewer finds 74 correct, so field accuracy is 74 / 80 = 92.5 percent. Looking closer, 5 of the 6 errors are in the invoice_date field, because some invoices show dates as day/month/year. After adding the rule always output dates as year-month-day and read the day first when the format is day/month/year, a retest of the same 20 invoices gives 78 correct out of 80, or 97.5 percent. The change is small, specific and measurable.
Illustrative case study
Fictional case: Harbor Lane Property Management handles repair requests that tenants send as free-text emails. Clerks were retyping the unit number, the problem type and the urgency into a tracking sheet, and entries were often late. The operations lead wrote an extraction prompt with those three fields plus a contact phone number, and ran it on 50 past emails with known answers.
Results looked good except for urgency. The model marked requests as urgent when tenants wrote emphatic language, even for minor issues, and sometimes invented a phone number when none was given. The lead changed the prompt: urgency must be one of three listed values based only on stated safety risk or loss of water, heat or power; copy the phone number only if it appears in the text; otherwise write NOT_FOUND. A clerk now reviews every record marked NOT_FOUND or urgent. Time spent on data entry fell, and wrong urgency labels dropped on the retest set.
Common misconceptions and mistakes
An extraction prompt guarantees correct data. It does not, because the model can misread or fill gaps with plausible values. Test against documents with known answers and review uncertain results.
Extraction and summarizing are the same thing. A summary shortens and rephrases, while extraction returns specific fields in a fixed format. Mixing the two in one prompt tends to produce inconsistent output.
If a field is missing, the model will leave it empty by itself. Models often try to be helpful and guess. You need to state what to return when a value is absent, such as null or NOT_FOUND.
One prompt works for every document type. Layouts, wording and date formats differ, so a prompt tuned on one supplier's invoices may fail on another's. Test each document family separately.
Business use
Start with one document type and a short list of fields that people already enter by hand. Collect 20 to 50 real examples with the correct answers, write the prompt, and compare its output field by field. Adjust the instructions where errors cluster, retest, and only then connect the output to a live process. Keep a person in the loop for low-confidence or high-value records.
Measure accuracy per field, the share of records needing human correction, and time saved per document. Costs include model usage fees, the time to build and maintain test sets, and review effort. Risks include sending personal or confidential text to a model, so check your data handling terms and privacy rules first, and watch for quiet errors in fields that feed payments or legal decisions.
People also ask
What is the difference between an extraction prompt and a summarization prompt?
An extraction prompt returns specific named fields in a fixed format, such as an invoice number and total. A summarization prompt returns a shorter version of the whole text in free-form language.
How do I stop the model from making up values?
Tell it to copy values only as written and to return null or NOT_FOUND when a field is missing. Then check results against documents where you know the right answers.
Do I need JSON for an extraction prompt?
No, but a structured format such as JSON makes the output easier to validate and pass to other systems. Other fixed layouts, like a table or labeled lines, can work for simple cases.
Check your understanding
In the worked example, what was the field accuracy before the date rule was added?
Answer: 74 correct out of 80 field values, which is 92.5 percent.
Why did the date rule help in the worked example?
Answer: Most errors came from invoices using day/month/year dates. A rule fixing the output format and the reading order removed that confusion.
What should an extraction prompt say about missing information?
Answer: It should state exactly what to return, such as null or NOT_FOUND, so the model does not guess.
Why were NOT_FOUND records sent to a clerk in the Harbor Lane case?
Answer: They signal that the data is incomplete or uncertain, so a person should check them before they are used.
Related terms
- Prompt engineering
- Few-shot prompting
- Hallucination
- Schema
- Human-in-the-loop
- Prompt injection
- Structured output
- Evaluation set
Learn next
Pick one repetitive data-entry task and build a small test set of real examples with correct answers before you write any prompt. Then read about structured output, few-shot prompting and evaluation sets to improve and measure your results.
More in Prompting and human-AI interaction
- Conversational user interface - Definition: A conversational user interface lets people interact with software through exchanges resembling conversation, using written language, speech or...
- Delimiter (prompting) - A delimiter, in prompting, is a marker such as triple quotes, XML-style tags, a row of dashes or a heading that separates one part of a prompt from another.
- Extended thinking - Extended thinking is a mode in which an AI model is given room to work through a problem in a longer series of intermediate reasoning steps before it writes...
- Fallback response - A fallback response is the pre-planned reply or action an AI system gives when it cannot answer well, such as when it is unsure, the request is out of...
- Few-shot learning - Few-shot learning is the challenge of adapting to a task or recognizing new classes from only a small number of labeled examples.
- Frequency penalty - A frequency penalty is a text-generation setting that lowers the chance of a language model choosing a word or token again in proportion to how many times...
Sources
OpenAI, Prompt engineering guide: https://platform.openai.com/docs/guides/prompt-engineering DAIR.AI, Prompt Engineering Guide: https://www.promptingguide.ai/ Google, Machine Learning Glossary: https://developers.google.com/machine-learning/glossary The sources were consulted for general prompting practice and terminology; the examples, analogy, worked example and case are original educational illustrations. Checked 10 Nov 2026.
Previous: External validity Next: Extraposition