Snowflake Decision with AI_ COMPLETE¶
snowflake-decision evaluates content against a set of questions and returns structured answers through AI_COMPLETE.
It supports classification, scoring against an ordered rubric, and true-or-false assessment, with probabilities that
applications can use for routing, review, and downstream logic.
You provide a state, the text or structured data to evaluate, and a set of typed questions. The model answers each question from that state and returns the results in a single object.
Key benefits¶
- Typed answers: Return a selected option, a rubric score, or the probability that a statement is true, rather than free-form text.
- Multiple assessments per request: Classify, score, and assess the same content in one call, using separate criteria for each question.
- Confidence-based routing: Use probabilities and confidence values to route results to automated actions, human review, or a fallback.
- Table-level processing: Evaluate content across a table or query result in one SQL statement instead of issuing a separate query for each row.
Prerequisites¶
Your account must have the following configuration:
| Parameter | Requirement |
|---|---|
CORTEX_ENABLED_CROSS_REGION | Set to 'ANY_REGION'. |
ENABLE_AI_COMPLETE_JEV_ADAPTER | Required during preview. |
AI_COMPLETE_JEV_ADAPTER_MODELS_LIST | Set to 'snowflake-decision' during preview. |
Getting started¶
The following example evaluates the ticket_text column in support_tickets. For each ticket, it selects a
department, rates the customer’s frustration, and assesses whether the message conveys urgency. Note that department
uses named options, frustration uses a three-level rubric, and is_urgent uses the statement in instructions
without additional criteria.
Note
The prompt argument must be a JSON string. Use TO_JSON(...) to serialize the request object before passing it to
AI_COMPLETE.
Response shape¶
The function returns an OBJECT with an answers member. Each entry uses the question ID from the request and
contains the fields associated with that question’s type.
The following illustrative response corresponds to the questions in the getting-started example. Actual answers depend on the ticket content.
Interpreting the answers¶
- Choice:
choicecontains the most likely option. In this example, the selected department isbilling. Theprobabilitiesobject contains a value for every option, and those values sum to 1. - Score:
scoreis the probability-weighted level, not necessarily an integer. Levels are numbered from 0 in the order supplied incriteria. Here, the score is0 × 0.02 + 1 × 0.34 + 2 × 0.64 = 1.62. Thelegendmaps each level number to its description. - True-or-false assessment:
noulis the probability that the statement is true. The value0.88is a probability, not a Boolean result. Your application chooses the threshold for treating the statement as true.
Confidence¶
For choice and score, confidence is calculated as:
Here, n is the number of options or levels, and p_max is the highest returned probability. Confidence is 0 when
every option is equally likely and approaches 1 as one option dominates.
Confidence is distinct from the highest probability. In the department example, the probability of billing is 0.95,
while the calculated confidence is 0.925.
Returned numeric values are full-precision floats and are not rounded.
Question types¶
Each question defines the kind of judgment to make and, where required, the criteria to use.
| Type | Purpose | Criteria | Returned answer |
|---|---|---|---|
choice | Select one option from a fixed set. | Required. An object mapping each option key to its description. | The selected key, a probability for each option, and confidence. |
score | Evaluate content against an ordered rubric. | Required. An array of level descriptions, ordered from lowest to highest. | The probability-weighted level from 0 to n - 1, a probability for each level, a legend, and confidence. |
noul | Assess whether a statement is true. | Optional. When provided, an object with both "true" and "false" keys and their descriptions. | The probability that the statement is true. |
Usage notes¶
- The maximum request size is 256 KiB, including
state, all questions, and all criteria. Approximately 50,000 tokens is a conservative estimate, not a separate token allowance. Token count varies by content; dense JSON, code, and non-English text produce more tokens per byte. - Requests containing many questions with large option sets can fail with
model snowflake-decision could not answer this request. Split the questions across multiple calls when this occurs. - The model is optimized for throughput rather than latency. Apply AI_COMPLETE to a table or query result in one SQL statement to enable parallel row processing. Separate queries for individual rows are slower. A single call can take seconds and is not intended for latency-sensitive interactions.
- Related questions about the same state should be submitted in one call, within the request limits. Include only content relevant to those questions; unrelated material can reduce accuracy.
- Each question should address a single judgment. Decompose multi-factor decisions into separate questions and combine their answers in SQL or application code using application-defined weights.
- Questions are evaluated independently from
state. A question cannot reference another question’s answer within the same call. Dependent assessments require separate, chained calls. - Criteria should explicitly define each option or rubric level, including relevant edge cases. Include a “none of these” or “not stated” option when applicable.
- Question IDs are visible to the model and can influence answers. Use neutral identifiers such as
urgencyorq1rather than leading identifiers such asis_definitely_urgent. - Confidence values can be used to route high-confidence answers to automated actions and low-confidence answers to review or a fallback. Calibrate thresholds using a labeled sample representative of the workload.
- Returned probabilities do not reach exactly 0 or 1.
noulvalues remain within approximately 0.08–0.92. The maximum probability for a choice decreases as the number of options increases, to approximately 0.83 with 32 options. A threshold such asnoul > 0.95will not be met. - A
scorerepresents a position on an ordered rubric and can support threshold-based decisions. It is not a precise measurement and should not be interpolated to recover an exact quantity. - The model supports
choice,score, and true-or-false assessments, not free-form text generation. For extraction workflows, identify candidates using a regular expression or generative model before selecting among them with achoicequestion. - A
choicequestion supports at most 32 options. Larger candidate sets require filtering or a hierarchy of questions. - Option ordering can influence answers. Snowflake
OBJECTvalues do not preserve key order; keys supplied throughTO_JSON({...})arrive in alphabetical order. For important decisions, test answer stability by reordering or renaming options.
Limits¶
| Limit or parameter | Behavior |
|---|---|
| Prompt size | Maximum of 256 KiB for the entire JSON request. |
| Questions per request | Maximum of 32. |
Options per choice question | 2–32. |
Levels per score question | 2–10. |
| Options across all questions | Maximum of 256. Each noul question counts as 2 options; each score question counts as its number of levels. |
| Question ID | 1–64 characters matching [A-Za-z0-9_-]. |
| Streaming and guardrails | Not supported. Requests using these features are rejected. |
temperature and top_p | Ignored. |
Error handling¶
By default, a row that fails returns NULL. Pass return_error_details => TRUE to see the error message.
| Cause | Message |
|---|---|
| Invalid request, question, or limit | A validation message, such as question "q" of type score is missing criteria. |
Cross-region configuration is not ANY_REGION | model snowflake-decision requires CORTEX_ENABLED_CROSS_REGION set to 'ANY_REGION' |
| Streaming, guardrails, or an unsupported input shape | model snowflake-decision is not available... |
| The model could not produce a valid answer | model snowflake-decision could not answer this request |
| Temporary capacity issue, retried automatically | model snowflake-decision is temporarily unavailable |
| Content filter | model snowflake-decision did not return a response for this input |