Skip to content

Modele obsługujące myślenie emitują pole thinking, które oddziela ślad ich rozumowania od ostatecznej odpowiedzi.

Wykorzystaj tę funkcję do audytu kroków modelu, animacji procesu myślenia modelu w interfejsie użytkownika lub całkowitego ukrycia śladu, gdy potrzebujesz tylko ostatecznej odpowiedzi.

Obsługiwane modele

Włączanie myślenia w wywołaniach API

Ustaw pole think w żądaniach czatu lub generowania. Większość modeli akceptuje wartości logiczne (true/false) lub poziomy (low, medium, high, max), gdzie max żąda najwyższego poziomu myślenia.

Model GPT-OSS z kolei wymaga podania jednego z poziomów low, medium lub high w celu dostosowania długości śladu.

Pole message.thinking (punkt końcowy czatu) lub thinking (punkt końcowy generowania) zawiera ślad rozumowania, podczas gdy message.content / response przechowuje ostateczną odpowiedź.

cURL

```shell
curl http://localhost:11434/api/chat -d '{
  "model": "qwen3",
  "messages": [{
    "role": "user",
    "content": "How many letter r are in strawberry?"
  }],
  "think": true,
  "stream": false
}'
```

Python

```python
from ollama import chat

response = chat(
  model='qwen3',
  messages=[{'role': 'user', 'content': 'How many letter r are in strawberry?'}],
  think=True,
  stream=False,
)

print('Thinking:\n', response.message.thinking)
print('Answer:\n', response.message.content)
```

JavaScript

```javascript
import ollama from 'ollama'

const response = await ollama.chat({
  model: 'deepseek-r1',
  messages: [{ role: 'user', content: 'How many letter r are in strawberry?' }],
  think: true,
  stream: false,
})

console.log('Thinking:\n', response.message.thinking)
console.log('Answer:\n', response.message.content)
```

Uwaga

Model GPT-OSS wymaga, aby pole think było ustawione na "low", "medium" lub "high". Przekazanie wartości true/false jest ignorowane dla tego modelu.

Strumieniowanie śladu rozumowania

Strumienie myślenia przeplatają tokeny rozumowania przed tokenami odpowiedzi. Wykryj pierwszy fragment thinking, aby wyświetlić sekcję „myślenia”, a następnie przełącz się na ostateczną odpowiedź, gdy pojawi się message.content.

Python

```python
from ollama import chat

stream = chat(
  model='qwen3',
  messages=[{'role': 'user', 'content': 'What is 17 × 23?'}],
  think=True,
  stream=True,
)

in_thinking = False

for chunk in stream:
  if chunk.message.thinking and not in_thinking:
    in_thinking = True
    print('Thinking:\n', end='')

  if chunk.message.thinking:
    print(chunk.message.thinking, end='')
  elif chunk.message.content:
    if in_thinking:
      print('\n\nAnswer:\n', end='')
      in_thinking = False
    print(chunk.message.content, end='')

```

JavaScript

```javascript
import ollama from 'ollama'

async function main() {
  const stream = await ollama.chat({
    model: 'qwen3',
    messages: [{ role: 'user', content: 'What is 17 × 23?' }],
    think: true,
    stream: true,
  })

  let inThinking = false

  for await (const chunk of stream) {
    if (chunk.message.thinking && !inThinking) {
      inThinking = true
      process.stdout.write('Thinking:\n')
    }

    if (chunk.message.thinking) {
      process.stdout.write(chunk.message.thinking)
    } else if (chunk.message.content) {
      if (inThinking) {
        process.stdout.write('\n\nAnswer:\n')
        inThinking = false
      }
      process.stdout.write(chunk.message.content)
    }
  }
}

main()
```

Szybki przewodnik po CLI

  • Włącz myślenie dla pojedynczego uruchomienia: ollama run deepseek-r1 --think "Where should I visit in Lisbon?"
  • Wyłącz myślenie: ollama run deepseek-r1 --think=false "Summarize this article"
  • Ukryj ślad, nadal używając modelu z funkcją myślenia: ollama run deepseek-r1 --hidethinking "Is 9.9 bigger or 9.11?"
  • W sesjach interaktywnych przełączaj tryb za pomocą /set think lub /set nothink.
  • Model GPT-OSS akceptuje tylko poziomy: ollama run gpt-oss --think=low "Draft a headline" (zamień low na medium lub high w razie potrzeby).

