Primitives
Every question you ask a decision model uses one of three types:-
Noul: A yes/no question that returns a probability between 0 and 1. Think of it as a boolean on a sliding scale. “Is this message spam?” might return
0.92, meaning a 0.92 probability that the answer is yes. -
Choice: A pick-one-from-many question that returns a probability distribution over named options. “Which department should handle this?” might return
{"billing": 0.65, "technical": 0.30, "account": 0.05}. -
Score: A rate-on-a-scale question that returns a probability-weighted position on an ordered rubric. “How urgent is this?” with three levels might return a score of
1.85(between “Medium” and “High”), with a probability distribution over each level.
Noul vs Score: A Noul at 0.5 means maximum uncertainty between yes and no. It says nothing about degree or intensity. If you want to measure degree (skill level, frustration, severity), use a Score with defined levels. If you need a yes/no gate, use a Noul.
When the answer could fit more than one type, think about what your code does next. If it branches on a category, use a Choice. If it compares against a threshold on a continuum, use a Score. If it gates on a boolean, use a Noul.
Setup
- Go to console.liquid.ai. If you don’t have an account yet, register and join an organization.
- Navigate to Dashboard > API Keys.
- Create a new key and copy it. Keys are prefixed with
liquid_.
Your First Call
A single API call contains three things:- Model: which decision model to use.
- State: the context the model should evaluate. This can be plain text (a customer message, an email, a log entry) or a JSON object with structured fields.
- Questions: one or more typed questions, each with a name, a type, and instructions. Choice and Score questions also take criteria that define the options or levels. You can ask multiple questions in the same call, and the model evaluates them all at once.
- cURL
- Python
- TypeScript
answers.is_complaint.noul: The probability that the answer is “yes.” Here,0.999means a 0.999 probability that this is a complaint.usage.output_tokens: Always0. Decision models do not generate tokens.usage.input_tokens: The total tokens consumed to evaluate the state and questions.
confidence value.
Usage Examples
Noul
A Noul question returns a single probability between 0 and 1. Your code receives a float that you can threshold to make a binary decision, use as a weight, or pass directly to downstream logic. Values near 0 or 1 express a clear answer; values near 0.5 express genuine uncertainty.- cURL
- Python
- TypeScript
answers field):
Choice
A Choice question returns the selected option, a probability distribution over all options, and aconfidence value. confidence summarizes how clear-cut the answer is: high when one option clearly wins, lower when the probability is spread across several options. The distribution tells you not just the top pick but how much probability mass sits on the runner-up, which is useful for flagging ambiguous cases or routing to a fallback.
- cURL
- Python
- TypeScript
answers field):
Score
A Score question returns a continuous value across an ordered rubric you define, plus the probability distribution over each level. The value is the probability-weighted position on the scale: if you define four levels (0 through 3), a score of2.9995 means the model places nearly all weight on the top level.
- cURL
- Python
- TypeScript
answers field):
Combining All Three Primitives
You can ask multiple questions of different types in the same call. The model evaluates all of them at once against the same state, so you get a complete decision in one round trip. This is useful when a single piece of input needs to be classified, routed, and prioritized together.- cURL
- Python
- TypeScript
answers field):
When to Use Decision Models
Decision models are a good fit when the answer is a structured decision: classification, categorization, routing (tickets, emails, requests), scoring, triage, content moderation, guardrails and safety checks, LLM-as-judge replacement, agent tool-call approval, and model routing or cascades. Use a language model instead for free-form text generation, creative writing, multi-turn conversation, complex multi-step reasoning, open-ended Q&A, summarization, and code generation. To move existing LLM calls to d1, see the Decision Model Guide.Next Steps
- Decision Model Guide for migrating LLM classification, routing, and scoring calls to d1
- Model Library for all available Liquid AI models