Skip to main content
Practical examples showing how to extract structured data from different document types using Python (Pydantic) and TypeScript (Zod) schemas.
For a complete understanding of Extract outputs, see Extract Outputs. For configuration options, see Extract Overview.

Financial Report

Extract key financial metrics and data from financial statements, earnings reports, and other financial documents.

Schema

Process

Output

Medical Benefits Claim

Extract key medical benefits claim data from medical benefits claim documents.

Schema

Process

Output

Best Practices

Schema Design Tips

  1. Use Descriptive Field Names: Choose clear, unambiguous field names that reflect the actual data being extracted.
  2. Handle Optional Fields Appropriately: Mark fields as optional when they may not be present in all documents.
  3. Include Field Descriptions: Use Pydantic’s Field(description="...") or Zod’s .describe() to provide context.
  4. Use Appropriate Data Types: Choose the right types (string, number, boolean, array, date) for each field.

Extraction Optimization

  1. Custom System Prompts: Tailor prompts to your document type. See the system prompt parameter for details.
  2. Quality Validation: Use citation trails alongside confidence scores to validate extractions.