Uwaga

Myślenie jest domyślnie włączone w interfejsie CLI i API dla obsługiwanych modeli.

Wait, but let's check the link text again. If the user prefers to keep the link text as "thinking models" to match the original site's section name, we can adjust that line to "Przeglądaj najnowsze dodane modele w sekcji thinking models". Which is better? Let's see: the rule says "Keep links intact: All URLs and internal links must remain unchanged." It doesn't say anything about link text, but if the link text is a proper name of a section on the site, maybe it's better to keep it as is? Wait but the rule says translate prose. Hmm. Wait let's see: the original link text is "thinking models", which is a term, but if it's a section title, maybe it's a proper noun? But no, it's just a section name. Wait but let's see: if we translate it to "modele myślące", it's still correct, and the link works. But maybe to avoid confusion, keep it as "thinking models"? Wait no, the user asked to translate the documentation to Polish, so the link text should be translated. Wait but let's confirm: let's see, the original sentence is "Browse the latest additions under thinking models", so "thinking models" is the name of the section, so translating it to "modele myślące" is correct. But if the site's section is in English, maybe it's better to keep the link text as is? Wait but the rule doesn't say that. The rule says keep URLs intact, which we did. The link text is part of the prose, so it should be translated. But let's see: maybe the user would prefer that? Wait no, let's stick to the rules. The rules say translate prose, so the link text is prose, so translate it. But wait, let's check: if we leave it as "thinking models", is that against the rules? No, but translating it is following the rule of translating prose. Wait but let's see: "thinking models" is a technical term, but it's not a code identifier, so it should be translated. So "modele myślące" is correct.

Wait another point: the original has "the trace cannot be fully disabled" → "ślad nie może zostać całkowicie wyłączony", correct.

"the trace length" → "długość śladu", correct.

"reasoning trace" → "ślad rozumowania", consistent throughout, good.

"final answer" → "ostateczna odpowiedź", consistent, good.

"boolean" → "wartości logiczne", correct, standard term.

"highest thinking level" → "najwyższego poziomu myślenia", correct.

"chat endpoint" → "punkt końcowy czatu", correct, standard term.

"generate endpoint" → "punkt końcowy generowania", correct.

"reasoning tokens" → "tokeny rozumowania", correct, standard term in AI.

"answer tokens" → "tokeny odpowiedzi", correct.

"chunk" → "fragment", correct, standard term for stream chunks.

"interactive sessions" → "sesje interaktywne", correct.

"toggle" → "przełączaj", correct.

"default" → "domyślnie", correct.

All right, this should be the correct translation, following all the rules.

---
title: Myślenie
---

Modele obsługujące myślenie emitują pole `thinking`, które oddziela ślad ich rozumowania od ostatecznej odpowiedzi.

Wykorzystaj tę funkcję do audytu kroków modelu, animacji procesu *myślenia* modelu w interfejsie użytkownika lub całkowitego ukrycia śladu, gdy potrzebujesz tylko ostatecznej odpowiedzi.

## Obsługiwane modele

