Examples of OpenAI action
This action enables the extraction of text or strings from images. By default, the output is returned in JSON format. It is possible to customize the prompt and specify the desired output format. Additionally, if needed, the exact text can be extracted as plain text.
#
How will the action be performed?Data:
Parameter | Type | Value |
---|---|---|
image | input parameter | ***Path to the image file. Examples: "E:\user\files\Sample.jpg" or %|Sample.jpg|% |
prompt | optional parameter | ***Enter your prompt*** |
output format | optional parameter | Enter your output format. It can be json, list, csv, html. Examples:|
extract image to data | utility action | ***The variable name that will store the extracted strings. By default the output will be a JSON format.*** |
#
Default Format ScenarioIf no prompt or output format is specified, the data will be returned in JSON format.
Data:
Parameter | Type | Value |
---|---|---|
image | input parameter | "E:\user\files\Sample.jpg" |
extract image to data | utility action | my_text |
Output will be in this JSON structure:
#
Example:Input:
Output:
#
Another example related to Invoice/Bill:Input:
Output:
#
For Extracting Exact Text ScenarioTo extract exact text from an image, specify "exact text" in the output format, and it will be returned as plain text. Additionally, the output will be saved into the specified variable, which can later be used as a Python variable.
The prompt we use
"Extract the text from the given image as accurately as possible, including all words, punctuation, and formatting. Ensure that no text is omitted or altered during the extraction process. Return the data in plain text."
Data:
Parameter | Type | Value |
---|---|---|
image | input parameter | "E:\user\files\Sample.jpg" |
output format | optional parameter | exact text |
extract image to data | utility action | my_text |
#
Example 1:Input:
Output:
#
Example 2:Input:
Output:
#
User's Custom Prompt and Output Format ScenarioIn this action, users can define their prompt, output format or both. The output will be generated according to the user's instructions.
note
Output format can be JSON, LIST, HTML, CSV.
1. If the user specifies only the prompt, the output will be generated based on the given prompt.
Data:
Parameter | Type | Value |
---|---|---|
image | input parameter | "E:\users\files\Invoice.jpg" |
prompt | Optional parameter | Return only Total price |
extract image to data | utility action | my_text |
#
Example 1:Input:
Output:
my_text = "$154.06"
Data:
Parameter | Type | Value |
---|---|---|
image | input parameter | "E:\user\files\card.jpg" |
prompt | Optional parameter | Return only id and name in html format. |
extract image to data | utility action | my_text |
#
Example 2:Input:
Output:
2. If the user specifies only the output format, the default prompt will be used, and the output format will follow the user-defined format. Output format can be JSON, LIST, HTML, CSV.
Default Prompt: The system is a highly accurate text extraction tool designed to process images and extract textual content. Its primary goal is to extract the text exactly as it appears in the image, including symbols, numbers, and special characters, without interpreting or altering its meaning. The output ensures the original order is preserved and includes all text without modifications or exclusions. When metadata such as dates, amounts, or specific fields is clearly identifiable, the extracted data is structured into nested JSON objects.
Data Table:
Row 1:
Parameter: image
Type: input parameter
Value: "E:\user\files\Invoice.jpg"
Row 2:
Parameter: output format
Type: Optional parameter
Value:
Row 3:
Parameter: extract image to data
Type: utility action
Value: my_text
#
Example 1:Input:
Output:
Data:
Parameter | Type | Value |
---|---|---|
image | input parameter | "E:\user\files\card.jpg" |
output format | Optional parameter | [id, name, iss date, exp date] |
extract image to data | utility action | my_text |
#
Example 2:Input:
Output:
my_text = ["123456789-005", "NAME SURNAME", "12.03.2012", "12.08.2020"]
3. If the user specifies both the prompt and the output format, the output will be generated based on the given prompt and format.
Data Table:
Row 1:
Parameter: image
Type: input parameter
Value: "E:\user\files\card.jpg"
Row 2:
Parameter: prompt
Type: Optional parameter
Value: Extract text from the image.
Row 3:
Parameter: output format
Type: Optional parameter
Value:
Row 4:
Parameter: extract image to data
Type: utility action
Value: my_text
#
Example 1:Input:
Output:
Data:
Parameter | Type | Value |
---|---|---|
image | input parameter | "E:\user\files\invoice.jpg" |
prompt | Optional parameter | Return only total information. |
output format | Optional parameter | ["text1", "text2"] |
extract image to data | utility action | my_text |
#
Example 2:Input:
Output: