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:

ParameterRequirement
CORTEX_ENABLED_CROSS_REGIONSet to 'ANY_REGION'.
ENABLE_AI_COMPLETE_JEV_ADAPTERRequired during preview.
AI_COMPLETE_JEV_ADAPTER_MODELS_LISTSet 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.

SELECT AI_COMPLETE(
    model => 'snowflake-decision',
    prompt => TO_JSON({
        'state': ticket_text,
        'questions': {
            'department': {
                'type': 'choice',
                'instructions': 'Which team should handle this?',
                'criteria': {
                    'billing': 'Payment or subscription issues',
                    'technical': 'Bugs or integration problems',
                    'sales': 'Pricing or account questions'
                }
            },
            'frustration': {
                'type': 'score',
                'instructions': 'How frustrated the customer appears',
                'criteria': [
                    'Calm',
                    'Frustrated but civil',
                    'Very angry'
                ]
            },
            'is_urgent': {
                'type': 'noul',
                'instructions': 'The message conveys urgency'
            }
        }
    })
) AS decision
FROM support_tickets;

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.

{
  "answers": {
    "department": {
      "type": "choice",
      "choice": "billing",
      "confidence": 0.925,
      "probabilities": {
        "billing": 0.95,
        "technical": 0.04,
        "sales": 0.01
      }
    },
    "frustration": {
      "type": "score",
      "score": 1.62,
      "legend": {
        "0": "Calm",
        "1": "Frustrated but civil",
        "2": "Very angry"
      },
      "confidence": 0.46,
      "probabilities": {
        "0": 0.02,
        "1": 0.34,
        "2": 0.64
      }
    },
    "is_urgent": {
      "type": "noul",
      "noul": 0.88
    }
  }
}

Interpreting the answers

  • Choice: choice contains the most likely option. In this example, the selected department is billing. The probabilities object contains a value for every option, and those values sum to 1.
  • Score: score is the probability-weighted level, not necessarily an integer. Levels are numbered from 0 in the order supplied in criteria. Here, the score is 0 × 0.02 + 1 × 0.34 + 2 × 0.64 = 1.62. The legend maps each level number to its description.
  • True-or-false assessment: noul is the probability that the statement is true. The value 0.88 is 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:

confidence = (n * p_max - 1) / (n - 1)

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.

TypePurposeCriteriaReturned answer
choiceSelect 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.
scoreEvaluate 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.
noulAssess 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 urgency or q1 rather than leading identifiers such as is_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. noul values 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 as noul > 0.95 will not be met.
  • A score represents 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 a choice question.
  • A choice question supports at most 32 options. Larger candidate sets require filtering or a hierarchy of questions.
  • Option ordering can influence answers. Snowflake OBJECT values do not preserve key order; keys supplied through TO_JSON({...}) arrive in alphabetical order. For important decisions, test answer stability by reordering or renaming options.

Limits

Limit or parameterBehavior
Prompt sizeMaximum of 256 KiB for the entire JSON request.
Questions per requestMaximum of 32.
Options per choice question2–32.
Levels per score question2–10.
Options across all questionsMaximum of 256. Each noul question counts as 2 options; each score question counts as its number of levels.
Question ID1–64 characters matching [A-Za-z0-9_-].
Streaming and guardrailsNot supported. Requests using these features are rejected.
temperature and top_pIgnored.

Error handling

By default, a row that fails returns NULL. Pass return_error_details => TRUE to see the error message.

CauseMessage
Invalid request, question, or limitA validation message, such as question "q" of type score is missing criteria.
Cross-region configuration is not ANY_REGIONmodel snowflake-decision requires CORTEX_ENABLED_CROSS_REGION set to 'ANY_REGION'
Streaming, guardrails, or an unsupported input shapemodel snowflake-decision is not available...
The model could not produce a valid answermodel snowflake-decision could not answer this request
Temporary capacity issue, retried automaticallymodel snowflake-decision is temporarily unavailable
Content filtermodel snowflake-decision did not return a response for this input