Reasoning Model Types
There are two types of reasoning models:-
Controllable reasoning model: With a controllable reasoning model, you use a parameter to control whether the model reasons. If you turn reasoning on, the model generates a chain of thought before it responds. If you turn it off, the model responds without generating one.
To learn more, see
enable_thinking. - Always-on reasoning model: An always-on reasoning model always reasons, meaning it generates a chain of thought before every response. You can’t turn reasoning off.
Reasoning Parameters
You can control whether and how a model reasons with reasoning parameters, which you pass as either chat template keyword arguments or request body parameters. How you pass each depends on the parameter. To learn more, see Control a Capability. Depending on the model, you can control reasoning with some or all of the following parameters:
To see some specific examples, see Choose a Model, choose one, and see its Control Reasoning page.
enable_thinking
If the model’s controllable, you can turn reasoning on and off by setting the enable_thinking parameter to true or false, respectively. It controls whether the model reasons before it generates a response.
For complex tasks, where response quality matters, turn reasoning on. For simpler tasks, you can try turning it off to reduce token usage and response times.
To turn reasoning on, you can use the following code:
parse_reasoning
If the model supports it, you can turn parsing on and off by setting the parse_reasoning parameter to true or false, respectively. It controls whether reasoning’s parsed in the response.
Without parsing, a reasoning model returns its chain of thought alongside the rest of the response, and usually separates the two with some kind of delimiter. FriendliAI’s parser uses this delimiter to separate them; if there’s no delimiter, the parser can’t separate the two. If you turn parsing on, reasoning’s parsed into both reasoning and reasoning_content, separate from content.
To turn parsing on, you can use the following code:
include_reasoning
If you turn parsing on, you can include or exclude reasoning by setting the include_reasoning parameter to true or false, respectively. It controls whether the reasoning’s included in the response.
If you need reasoning content (for example, to display to users), include it in the response. If you don’t, exclude it. Note that your choice doesn’t change the number of tokens the model uses to generate a response. It’s the same, whether or not you include reasoning.
To include reasoning, you can use the following code:
reasoning_effort
If the model supports it, you can set the model’s reasoning effort by setting the reasoning_effort parameter to a value the model supports. It controls the model’s reasoning effort for each response.
The greater the reasoning effort, the longer the chain of thought. On complex tasks, these longer chains of thought improve response quality. Note that it also increases the number of completion tokens and response times.
To set the reasoning effort to a supported value, such as high, you can use the following code:
reasoning_budget
If the model supports it, you can set the model’s reasoning budget by setting the reasoning_budget parameter to an integer. It controls the model’s reasoning budget for each response.
The reasoning budget is the maximum number of reasoning tokens the model can use to generate a response. When the model reaches the budget, it stops thinking — sometimes mid-thought. For this reason, choose a budget thoughtfully.
To set the reasoning budget to 10,000 tokens, you can use the following code:
clear_thinking
If the model supports it, you can clear or preserve reasoning by setting the clear_thinking parameter to true or false, respectively. It controls whether reasoning’s cleared from the model’s context window.
If reasoning matters to your workflow or use case, you can preserve it and add it to the model’s context window. Otherwise, you can clear it. Note that preserving reasoning increases token usage.
To clear reasoning, you can use the following code: