Guide / Extraction
Extract typed data with few-shot guidance
Combine a strict JSON Schema with representative examples while keeping the response contract small and deterministic.Put examples in the prompt
Pythonpython
prompt = """Extract a support ticket.
Examples:
Input: Charged twice for invoice 88
Output: {"category":"billing","invoice_id":"88"}
Input: Cannot log in after password reset
Output: {"category":"account","invoice_id":null}
Return only fields defined by output_schema.
"""Keep the schema strict
- Set additionalProperties to false.
- Use enums for operational labels.
- Make unavailable fields nullable or optional.
- Revalidate output before storing or acting on it.