Skip to main content

Extract

Category: Processing

The Extract activity pulls structured field values out of each document according to the fields defined for its class. This is where the transaction's data is produced.

Settings​

The Extract step's panel has seven blocks, all folded when it opens. Folded, each block says what it holds, in grey where a value is what a new step starts with and in black where someone changed it. A step saved before a setting existed shows what that setting does without it, or Not set where that depends on whether the step runs on its own or in one call with Classify.

The fields, their descriptions, the guidelines, Memory and the extraction policies belong to the project: every Extract step uses them, and where the panel edits them it says Project. Which fields the step extracts, its own words for a field or for the guidelines, and everything else belong to this step alone, so two Extract steps can extract different fields or use different models.

Fields. Folded, it shows how many fields the step uses ("All 18 fields", or "14 of 18 fields"), whether values are located, and whether new fields are discovered.

SettingWhat it doesA new step starts with
Edit extraction settingsOpens Extraction Settings: the project's fields of every class, the per-class guidelines, which fields this step extracts, and the step's own description of a field.All fields
Locate values on the pageAfter extraction, each value is looked for in the document's text, so the review screen can show where it is.On
Discover additional fieldsLets the model find and extract fields the project does not have yet; see Discovering fields. Not available on a step that uses only some fields: clearing a field's box switches it off.Off

Instructions (Project). The extraction guidelines, edited in place and saved as you type, and the per-class guidelines, edited in Extraction Settings. Every Extract step sends them, unless it has its own. When the workflow has more than one Extract step, Use different guidelines in this step gives this step guidelines of its own, under the shared ones: the box opens empty, with the shared text in grey, and nothing is saved until you type. Clearing it, or Use the shared guidelines, goes back to the shared ones; Send no guidelines sends none. It helps when two Extract steps on different models extract the same fields and each needs its own words. With one Extract step the box is not offered; a step that already has guidelines of its own still shows them. The block also names the classes and fields this step describes in its own words. The step's JSON view, in the panel's footer, writes the same keys. A guideline or a description can also refer to a value the transaction brings, such as {{ meta:po_number }}: see Metadata in Guidelines and Descriptions.

Model.

SettingWhat it doesA new step starts with
ModelThe model this step uses. Tenant default follows the model your organization set for extraction.Tenant default
What the model readsImage and Text, Image Only or Text Only. With Text Only, a value only the page image shows (a signature, a stamp, a ticked box) is not extracted; with Image Only, dense tables in small print can be misread. A text-only model reads Text Only.Image and Text
Send images of pages without textWith Text Only, still send the image of a page that has no text (a blank page, a photo). Not available for text-only models.Off
Include reasoningAsks the model to explain each value; reviewers see the reason.On

Learning.

SettingWhat it doesA new step starts with
Use examples in this stepPuts documents like this one that a person already reviewed, from the project's Memory, in this step's prompt.On
Memory settings (Project)Opens the project's Memory settings: whether reviewed documents are kept as examples, how many go in a prompt and how they are matched. See Memory.

Rules (Project). The project's extraction policies: how many are active, and Manage policies to open them.

Advanced.

SettingWhat it doesA new step starts with
Max image pages, Max text pagesHow much of a document the step reads: see Page limits.All pages
Answer lengthThe longest answer the model may give.Your organization's length for extraction
Long document page optimizerWith Image and Text, finds the pages that matter first, and sends only those as images.On, for documents longer than 20 pages

Exits. Where the transaction goes after the step, and the failure exit.

Extraction Settings​

Opened from the Fields block, and from the Transaction Viewer. It opens with what extraction does: it reads values from each document. Common fields are read from every document, the others by the class classification gave it; the sidebar lists the document classes, and the pane says whose fields it shows ("Read from the documents classified as Invoice, with the common fields"). When the workflow has more than one Extract step, the dialog names the step it shows; from the Transaction Viewer, Settings of chooses whose settings to change. With one Extract step it says nothing of steps.

  • The tick boxes. Every field has one, first on its row, and every field starts ticked: a step with every box ticked uses every field, and any field added later. Clear a box and the step uses only the ticked ones; the cleared fields fold into Not used at the bottom of the list, and the sidebar counts each class's fields used ("11 of 14 used"). The choice is one list for the common fields and every class's. A table or group is ticked as a whole. A line above the list counts the fields of the class shown; Use all fields of Invoice ticks that class's cleared ones, and once every box is ticked, Use every field, and any added later takes the step back to every field. The step uses at least one field, so the last tick stays. A field you add here is ticked too, and is used by every step that uses all fields.
  • The fields are the project's, per class and common to every class, as in Extraction fields. To delete several at once, choose Select: the rows get boxes for choosing which.
  • A description in a step. A field's description is shared: every step that uses the field sends it. When another Extract step uses the field too, the opened field says so and offers Use a different description in the step's name: a box of its own, under the shared one, that starts empty, with the shared text in grey, and saves nothing until you type. Clearing it, or Use the shared description, goes back to the shared one. Send no description sends the field name alone. A field of a table has its own box too. The field is marked while it has one, folded or not.
  • Extraction Guidelines, at the top, are shared, the general ones on Common Fields and a class's own on the class. With more than one Extract step, the step's own guidelines for either have their box there too; the folded header is marked when the step has them.
  • Discover additional fields, at the bottom of the dialog, works only in Playground runs; Memory, Evaluation and a published version never discover. While it is on, the project's Playground transactions go through extraction one at a time, so processing is slower. It is off and greyed while the step uses only some fields, and clearing a box while it is on switches it off.

