Skip to main content
The quality of your classification depends heavily on how you define your categories and criteria. Here are guidelines for getting the best results.

Be Specific with Criteria

Criteria should describe concrete, observable characteristics of the document, things that would be visible on the page.
Think of criteria as instructions you’d give a human reviewer: “Look for X, Y, and Z to identify this type of document.”
Good criteria describe what you’d actually see in the document:
Weak criteria are too vague or abstract:

Make Categories Mutually Exclusive

Design your categories so that a given document clearly belongs to one category over others. If categories overlap significantly, classification accuracy will suffer.

Text vs. Image-Based Classification

Classify works with both text-heavy and visually distinct documents. Your criteria can reference either textual content or visual characteristics:
  • Text-based criteria: "contains the words 'Terms and Conditions'", "includes a table of financial figures"
  • Visual/structural criteria: "has a photo ID section", "contains handwritten notes", "includes a signature block"
For documents that are primarily distinguished by layout rather than text (e.g., a passport vs. a driver’s license), include structural criteria like "contains a machine-readable zone at the bottom" or "has a photo in the upper-left corner".

Use Enough Categories

You must provide at least two categories. Classify returns the best match from your schema, so even if none of the categories are a perfect fit, it will return the closest one. If you need an escape hatch, add a catch-all category:

Use Confidence Scores to Refine Your Schema

The response confidence breakdown tells you exactly which criteria matched or didn’t for every category. Use this to iterate on your schema:
  1. Run Classify on a batch of sample documents.
  2. Check documents where the winning category had low confidence (e.g., below 0.7).
  3. Inspect the criteria_confidence to see which criteria are too broad, too narrow, or overlapping with other categories.
  4. Adjust your criteria and re-run until confidence scores improve.

Classify Overview

Quick start, request parameters, and pipeline integration.

Response Format

Confidence scores, per-criterion reasoning, and all response fields.