Adding document extractors

You can add custom document extractors to agentic workflows to extract fields or entities such as date, names, and others from documents.

To add a document extractor to an agentic workflow:

  1. From the menu Menu, go to Build.
  2. Select All tools.
  3. Do one of the following based on your needs:
    • To create a new agentic workflow with a document extractor, click Create tool and select Agentic workflow.
    • To add a document extractor to an existing agentic workflow, select the tool, click the Options icon option icon, and select Open in flow builder.
  4. Click the Add tools icon add icon.
  5. Select the Create new tab.
  6. Drag Document extractor to the agentic workflow.
  7. Select one of these tool options to extract fields from your documents: Structured or Unstructured. For more information and guidelines on which tool option is suitable for your data extraction use case, see Choosing a tool option for extracting fields from documents.

Choosing a tool option for extracting fields from documents

You can choose from two tool options to extract fields from documents: Structured and Unstructured. These tools differ in how they process information, but the steps that you need to follow in both options are almost the same.

  • Unstructured: Uses a text-based language model to extract top-level fields from documents. It works best for text-heavy content, but does not extract column values from tables.

  • Structured: Uses a vision-based, multimodal language model to extract both top-level fields and table data. Because it relies on a larger model, it usually runs slower.

When to use each tool option

Configuring a document extractor after selecting the Unstructured option

To configure the document extractor to identify and extract a set of fields from unstructured documents:

  1. Select the document extractor that you added to the agentic workflow.

  2. Click the Edit fields icon edit.

    A dialog to upload the documents is displayed.

  3. Select a model to use for the document extractor from the Model list.

  4. Upload your documents.

    The uploaded sample documents help in creating the fields. These documents do not train the model, and are also not a part of the agent that is being configured.

    It might take some time to upload the documents.

    When the upload is complete, you can see a document preview where you can do the following actions by using the options in the toolbar:

    • Select an uploaded document to view from the list
    • Browse the pages of a document that you are viewing
    • Fit the page width and height to view
    • Zoom in and zoom out a page to view
    • Search for a field in a document

Example showing uploaded documents
Figure 1: Example showing uploaded documents.

In the previous example, a user uploads sample documents and the document preview is displayed for these documents.

  1. Click Add field to add fields for the information that you want to extract from the documents such as dates, names, and others.

    The document extractor searches for values that are related to the fields across documents.

Example showing fields to extract from a document
Figure 2: Example showing fields to extract from a document.

In the previous example, a user has added the price, tenure, and date fields, which are searched and shown on the document preview panel.

To edit the field details, hover over the field, and click the View field details icon edit. You can edit the field name, description, and data type. You can add examples of the field to help the model understand what information you want to extract, and click Show on document to get the results. You can also delete the field if it is no longer needed.

  1. To upload more documents and delete existing documents, select the Manage documents option from the list in the document preview toolbar.

  2. Browse the different documents from the document preview toolbar to verify whether the information is extracted as you expected.

  3. Configure the settings that trigger a human review. For more information, see Configuring a user review.

  4. After you verify and get the expected results, close the document extractor dialog.

Configuring a document extractor after selecting the Structured option

The ability to extract all line items from structured documents such as purchase orders and invoices reduces manual efforts and improves accuracy in document processing.

To configure the document extractor to identify and extract a set of fields from structured documents:

  1. Select the document extractor that you added to the agentic workflow.

  2. Click the Edit fields icon edit.

    A dialog to upload the documents is displayed.

  3. Upload your documents.

    The uploaded sample documents help in creating the fields. These documents do not train the model, and are also not a part of the agent that is being configured.

    It might take some time to upload the documents.

    When the upload is complete, you can see a document preview where you can do the following actions by using the options in the toolbar:

    • Select an uploaded document to view from the list
    • Browse the pages of a document that you are viewing
    • Fit the page width and height to view
    • Zoom in and zoom out a page to view
    • Search for a field in a document

Example showing an uploaded invoice
Figure 3: Example showing an uploaded invoice.

