Cortex Extract Answer
Editions
Production use of this feature is available for specific editions only. Contact our sales team for more information.
The Cortex Extract Answer transformation component lets you ask a question and extract the answer from your dataset using Snowflake Cortex. 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).
Use case
This component allows you to turn unstructured text into usable insights directly in your transformation pipeline. For example, you can use it to:
- Identify what product areas are referred to in technical support tickets.
- Extract specific details such as dates from text documents like contracts.
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.