Skip to main content

Reasoning & Thinking Capabilities

For reasoning-capable models (such as deepseek-r1 or thinking configurations), GoingMerry manages the extraction and rendering of internal thinking cycles.


1. Controlling Thinking Tokens

By default, thinking models output their chain-of-thought inside <think> block tags prior to generating their final answer.

You can configure thinking behavior in the request body:

  • think (boolean/string, optional):
    • true (default): Return thinking tokens.
    • false: Omit thinking tokens entirely, outputting only the final answer.

curl Example (Omitting thinking)

curl http://localhost:11434/api/generate -d '{
"model": "deepseek-r1:8b",
"prompt": "Why is prime factorization hard?",
"stream": false,
"think": false
}'

2. Parsing Thinking Output

When streaming response chunks, thinking tokens are marked in the JSON payload:

{"model":"deepseek-r1:8b","response":"<think>\n","done":false}
{"model":"deepseek-r1:8b","response":"Factorization","done":false}
...
{"model":"deepseek-r1:8b","response":"\n</think>\n","done":false}
{"model":"deepseek-r1:8b","response":"Prime factorization is...","done":true}

You can capture and format the block separately in your developer interface (e.g. folding it inside an accordion block).