Discovering fields​

With Discover additional fields on, the first document of a class that has no fields yet is extracted on its own. The other documents of that class wait for it and reuse the fields it found, instead of each naming the same data differently ("Invoice Date" and "Inv Date"). Documents of classes that already have fields, and documents of different classes, are extracted in parallel.

Where long document extraction (Preview) is on, as it is unless an administrator switched it off, a step that discovers fields reads its documents in parts, unless the project has an active extraction policy: every document of five pages or fewer, and a longer one when the step sends text and a page has some. Such a document discovers as it reads: the fields and tables it finds are added to the draft while it is still being read. The documents of one class then take turns to discover, short documents and classes that already have fields included, so that two of them do not name the same data differently; the other documents of a class with no fields start once its first document's first pages are read, not when it ends. Documents of different classes are still read side by side. A class of many documents is therefore discovered more slowly than it is extracted once its fields are settled. The transaction's Activity Log says what each document added.

Page limits​

Max image pages and Max text pages bound what the step reads of a document. The document is read over its first pages, up to the larger of the two limits; only the first Max image pages are sent as pictures, and only the first Max text pages as text. Pages past both limits are not read. A limit left empty is no limit, and a step that sets neither reads every page.

The limits hold however the Extract step reads a document: in one request, with the long document page optimizer, and in parts (Long Documents). Where Classify also extracts, its one request reads under the two steps' limits together: for each limit, the larger of the limits of the steps that send that channel, and none where such a step sets none. The page optimizer chooses which pages get a picture by their text, so it runs only when both limits reach every page the step reads. Otherwise the first pages are sent as pictures, up to Max image pages or as many as the model takes, with no choosing.

Text limit​

A request holds the text of the pages it reads and, when it finds each value where it is printed, every word with its place on the page. How much one request may hold follows the server: half of its memory, shared among the requests Classify and Extract may run at once. A server of 2 GiB running five requests of each step at once allows about 100 MiB a request: about 70,000 words of ordinary text, more than twice what 20 pages of dense print hold. More memory, or fewer requests at once, allows more. A document whose pages hold more than its request may fails at once: the transaction is shown as failed with the cause Too much text to read (too_much_text), and the message names the document. Read in parts (Long Documents), the limit holds for each part. To process such a document, lower Max text pages and Max image pages so that the step reads fewer of its pages.

Pages and documents without text​

A page with no text (a blank page, a photo) is a normal page, not an error.

  • Some pages of a document have text: extraction works as usual. Each page without text is marked to the model as "(no text on this page)".
  • No page has text, and no image is sent: there is nothing to extract from, so the model is not called. The document's fields stay empty, the step carries on, and the Activity Log names the document. Validation rules that check those fields then report them as usual.
  • No page has text, and images are sent too: the document is extracted from its page images alone. When the step sends both text and images, the transaction's Activity Log shows a processing warning, "Document N extracted from its page images only", for whoever set up the project: read from images alone, dense tables in small print can be misread, and nothing in the result shows which cells. If the pages never went through OCR, add an OCR step before Extract. If reading from images is what you want, set the step to send images only, and the warning is not written.
  • A page that never went through OCR, while the step sends text and no image of that page, fails the step at once with the page numbers. Add an OCR step before Extract, or send page images.

Re-running a single document from the transaction viewer follows the same rules.

When the content filter refuses a document​

The model provider's content filter sometimes refuses an extraction because of a page image, although the same document's text passes. When that happens and the document has text, Extract tries once more with the text only: no page images and no images from Memory examples.

  • The document carries on through the workflow. Review does not show it: Review shows only validation issues, low-confidence values and Agent Review findings.
  • The transaction's Activity Log shows a processing warning, "Document N extracted from its text only", with the categories the filter named, and the extraction's own row says "text only". People who configure the project or manage the tenant also see the transaction marked in the list (see Processing warnings).
  • Without the images, the model sees only what OCR read: a value printed only in a logo, a stamp or a photo, and pages beyond the step's text page limit, are not seen.
  • If the text is refused too, or the document has no text (a scan OCR found nothing on), the step fails as before, and the error names the document.

When a table stops before its end​

The model marks the last row of every table it extracts. When none of the rows it returns carries that mark, the model stopped before the table ended, and rows are missing: this happens with long tables that run over many pages. A mark on a row that names a page the step did not send, or whose row number falls out of order, does not count.

  • The transaction's Activity Log shows a processing warning, "Document N: a table stops before its end", naming each such table, how many rows it has and the page of its last row. Administrators, designers and supervisors also see the transaction marked in the list (see Processing warnings).
  • The rows that were extracted are kept. Review does not show the warning, so check such a document's table against the pages after its last row.

A row can also come back with more or fewer cells than the table has columns, and then its values may be in the wrong columns: on a bank statement, a balance read as a credit. Such a row is kept with a confidence of 0, and the Activity Log shows "Document N: values in a table may be in the wrong columns", with how many rows of each table. In a repeating group, Review flags the row's values as low confidence. Without a Review step, check those rows against the document before you use them.

A row that names a page the step did not send is kept too, on the page of the row before it, with a confidence of 0. Inside a table it raises no warning of its own: its low confidence is what shows it.

Notes​

  • Located values power click-to-locate highlighting in the review interface.
  • Fields are defined per document class in project settings; see Projects.