Extraction Prompts
Best practices for writing effective prompts to extract structured data in fileAI
1. Be Explicit and Specific
- Instead of "Extract important details", use "Extract the invoice_number, total_amount, and due_date from the text."
2. Match Field Names Exactly
- Use field names as defined in your schema, e.g., customer_name, not name or client.
3. Use Clear Instructions
- Example: "Extract the delivery_status_enum as one of: shipped, pending, delayed."
4. Set Expectations for Format
- For dates: "Extract received_date in the format YYYY-MM-DDTHH:MM:SSZ."
- For yes/no: "Is the payment confirmed? Respond with true or false."
5. Provide Context When Necessary
- If the field is ambiguous, clarify in the prompt
- Example:"Extract the contract_date_time (the date the contract was signed, not created)."
6. Use Examples (if supported)
- If your system supports few-shot prompting, include examples of expected input/output.
Updated 9 days ago
What’s Next