SDK Usage
Schema Format
Use JSON Schema format to define what you want to extract:Tips for Better Extraction
- Use descriptive field names -
invoice_numberis clearer thanid - Add descriptions - The
descriptionfield helps the model understand context - Specify types correctly - Use
numberfor numeric values,stringfor text - Use arrays for repeating data - Line items, table rows, etc.
REST API
Python Example
Response
The extracted data is returned inextraction_schema_json:
Citation Tracking
Each extracted field includes citations to the source blocks:json output to trace extracted values back to the source document.
Examples
Financial Document
Scientific Paper
Contract
Using Forge Playground
Create and test schemas visually in Forge Playground:- Upload a sample document
- Define fields in the visual editor
- Switch to JSON Editor to copy the schema
- Test extraction before deploying
Related
- Handling Long Documents - Tips for large documents
- Document Segmentation - Split documents by section
Try Datalab
Get started with our API in less than a minute. We include free credits.