For the complete documentation index, see llms.txt. This page is also available as Markdown.

Extraction Model Chaining

Selectively extract data from detected classes.

Link a Classification model to one or more Extraction Models, to automatically extract structured data from documents based on their detected class.

Note: Classification Models always return a single class regardless of the number of pages or if there are multiple documents on the same page.

Extraction Set Up

At Model Creation

When creating your Classification Model, you'll be adding document classes in the creation window.

For each document class, you can link one of your Extraction Models for chaining. The Extraction Model must exist prior to the Classification Model creation.

Use the search field to filter available Extraction Models.

After Model Creation

This works exactly like when creating at model creation.

Simply go to your Split model's "Utility Configuration" page and adjust as needed.

You can add new classes, remove classes, and change Extraction Models.

Selectively Extracting

All documents will get classified, but only those linked to an Extraction Model will have extraction results.

This allows selectively extracting some files while ignoring others.

Add an other class in addition to classes of interest to you, unless all potential document types are known in advance.

Putting It All Together

As a sample use case, let's say you have a KYC workflow, and your users upload their files. As a result, you receive mixed file types in the pipeline: driver licenses, passports, student IDs, employee badges, social security cards, etc.

As a first example, assume you only process passports. In your Classification configuration, add a passport class and an other class, then chain a Passport extraction model on the passport class. Do not chain any models on the other class.

Another example, if you need only government IDs (so driver license and passport), you have two choices:

  • Create an official_government_id class and chain it to an International ID extraction model. This is recommended if you accept a variety of ID documents.

  • Create a driving_license and passport class and chain the Driver's License and Passport extraction models to them, respectively. This is recommended if you only accept specific ID documents.

As in the earlier example, do not chain any models on the other class.

In the above examples, the documents classified as other will not have extraction results, while those with specific classes will have results.

You can of course use any extraction model, including fully custom ones.

Token Usage With Chaining

The initial model (Split, Crop, Classification) is provided at no additional cost to you if it triggers additional processing using an Extraction model.

The possible credit consumption scenarios are as follows:

  • extraction model not chained ⇒ token usage of initial model

  • extraction models chained ⇒ token usage of the extraction model, including any activated optional features.

Token consumption is calculated per page as is standard for our models.

For Classification models specifically, there can be only a single chained extraction per file. This means that the total number of pages processed by an Extraction model will be always equal to the number of pages in the source document.

Some examples:

  • JPEG image file, a document is detected and chained ⇒ 1 page of Extraction credit consumed.

  • 23-page PDF file, a document is detected and chained ⇒ 23 pages of Extraction credit consumed.

  • PNG image file, no document detected ⇒ 1 page of Classification credit consumed.

  • 75-page PDF file, a document is detected but not chained ⇒ 75 pages of Classification credit consumed.

Access Extraction Results

When an Extraction Model is linked, the detected class contains an Extraction Response object.

That object is the same as the response returned by a standalone Extraction request.

Check Classification Result for details on accessing crop items and their extraction responses.

Last updated

Was this helpful?