Skip to main content

30-Second Quick Start

With citations and confidence both disabled, extract returns your schema model. See Extraction Response Shapes before enabling either flag.

Async Client Pattern

The current Dex SDK is async-only. Prefer async with DexClient(...) when you are making multiple calls so the underlying HTTP connection can be reused:

Data Retention Policies

Configure automatic data lifecycle management for compliance and cost optimization.

Setting Retention Policies

Updating Retention Policies

Retention Policy Use Cases

Compliance (GDPR, HIPAA):
Cost Optimization:
Security (Minimize Exposure):

Optimizing Extraction Accuracy

  1. Write Clear Prompts
  2. Design Good Schemas
  3. Enable Citations and Confidence
    • Always set generate_citations=True for debugging
    • Use generate_confidence=True to filter low-confidence results
  4. Use Vector Stores for Large Documents
    • Documents > 50 pages benefit from RAG-enhanced extraction
    • Vector stores improve accuracy for cross-document queries

Getting SGP Traces for Extraction

Use start_extract_job instead of extract to get async jobs that are linked to SGP traces. Search for traces by job ID to debug extraction latency, token usage, or failures.

Common Workflows

Single Document Processing:
Multi-Document Analysis:
Iterative Refinement:
Production Pipeline:

Performance Optimization

Reduce Latency

  1. Tune downstream chunking: Rechunking controls embedding, retrieval, and extraction context size; it does not shorten the preceding OCR parse. For parse latency, choose the layout mode, OCR models, and supported concurrency settings for your workload.
  2. Limit direct extraction pages: In SDK 0.7.1 or later, pass 1-based pages ranges to direct file extraction. Parsing has no page-range option; upload a file containing only the required pages when you need a smaller parse.
  3. Batch operations: Process multiple files in parallel
  4. Cache parse results: Reuse parsed documents for multiple extractions

Reduce Costs

  1. Set retention policies: Auto-delete old data
  2. Choose right model: Use smaller models when possible
  3. Optimize prompts: Shorter prompts = lower token costs
  4. Filter before extraction: Use vector search to find relevant chunks first

Common Errors & Quick Fixes


Access Response Data

Project, file, parse, and vector-store methods return wrapper objects. Use .data for full entity fields, and use convenience properties like .id when available:
Common Response Attributes:
When citations or confidence are enabled, parse-result and vector-store extract return extracted fields at extract_result.data.data and token usage, when present, at extract_result.data.usage_info. With both disabled, they return your schema model; use .model_dump(), as in the quick start above. Extract jobs and direct file extraction wrap metadata responses differently; see Extraction Response Shapes.

Type Import Quick Lookup

Response Types (accessed via .data, no import needed):
  • ProjectEntity, FileEntity, ParseResultEntity, VectorStoreEntity
For extraction response types, see Extraction Response Shapes.

Next Steps