Input Data Access
Learn how to access and work with input data in steps.
In Code Steps
In code steps, input values can be accessed directly using the input object. No curly braces are required.
In Non-Code Steps
In non-code steps like model messages, HTTP request URLs, request bodies, and other configuration fields, input values can be referenced using double curly braces.
Accessing Configuration Fields
Configuration fields can be accessed the same way as regular input fields, using the input
object. The values from both regular input fields and configuration fields are merged into a single object at runtime.
In Code Steps
Configuration values can be accessed directly:
In Non-Code Steps
Use double curly braces to reference configuration values:
File Handling Fundamentals
Learn how to work with files in your workflow steps, including accessing file contents and images.
Accessing File Contents and Images
To access file contents or images, you must enable the appropriate settings in the file field settings:
Without these properties enabled, when you try to access contents or images, they will be empty.
In Model Messages
When working with file inputs in model messages, there are two ways to access the document data:
-
Using
:contents
- This extracts and passes the text content of the document to the model -
Using
:images
- This passes the actual document images/pages to the model
Cortex automatically handles converting the placeholders into the actual document data before sending to the model.
The :contents
and :images
suffixes are used only in model messages with double curly braces:
Choosing Between Contents and Images
- Use
:contents
for: Long documents where cost is a concern, very simple analysis tasks - Use
:images
for: Complex documents, forms, documents with important visual elements, when accuracy is critical
In Code Steps
Use utility functions for accessing file contents and images:
File Content Structure
When accessing file contents, you receive an array of objects. If multiple files upload is enabled, you receive an array of arrays:
Example usage for a file field with multiple uploads not enabled:
Example usage for a file field with multiple uploads enabled:
File Images Structure
When accessing file images, you receive an array of image URLs. The array is always one-dimensional, containing all image URLs from the file(s):
To get images separated by file when multiple files are enabled:
Was this page helpful?