Sync ollama docs from eab97e9f on 2026-10-12
This commit is contained in:
@@ -0,0 +1,165 @@
|
||||
---
|
||||
title: Decision
|
||||
description: Classify text, estimate yes/no probabilities, and score ordered criteria.
|
||||
---
|
||||
|
||||
<Note>
|
||||
Currently available locally in Ollama.
|
||||
</Note>
|
||||
|
||||
Use System One to classify text, answer yes/no questions, or score text against a rubric.
|
||||
|
||||
See the [full list of decision models](https://ollama.com/search?c=decision).
|
||||
|
||||
## Setup
|
||||
|
||||
Start [Ollama](/quickstart) v0.35.0 or later, then download [Nimble](https://ollama.com/library/nimble):
|
||||
|
||||
```shell setup.sh
|
||||
ollama pull nimble
|
||||
```
|
||||
|
||||
Nimble, Tev1, [Clef](https://ollama.com/library/clef), and [Clef Flash](https://ollama.com/library/clef-flash) are decision models. The Clef models can also judge images and require v0.35.1 or later.
|
||||
|
||||
Local requests do not need an API key.
|
||||
|
||||
## Choose a label
|
||||
|
||||
Put your input in `state` and describe the possible answers in `criteria`:
|
||||
|
||||
```shell choice.sh
|
||||
curl http://localhost:11434/v1/systemone \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"model": "nimble",
|
||||
"state": "Our checkout has returned 500 errors since 9am.",
|
||||
"questions": {
|
||||
"label": {
|
||||
"type": "choice",
|
||||
"instructions": "Which label fits this ticket?",
|
||||
"criteria": {
|
||||
"billing": "Payments and refunds",
|
||||
"bug": "Software errors",
|
||||
"account": "Login and account access"
|
||||
}
|
||||
}
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
Example response:
|
||||
|
||||
```json
|
||||
{
|
||||
"model": "nimble",
|
||||
"answers": {
|
||||
"label": {
|
||||
"type": "choice",
|
||||
"choice": "bug",
|
||||
"probabilities": {"billing": 0.0125, "bug": 0.9781, "account": 0.0093},
|
||||
"confidence": 0.8906
|
||||
}
|
||||
},
|
||||
"usage": {"input_tokens": 174, "output_tokens": 1}
|
||||
}
|
||||
```
|
||||
|
||||
## Judge an image
|
||||
|
||||
[Clef](https://ollama.com/library/clef) and [Clef Flash](https://ollama.com/library/clef-flash) read images alongside the state. Send base64-encoded PNG, JPEG, or WebP files in `images`; they are shared by all questions, in request order. URLs and data URLs are not accepted. `state` is still required — it holds the context for the decision.
|
||||
|
||||
```shell image.sh
|
||||
curl http://localhost:11434/v1/systemone \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"model": "clef-flash",
|
||||
"state": "A user took this screenshot and wants to know what it shows.",
|
||||
"images": ["<base64-encoded image>"],
|
||||
"questions": {
|
||||
"has_ollama": {
|
||||
"type": "noul",
|
||||
"instructions": "Does this image contain Ollama?"
|
||||
},
|
||||
"app": {
|
||||
"type": "choice",
|
||||
"instructions": "Which application is shown in this screenshot?",
|
||||
"criteria": {
|
||||
"vscode": "Visual Studio Code",
|
||||
"terminal": "A terminal emulator",
|
||||
"browser": "A web browser",
|
||||
"other": "A different application"
|
||||
}
|
||||
}
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
Example response:
|
||||
|
||||
```json
|
||||
{
|
||||
"model": "clef-flash",
|
||||
"answers": {
|
||||
"has_ollama": {"type": "noul", "noul": 0.959},
|
||||
"app": {
|
||||
"type": "choice",
|
||||
"choice": "vscode",
|
||||
"probabilities": {"vscode": 0.966, "other": 0.017, "browser": 0.010, "terminal": 0.007},
|
||||
"confidence": 0.868
|
||||
}
|
||||
},
|
||||
"usage": {"input_tokens": 677, "output_tokens": 0}
|
||||
}
|
||||
```
|
||||
|
||||
## Question types
|
||||
|
||||
| Type | Criteria | Result |
|
||||
| --- | --- | --- |
|
||||
| `choice` | 2–26 named options with descriptions | The most likely option and each option's probability |
|
||||
| `noul` | Descriptions for `"false"` and `"true"` | The probability of `true`, from 0 to 1 |
|
||||
| `score` | 2–26 descriptions, ordered from lowest to highest | The probability-weighted average of the zero-based levels |
|
||||
|
||||
For the urgency criteria below:
|
||||
|
||||
```text
|
||||
score = 0 × P(Routine) + 1 × P(Soon) + 2 × P(Immediate)
|
||||
```
|
||||
|
||||
For `choice` and `score`, `confidence` measures how strongly the model favors one answer over the others, from 0 to 1. A higher value does not guarantee the answer is correct.
|
||||
|
||||
## Ask multiple questions
|
||||
|
||||
Combine question types in one request. Here, both questions use the same ticket:
|
||||
|
||||
```shell multiple.sh
|
||||
curl http://localhost:11434/v1/systemone \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"model": "nimble",
|
||||
"state": {"ticket": "I was charged twice. Please refund the extra payment."},
|
||||
"questions": {
|
||||
"refund": {
|
||||
"type": "noul",
|
||||
"instructions": "Is the customer requesting a refund?",
|
||||
"criteria": {
|
||||
"false": "No refund is requested",
|
||||
"true": "The customer requests a refund"
|
||||
}
|
||||
},
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
This returns a refund probability of `0.9989` and an urgency score of `0.8308` on the 0–2 scale (rounded). Results can vary with the model and configuration.
|
||||
|
||||
See the [API reference](/api/systemone) for request fields, limits, errors, and token usage.
|
||||
@@ -6,21 +6,46 @@ Thinking-capable models emit a `thinking` field that separates their reasoning t
|
||||
|
||||
Use this capability to audit model steps, animate the model *thinking* in a UI, or hide the trace entirely when you only need the final response.
|
||||
|
||||
## Supported models
|
||||
See the [full list of thinking models](https://ollama.com/search?c=thinking).
|
||||
|
||||
- [Qwen 3](https://ollama.com/library/qwen3)
|
||||
- [GPT-OSS](https://ollama.com/library/gpt-oss) *(use `think` levels: `low`, `medium`, `high` — the trace cannot be fully disabled)*
|
||||
- [DeepSeek-v3.1](https://ollama.com/library/deepseek-v3.1)
|
||||
- [DeepSeek R1](https://ollama.com/library/deepseek-r1)
|
||||
- Browse the latest additions under [thinking models](https://ollama.com/search?c=thinking)
|
||||
## Discover a model's thinking controls
|
||||
|
||||
Thinking controls vary by model. Use `/api/show` to discover the values a model supports and the value Ollama uses by default:
|
||||
|
||||
```shell
|
||||
curl http://localhost:11434/api/show -d '{
|
||||
"model": "gpt-oss"
|
||||
}'
|
||||
```
|
||||
|
||||
The response includes a top-level `thinking` object:
|
||||
|
||||
```json
|
||||
{
|
||||
"thinking": {
|
||||
"values": ["low", "medium", "high"],
|
||||
"default": "medium"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `values` can contain booleans (`true` or `false`) for on/off controls. It can also contain model-defined strings for named levels.
|
||||
- `default` is used when `think` is not set.
|
||||
- `values: [false]` means the model does not support thinking.
|
||||
- If `thinking` is omitted, the model has no thinking metadata. The model might conduct thinking based on its existing behavior.
|
||||
|
||||
## Enable thinking in API calls
|
||||
|
||||
Set the `think` field on chat or generate requests. Most models accept booleans (`true`/`false`) or levels (`low`, `medium`, `high`, `max`), where `max` requests the highest thinking level.
|
||||
Set the `think` field on a chat or generate request:
|
||||
|
||||
GPT-OSS instead expects one of `low`, `medium`, or `high` to tune the trace length.
|
||||
- `true`: request thinking output.
|
||||
- `false`: request no thinking output, if the model permits it.
|
||||
- `null`: use the model default.
|
||||
- A string: select a supported level from `thinking.values`. Use the exact value from `/api/show`. Numbers are not supported.
|
||||
|
||||
The `message.thinking` (chat endpoint) or `thinking` (generate endpoint) field contains the reasoning trace while `message.content` / `response` holds the final answer.
|
||||
If the model resolves named levels from `/api/show` metadata, Ollama applies supported names exactly. Unsupported names use the model default.
|
||||
|
||||
The reasoning output and answer use separate fields. Chat returns `message.thinking` and `message.content`. Generate returns `thinking` and `response`.
|
||||
|
||||
<Tabs>
|
||||
<Tab title="cURL">
|
||||
@@ -68,10 +93,6 @@ The `message.thinking` (chat endpoint) or `thinking` (generate endpoint) field c
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
<Note>
|
||||
GPT-OSS requires `think` to be set to `"low"`, `"medium"`, or `"high"`. Passing `true`/`false` is ignored for that model.
|
||||
</Note>
|
||||
|
||||
## Stream the reasoning trace
|
||||
|
||||
Thinking streams interleave reasoning tokens before answer tokens. Detect the first `thinking` chunk to render a "thinking" section, then switch to the final reply once `message.content` arrives.
|
||||
@@ -141,13 +162,3 @@ Thinking streams interleave reasoning tokens before answer tokens. Detect the fi
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## CLI quick reference
|
||||
|
||||
- Enable thinking for a single run: `ollama run deepseek-r1 --think "Where should I visit in Lisbon?"`
|
||||
- Disable thinking: `ollama run deepseek-r1 --think=false "Summarize this article"`
|
||||
- Hide the trace while still using a thinking model: `ollama run deepseek-r1 --hidethinking "Is 9.9 bigger or 9.11?"`
|
||||
- Inside interactive sessions, toggle with `/set think` or `/set nothink`.
|
||||
- GPT-OSS only accepts levels: `ollama run gpt-oss --think=low "Draft a headline"` (replace `low` with `medium` or `high` as needed).
|
||||
|
||||
<Note>Thinking is enabled by default in the CLI and API for supported models.</Note>
|
||||
|
||||
Reference in New Issue
Block a user