# Invoke LLM

The **Invoke LLM** activity is used to extract data from documents using a powerful tool called the Large Language Model (LLM). This activity utilizes a user-defined extractor definition to identify and extract the required data from a specified document.

### Input

* **Document AI Client** [`DocAIClient Variable`](/getting-started/rpa-studio/variables/activity-variables.md) <mark style="color:red;">`Required`</mark>\
  This is a variable that represents the Document AI Client. It should be created using the [Create Document AI Client](/rpa-studio/document-ai/create-document-ai-client.md) activity. The Document AI Client must also be configured for LLM extraction.
* **Extractor Definition** [`String Argument`](/getting-started/rpa-studio/arguments.md) <mark style="color:red;">`Required`</mark>\
  This is the file path of the LLM Extractor Definition. The definition is created using the **Create Extractor Window**.
* **Processed Document** [`ProcessedDocument Variable`](/getting-started/rpa-studio/variables/activity-variables.md#processeddocument) <mark style="color:red;">`Required`</mark>\
  This is the pre-processed document that you want to extract data from. It is the output of the **Preprocess Document** activity.

### Output

* **Extraction Result** [`ExtractionResult Variable`](/getting-started/rpa-studio/variables/activity-variables.md#extractionresult) <mark style="color:red;">`Required`</mark> \
  This is a variable called ExtractionResult, which contains all the data extracted from the document.

### How it works

1. First, make sure you have the Document AI Client variable created using the [Create Document AI Client](/rpa-studio/document-ai/create-document-ai-client.md) activity, and configure it for LLM extraction.
2. Create an LLM Extractor Definition using the [Create Extractor Window](/getting-started/rpa-studio/document-ai/document-extractor/create-extractor-window.md). This definition specifies the rules and patterns for extracting data from the document.
3. Preprocess the document using the [Preprocess Document](/rpa-studio/document-ai/tasks/preprocess-document.md) activity. This step prepares the document for data extraction.
4. Finally, use the **Invoke LLM** activity and provide the Document AI Client, Extractor Definition, and Processed Document as inputs. The activity will apply the LLM model with the specified extractor definition to extract the required data from the document.
5. The extracted data will be stored in the [ExtractionResult](https://docs.visualyze.ai/getting-started/rpa-studio/variables/activity-variables#extractionresult) variable, which can be used for further processing or analysis in your workflow.

Note: It's important to ensure that the Document AI Client is properly configured, and the Extractor Definition accurately defines the data extraction rules to achieve accurate results.

By using the **Invoke LLM** activity, you can leverage the power of the Large Language Model for efficient data extraction from documents in your RPA development process.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.visualyze.ai/rpa-studio/document-ai/text/invoke-llm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
