Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 3 Next »

What is Document Understand?

PIPEFORCE comes with a solution to automatically detect and extract data from a given (PDF) document using AI and displays those fields then on a form to the user. The user can then review and adjust the field values if required.

This is especially useful for example for payable invoices in order to extract information from these PDF invoices and review them before they will be forwarded to the internal invoice payable process.

image-20250128-102536.png

How to execute it?

In order to send a given PDF document to the Document Understand AI backend and to extract the required data, you can use the command ai.document.understand in your pipeline.

This command will load the document, will validate the given understand config parameters, then sends the document and the instructions to the AI and finally returns a JSON response with the values extracted from the document which can be further processed in the pipeline.

Here is an example how to use this command in a pipeline:

pipeline:
  - ai.document.understand:
      secret: google-document-understand
      provider: google
      input: $uri:drive:my-invoice.pdf
      config: TODO

The parameters of the command are these:

  • secret
    The name of the secret to be used to connect to the Document Understand AI backend.

  • provider
    The AI backend to be used. There are different implementations possible:

    • google = Uses Google’s Document Understand cloud service (hosted in Germany if it is part of the enterprise plan).

    • aws = Use the AWS Document Understand cloud service.

    • <custom> = Uses a self-hosted AI model and the provided endpoint to solve this problem.

  • input
    The input document to be send to the AI. Can be any PIPEFORCE URI. If no input parameter is specified, the input document is expected in the body of the pipeline.

  • config
    The configuration or prompt required by the AI backend to fulfill this document understand request and return the expected JSON. This configuration depends on the selected AI backend using the provider parameter.

How to review and approve the extracted data?

In case you would like to let the Document Understand result review and approve by a human user, you can use forms and provide a review step in your app or workflow.

The first step is to create a form config and set type to documentUnderstand as this example shows:

{
	"title": "Document Understand",
	"output": "$uri:pipeline:target/to/be/called/after/submit",
	"type": "documentUnderstand"
	"config": ...
}

Use the output attribute in order to define the PIPEFORCE URI like a pipeline or command to be called after the data review is done and the form was submitted. This is the location where the final Document Understand JSON result will be written to.

The config attribute defines the configuration for the document understand and how to map resulting data to form fields.

See here an example of a form config including the config section for field mapping:

{
    "title": "Document Understand",
    "type": "documentUnderstand",
    "output": "...",
    "config": {
        "type": "invoice",
        "name": "Invoice",
        "fields": [
            {
                "id": "invoice_number",
                "mapping": "invoice_id",
                "label": "Invoice number"
            },
            {
                "id": "invoice_date",
                "mapping": "invoice_date",
                "label": "Invoice date"
            },
            {
                "id": "line_item",
                "mapping": "line_item",
                "label": "Invoice items",
                "columns": [
                    {
                        "id": "line_item/description",
                        "mapping": "line_item/description",
                        "label": "Description"
                    },
                    {
                        "id": "line_item/quantity",
                        "mapping": "line_item/quantity",
                        "label": "Quantity"
                    },
                    {
                        "id": "line_item/amount",
                        "mapping": "line_item/amount",
                        "label": "Amount"
                    }
                ]
            }
        ]
    }
}

By default the Google Document Understand AI backend is used (with server location in Germany). Below you can find a list of the most important fields which can be extracted from a document using this backend. For a full documentation of the supported fields, go to the Google Document Understand documentation.

TODO Table of custom fields

  • No labels