Open History to see the last commit
1---
2id: clampReasoningLevel
3title: clampReasoningLevel
4---
5
6```ts
7function clampReasoningLevel(reasoning, level): ReasoningLevel;
8```
9
10Defined in: [packages/ai/src/reasoning.ts:128](https://github.com/TanStack/ai/blob/main/packages/ai/src/reasoning.ts#L128)
11
12A level the model supports: the level itself, else the nearest supported
13level above it, else the nearest below it, else `off`. The same rule as pi.
14
15## Parameters
16
17### reasoning
18
19[`ModelReasoning`](../type-aliases/ModelReasoning.md) \| `undefined`
20
21### level
22
23[`ReasoningLevel`](../type-aliases/ReasoningLevel.md)
24
25## Returns
26
27[`ReasoningLevel`](../type-aliases/ReasoningLevel.md)