Routing support tickets, flagging refund requests and scoring urgency are classification jobs. The usual LLM approach is to prompt a chat model for JSON, then parse it, validate it and retry when it invents a label. Ollama's decision models skip that. You send the text and a fixed set of answers, and you get back a probability for each one. The model runs locally and needs no API key.
This guide builds a small ticket triage script in TypeScript. It picks a team, detects refund requests, scores urgency and hands unclear tickets to a human.
What a decision model returns
Decision models answer three types of question through the System One API at POST /v1/systemone:
| Type | You send | You get back |
|---|---|---|
choice | 2 or more named options | The likeliest option, each option's probability and a confidence |
noul | A yes/no question | The probability of "yes", from 0 to 1 |
score | Levels ordered from lowest to highest | A probability-weighted score on that scale |
The model never writes free text, so there is nothing to parse and no label it can make up. The answer is always one of yours.
The examples use d3:2b, the 2B model in vLLM Semantic Router's d3 family, added in Ollama 0.40.11. It is a 3.1 GB download. The decision guide uses the larger nimble (9.3 GB), and the same requests work with any model in the decision list.
1. Install Ollama and pull the model
Download Ollama 0.40.11 or later, make sure the server is running, then pull the model:
ollama pull d3:2b2. Ask from the terminal
Put a ticket in a file:
Hi, I was charged twice for my October invoice. Please refund the extra payment.ollama run accepts --ask for each question. A bare --ask is a yes/no question. Follow it with --choice options to pick a label, or with --level values to score on a scale:
ollama run d3:2b --ask "Is a refund being requested?" \
--ask "Which team should handle this?" \
--choice billing="Payments and refunds" \
--choice technical="Software problems" \
--choice account="Login and account access" \
--ask "How urgent is this?" \
--level "Routine" --level "Soon" --level "Immediate" < ticket.txtIs a refund being requested? yes 100%
Which team should handle this? billing 100%
How urgent is this? Immediate 69% 1.5 / 2The urgency line shows the likeliest level (Immediate, at 69%) and the weighted score on the 0–2 scale. The score of 1.5 says the model is split between Soon and Immediate. A single label would hide that.
The first call loads the model into memory, which took about 23 seconds on an M1 Max. Later calls answer in well under a second.
3. Call the HTTP API
Applications use the same API. Put the input in state and name each question in questions:
curl -s http://localhost:11434/v1/systemone \
-H 'Content-Type: application/json' \
-d '{
"model": "d3:2b",
"state": "Our checkout has returned 500 errors since 9am.",
"questions": {
"team": {
"type": "choice",
"instructions": "Which team should handle this ticket?",
"criteria": {
"billing": "Payments and refunds",
"technical": "Software errors and outages",
"account": "Login and account access"
}
}
}
}'{
"model": "d3:2b",
"answers": {
"team": {
"type": "choice",
"choice": "technical",
"probabilities": {
"billing": 0.022564281543466028,
"technical": 0.9764256758657307,
"account": 0.0010100425908032618
},
"confidence": 0.8945841029595123
}
},
"usage": {
"input_tokens": 120,
"output_tokens": 0
},
"prompt_eval_cached_count": 0
}probabilities covers every option, not only the winner. confidence measures how strongly the model favours one option over the rest. The API reference is clear that a high confidence does not guarantee a correct answer.
4. Build the triage script
This script asks all three questions about each ticket in one request. If the team answer has a confidence below 0.6, it sends the ticket to a human instead of guessing.
const OLLAMA = process.env.OLLAMA_URL ?? "http://localhost:11434";
const MIN_CONFIDENCE = 0.6;
type Choice = { type: "choice"; choice: string; probabilities: Record<string, number>; confidence: number };
type Noul = { type: "noul"; noul: number };
type Score = { type: "score"; score: number; probabilities: Record<string, number>; confidence: number };
const questions = {
team: {
type: "choice",
instructions: "Which team should handle this ticket?",
criteria: {
billing: "Payments, invoices and refunds",
technical: "Software errors, outages and bugs",
account: "Login, passwords and account access",
},
},
refund: {
type: "noul",
instructions: "Is the customer asking for money back?",
},
urgency: {
type: "score",
instructions: "How urgently does this ticket need a response?",
criteria: [
"Routine: no time pressure",
"Soon: a customer is inconvenienced",
"Immediate: a critical service is unavailable",
],
},
};
async function triage(ticket: string) {
const res = await fetch(`${OLLAMA}/v1/systemone`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ model: "d3:2b", state: ticket, questions }),
});
if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);
const { answers } = await res.json();
const team = answers.team as Choice;
const refund = answers.refund as Noul;
const urgency = answers.urgency as Score;
return {
team: team.confidence >= MIN_CONFIDENCE ? team.choice : "human",
teamConf: team.confidence.toFixed(2),
refund: refund.noul > 0.5,
urgency: urgency.score.toFixed(2),
};
}
const tickets = [
"I was charged twice for my October invoice. Please refund one payment.",
"Checkout returns a 500 error for every customer since 9am.",
"I reset my password but the login page still says it's wrong.",
"Your app logged me out and then charged my card again. What is going on?",
"Love the new dashboard, thanks!",
];
const rows = [];
for (const ticket of tickets) {
rows.push({ ticket: ticket.slice(0, 34), ...(await triage(ticket)) });
}
console.table(rows);Node 22.18 and later run TypeScript files directly by stripping the types, so no build step is needed:
node triage.ts┌─────────┬──────────────────────────────────────┬─────────────┬──────────┬────────┬─────────┐
│ (index) │ ticket │ team │ teamConf │ refund │ urgency │
├─────────┼──────────────────────────────────────┼─────────────┼──────────┼────────┼─────────┤
│ 0 │ 'I was charged twice for my October' │ 'billing' │ '1.00' │ true │ '0.79' │
│ 1 │ 'Checkout returns a 500 error for e' │ 'technical' │ '0.84' │ false │ '1.39' │
│ 2 │ 'I reset my password but the login ' │ 'account' │ '0.88' │ false │ '0.58' │
│ 3 │ 'Your app logged me out and then ch' │ 'human' │ '0.13' │ false │ '0.96' │
│ 4 │ 'Love the new dashboard, thanks!' │ 'human' │ '0.41' │ false │ '0.01' │
└─────────┴──────────────────────────────────────┴─────────────┴──────────┴────────┴─────────┘The three clear tickets go to the right team. The outage scores highest for urgency and the thank-you note lowest. Two tickets go to a human, for different reasons:
- Ticket 3 mentions both a logout and a charge, so the probability is split between
accountandbilling. A confidence of 0.13 is the model saying it can't choose. Escalating is the right call. - Ticket 4 fits none of the teams. Forcing a label would send praise to the billing queue.
A chat model asked for JSON would return a label for these two as well, with no number to show how unsure it was. The probabilities are what make the escalation rule possible.
The whole run took under 2 seconds with the model already loaded, and repeated runs returned identical numbers.
5. Pick the threshold from your own data
The 0.6 cut-off above is a starting point, not a rule. To set it properly:
- Label 50–100 real tickets by hand.
- Run them through the script and record
confidencefor each answer. - Find the confidence below which wrong answers start to appear, and set the threshold there.
A higher threshold sends more tickets to people but makes fewer routing mistakes. Rerun the check when you change the model, the options or the wording.
When not to use it
- You need generated text. Decision models answer from your options and nothing else. Drafting a reply or summarising a thread needs a chat model, optionally with structured outputs.
- You need streaming or tool calls. The endpoint returns one JSON response. Streaming, tools and generation settings are not supported.
- Your input is long. Local requests are limited to 64 KiB of text and must fit the loaded context window. Input is never truncated. An oversized request fails with a 413 or 400 error instead.
- A 2B model is too small for the task. It handled clear tickets well here, but test it on your own data. The d3 family also comes in 4B, 9B and 27B, and Clef models can judge images.
Next steps
- Read the decision guide for image questions and cloud models.
- Check the System One API reference for limits and error codes.
- Run your labelled tickets through two or three models from the decision list and compare accuracy against speed.