Skip to navigation

Classify documents

View as Markdown

Classify tells you what kind of document each file is. You define the document types, for example Bank statement, Identity document, or Invoice. Sarvam assigns one to each file and gives a confidence score and a short reason.

Use it to route incoming documents to the right team, check that a customer uploaded the right paperwork, or pick the right Extract schema for each file.

Step 1: Add your documents

Click Classify under Products in the sidebar. Drag and drop your files, click Upload documents, or pick a demo document (Bank statement.pdf or PAN card.pdf).

Accepted formats: PDF, JPEG, PNG, TIFF, ZIP. Each run takes up to 10 files or 20 pages in total. For more, use the Classify API.

Step 2: Define document types

Under Define document types, add one row per type:

  • Document type. The label you want back, for example Identity document.
  • Description. What this type looks like, for example A PAN card, Aadhaar card or passport. Clear descriptions make a big difference when two types look alike.

Click + Add type for more rows, drag the handle to reorder, and click × to remove one. Switch to JSON to edit the list as raw JSON, or use Load saved list to reuse types from a saved Config.

Classify page with a sample PAN card on the left and, on the right, Define document types listing Bank statement and Identity document with descriptions, an Instructions box, and Advanced settings showing Number of pages to read for classification set to 3.
Classify setup: two document types, with advanced settings open.

Use the optional Instructions box for anything that applies to every document.

Advanced settings

Expand Advanced settings to control cost and behaviour:

SettingWhat it does
Number of pages to read for classificationHow many pages from the start of each document Sarvam looks at. Fewer pages cost fewer credits. The cost per document is shown under the setting.
Page ranges to readRead specific pages instead of the first ones, for example when the cover page is the same for every document.
When no type matchesSuggest a type lets Sarvam propose a new label. Mark as Other returns Other instead.

Step 3: Run and review

Click Run classify. The credits needed are shown under the button. When the run is Done, the Output tab shows one row per document:

Classify output with one row for PAN card.pdf, 1 page, Read 1 of 1 page; Document type Identity document; Confidence 100%; and a Reasoning column explaining that the document is titled Permanent Account Number Card.
Classify results: the document type, confidence, and reasoning for each file.
ColumnMeaning
Document nameThe file, its page count, and how many pages were read
Document typeThe assigned type. Change it from the dropdown if it’s wrong.
ConfidenceHow sure Sarvam is about the type
ReasoningA one-line reason, useful for checking edge cases

Switch to JSON to see the raw output. Go back to Setup to change the types and Run again.

Step 4: Download or reuse

  • Download saves the results.
  • Save config saves your document types and settings for reuse. See Save and reuse Configs.
  • View API code gives you cURL, Python, or JavaScript for the Classify API.

Classify looks at each file as a whole. If one PDF contains several different documents, use Split instead. Split finds where each document starts and ends.