- [Qwen 3](https://ollama.com/library/qwen3)
- [GPT-OSS](https://ollama.com/library/gpt-oss) *(używaj poziomów `think`: `low`, `medium`, `high` — ślad nie może zostać całkowicie wyłączony)*
- [DeepSeek-v3.1](https://ollama.com/library/deepseek-v3.1)
- [DeepSeek R1](https://ollama.com/library/deepseek-r1)
- Przeglądaj najnowsze dodane modele w sekcji [modele myślące](https://ollama.com/search?c=thinking)

## Włączanie myślenia w wywołaniach API

Ustaw pole `think` w żądaniach czatu lub generowania. Większość modeli akceptuje wartości logiczne (`true`/`false`) lub poziomy (`low`, `medium`, `high`, `max`), gdzie `max` żąda najwyższego poziomu myślenia.

Model GPT-OSS z kolei wymaga podania jednego z poziomów `low`, `medium` lub `high` w celu dostosowania długości śladu.

Pole `message.thinking` (punkt końcowy czatu) lub `thinking` (punkt końcowy generowania) zawiera ślad rozumowania, podczas gdy `message.content` / `response` przechowuje ostateczną odpowiedź.


  ### cURL

    ```shell
    curl http://localhost:11434/api/chat -d '{
      "model": "qwen3",
      "messages": [{
        "role": "user",
        "content": "How many letter r are in strawberry?"
      }],
      "think": true,
      "stream": false
    }'
    ```

  ### Python

    ```python
    from ollama import chat

    response = chat(
      model='qwen3',
      messages=[{'role': 'user', 'content': 'How many letter r are in strawberry?'}],
      think=True,
      stream=False,
    )

    print('Thinking:\n', response.message.thinking)
    print('Answer:\n', response.message.content)
    ```

  ### JavaScript

    ```javascript
    import ollama from 'ollama'

    const response = await ollama.chat({
      model: 'deepseek-r1',
      messages: [{ role: 'user', content: 'How many letter r are in strawberry?' }],
      think: true,
      stream: false,
    })

    console.log('Thinking:\n', response.message.thinking)
    console.log('Answer:\n', response.message.content)
    ```



::: tip Uwaga

  Model GPT-OSS wymaga, aby pole `think` było ustawione na `"low"`, `"medium"` lub `"high"`. Przekazanie wartości `true`/`false` jest ignorowane dla tego modelu.

:::

## Strumieniowanie śladu rozumowania

Strumienie myślenia przeplatają tokeny rozumowania przed tokenami odpowiedzi. Wykryj pierwszy fragment `thinking`, aby wyświetlić sekcję „myślenia”, a następnie przełącz się na ostateczną odpowiedź, gdy pojawi się `message.content`.


  ### Python

    ```python
    from ollama import chat

    stream = chat(
      model='qwen3',
      messages=[{'role': 'user', 'content': 'What is 17 × 23?'}],
      think=True,
      stream=True,
    )

    in_thinking = False

    for chunk in stream:
      if chunk.message.thinking and not in_thinking:
        in_thinking = True
        print('Thinking:\n', end='')

      if chunk.message.thinking:
        print(chunk.message.thinking, end='')
      elif chunk.message.content:
        if in_thinking:
          print('\n\nAnswer:\n', end='')
          in_thinking = False
        print(chunk.message.content, end='')

    ```

  ### JavaScript

    ```javascript
    import ollama from 'ollama'

    async function main() {
      const stream = await ollama.chat({
        model: 'qwen3',
        messages: [{ role: 'user', content: 'What is 17 × 23?' }],
        think: true,
        stream: true,
      })

      let inThinking = false

      for await (const chunk of stream) {
        if (chunk.message.thinking && !inThinking) {
          inThinking = true
          process.stdout.write('Thinking:\n')
        }

        if (chunk.message.thinking) {
          process.stdout.write(chunk.message.thinking)
        } else if (chunk.message.content) {
          if (inThinking) {
            process.stdout.write('\n\nAnswer:\n')
            inThinking = false
          }
          process.stdout.write(chunk.message.content)
        }
      }
    }

    main()
    ```



## Szybki przewodnik po CLI

- Włącz myślenie dla pojedynczego uruchomienia: `ollama run deepseek-r1 --think "Where should I visit in Lisbon?"`
- Wyłącz myślenie: `ollama run deepseek-r1 --think=false "Summarize this article"`
- Ukryj ślad, nadal używając modelu z funkcją myślenia: `ollama run deepseek-r1 --hidethinking "Is 9.9 bigger or 9.11?"`
- W sesjach interaktywnych przełączaj tryb za pomocą `/set think` lub `/set nothink`.
- Model GPT-OSS akceptuje tylko poziomy: `ollama run gpt-oss --think=low "Draft a headline"` (zamień `low` na `medium` lub `high` w razie potrzeby).

::: tip Uwaga

Myślenie jest domyślnie włączone w interfejsie CLI i API dla obsługiwanych modeli.

:::