Cortex Extract Answer
Cortex Extract Answer is a transformation component that uses Snowflake Cortex to extract an answer to a given question from a text input. The text input may be a plain-English document or a string representation of a semi-structured (JSON) data object.
You must use a Snowflake role that has been granted the SNOWFLAKE.CORTEX_USER database role. Read Required Privileges to learn more about granting this privilege.
To learn more about Snowflake Cortex, such as availability, usage quotas, managing costs, and more, read Large Language Model (LLM) Functions (Snowflake Cortex).
Properties
Name
= string
A human-readable name for the component.
Columns
= column editor
- Input Column: Select a column from your input table. The text in each row of this column will be used to provide answers to the question.
- Question: Enter a question, relating to the source column, in plain English text. For example, if the source column is a list of IT support tickets, you might ask, "What software does this issue affect?"
- Alias: Enter an alias that will be used to identify the output column.
You can ask a different question for each different input column, though you may want to consider instead using multiple Cortex Extract Answer components connected to the same input and asking one question each, if this makes your subsequent processing of the answers easier.
The answers are placed in an output column whose name is the alias you assigned to the input column you are questioning. Each answer is formatted as a JSON object with the following format:
[
{
"answer": "<answer text>",
"score": <score>
}
]
Where <answer text>
is the answer to the question, and <score>
is the model's confidence of how accurate the answer probably is. Higher scores indicate more confidence in the answer being correct.
Include Input Columns
= boolean
- Yes: Outputs both your source input columns and the answer columns. This will also include those input columns not selected in Columns.
- No: Only outputs the new answer columns.
Snowflake | Databricks | Amazon Redshift |
---|---|---|
✅ | ❌ | ❌ |