LLM Extractor
Document Extraction using Large Language Model
Last updated
Document Extraction using Large Language Model
Last updated
The LLM Extractor is a reliable method for extracting data from documents when a suitable skill model is not available to use the Skill Extractor. It is particularly useful when you cannot make any assumptions about the document structure. The LLM (Large Language Model) utilizes user-defined fields and keywords to extract specific information from documents. By mapping required fields with keywords, the LLM can accurately identify and extract the desired information. Additionally, hint text can be provided to assist the LLM in identifying fields more accurately.
Document Extraction Workflow with LLM Extractor is created in two stages:
Creating a LLM extractor definition to specify the field names, keywords, and types.
Creating a Document AI client with Document AI credentials in the Studio Workflow and running the Invoke LLM activity with the created definition.
Creating a Document Extraction workflow begins by creating the Document Extractor Definition file. The definition file contains information about the type of extraction, the fields that need to be extracted, and how each field is identified and extracted.
Open Robot Studio.
Click on the Home tab in the Ribbon menu.
Navigate to Document AI and select Create Document Extractor.
In the Create Extractor Window, click on Create and select LLM.
Add the required fields by clicking the Add button. For example, let's add two fields: InvoiceNumber
and InvoiceDate
with output formats Text
and Date
, respectively.
Provide the respective keywords for each field, such as Invoice Number
and Invoice Date
.
To extract tabular data, click the Add Table button in the Add New Field dropdown and give it a name, e.g., LineItems
.
Add columns to the table by clicking the Add Column button. For example, add two columns: Description
and Quantity
with output format Text. Assign the keywords Item Description
and Item Quantity
to the columns, respectively.
No configuration is required for LLM extractor.
Click the Save button to save the definition as a definition file.
To create the Extraction Workflow with LLM, you need four activities: two Create Document AI Client activities, one Preprocess Document activity, and one Invoke LLM activity. One document AI client is used for text extraction and the other is used for using the LLM. Additionally, the Show Validation Window activity can be used to view the extracted data.
Add the Create Document AI Client activity to the Workflow.
Click on the Configure button to launch the Create Document AI Client Window.
In the Client Authorization section, provide the Document AI Endpoint and API Key.
In the Available Services section, set the provider as Visualyze.
Set Text as the Extraction Type.
Save the configuration.
Add another Create Document AI Client activity to the Workflow.
Click on the Configure button to launch the Create Document AI Client Window.
In the Client Authorization section, provide the Document AI Endpoint and API Key.
In the Available Services section, set the provider as Visualyze.
Set LLM as the Extraction Type.
Save the configuration.
Add the Preprocess Document activity to the Workflow.
Assign the DocAIClient variable from the Create Document AI Client activity for text extraction to the Document AI Client property.
Set a PDF or image file path to the Input File property. This activity applies OCR on the document.
Add the Invoke LLM activity to the Workflow.
In the Document AI Client property, assign the DocAIClient variable from the Document AI Client Activity for LLM.
In the Processed Document property, assign the ProcessedDocument variable from the Preprocess Document Activity.
In the Extractor Definition property, assign the path to the created LLM Extractor Definition file.
Finally, add the Show Validation Window activity.
Add the ExtractionResult variable from the Invoke LLM activity to the Extraction Result property.
Run the workflow.
The extraction will be applied to the selected file, and the results will be displayed on the Validation Window.
This is a simple example of creating the extraction workflow. Use this guide as a reference to extract information from documents using the LLM Extractor, and customize it according to your specific requirements.