In the previous example, a user uploads a sample invoice document and the document preview is displayed for the document. The preview also shows the automatically detected tables in the document from which you can extract data.

  1. To add an automatically detected table from the document to extract data, click the Add table icon add_table.

    The data from the table is added to the fields for extraction under a table name. To edit the table name, hover your mouse over the table name, and click the Edit icon edit. To delete the table, you can click the Delete icon edit.

    You can also reorder the columns in the extracted tables. For more information, see Reordering columns.

  2. To add a custom table and define the fields to extract data, click the Add table icon add_table in the side panel. Do the following to add a custom table:

    a. Specify a name for your custom table and press Enter.

    b. Click Add column and provide the column name for your custom table, and press Enter. Repeat this step to add more columns to your custom table.

    The system searches for the column values in the document. The first value that is found for a column is displayed in the side panel and all other values for that column are highlighted in the document preview.

    If a value is not found for a column, no value is displayed in the side panel for the column. In this case, you can click the View column details icon view-column-details to prompt the system for the expected value in the document. This action helps the system to understand what information you want to extract for the column.

    To prompt for a value, select the data type, set the Description switch to on and enter or describe the value, and then click Show on document. The system searches for the values in the document based on your description. If a value is found, it is displayed in the side panel. You can also delete the column if it is no longer needed.

    You can also reorder the columns in the extracted tables. For more information, see Reordering columns.

    c. To view your custom table with a preview of the extracted data, click View next to the table name.

    Example showing a custom table with the columns
    Figure 4: Example showing a custom table with the columns

  3. To add more fields for the information that you want to extract from the documents such as dates, names, and others, click Add field

    The document extractor searches for values that are related to the fields across documents.

    To edit the field details, hover over the field, and click the View field details icon edit. You can edit the field name, data type, and description. You can add examples of the field to help the model understand what information you want to extract, and click Show on document to get the results. You can also delete the field if it is no longer needed.

  4. To upload more documents and delete existing documents, click the Manage documents icon manage-docfrom the list in the document preview toolbar.

  5. Browse the different documents from the document preview toolbar to verify whether the information is extracted as you expected.

  6. Configure the settings that trigger a user review. For more information, see Configuring a user review.

  7. After you verify and get the expected results, close the document extractor dialog.

Reordering columns

You can reorder columns in tables by dragging and dropping them. This action is helpful, for example, when you want to ensure that the column order aligns with the original table in the document.

By default, the column order in the schema matches the order in the extracted table. However, if a column is missed during auto-detection and is added manually later, it appears at the end of the table.

To reorder column names in tables:

  1. Hover over the column name in the side panel and drag it by clicking the Drag icon drag.
  2. Click View next to the table name. The new column order in the table is displayed in the preview.

Mapping data to inputs

By default, auto-mapping is enabled. However, you can map values to the inputs.

To map values to inputs, complete the following steps:

  1. Select the document extractor node and then click Edit data mapping.
  2. Specify the input values for data mapping. For more information about data mapping, see Mapping data.

Mapping tables extracted from a document extractor node to other nodes in a workflow

You can now map a table type output from a document extractor node in a workflow. You can do any of the following:

  • To display the entire table in a chat, map the extracted table in the workflow by using the list interaction type under a document extractor node.

Example showing a custom table mapping using list under a document extractor
Figure 5: Example showing a custom table mapping using list under a document extractor

  • To display row data from a table in a chat, you can iterate through the rows of an extracted table using a For each loop in the workflow. To do this, you can combine a For each loop with a user activity node and Message output. Then, to display each row, you can select the columns in the For each loop data mapping.

Example showing the data mapping of columns in a For each loop
Figure 6: Example showing the data mapping of columns in a For each loop

Also, to use any extracted table output in a downstream node in the workflow, you can use this same process of For each loop data mapping. This enables further processing such as applying conditional logic in a workflow.

Configuring a user review

You can configure the settings that trigger a user review. Only the user who initiated the agentic workflow can review the document.

  1. Select the document extractor in the agentic workflow.

  2. Set the User review switch to on, and click the Edit icon edit icon.

  3. In the If the extraction confidence is below field, set the extraction confidence threshold for all fields or specific fields that can trigger a user review. To select specific fields that trigger a user review, click the Edit icon edit icon, select the specific fields, and click Done. Extraction confidence score reflects how closely the extracted results match the expected values.

Document extractor limits and restrictions

Document extractors have the following limits and restrictions.

Area Description
Maximum file size 10 MB
Maximum number of uploaded files 5 files
Accepted file types .doc, .docx, .jpe, .jpeg .jpg, .pdf, .png, .ppt, .pptx, .tif, .tiff
Maximum number of pages 600 pages
Maximum number of fields 25 fields
  • Creating agentic workflows

    An agentic workflow defines a set of linked activities and controls that are designed to achieve a specific business purpose or goal. Learn more about agentic workflows.