Open Agent Loops
API Reference

injectReasoningKwargs

@open-agent-loops/core


function injectReasoningKwargs(body, mode?): Record<string, unknown>;

Defined in: providers/reasoning-kwargs.ts:363

Merge the derived chat_template_kwargs into an OpenAI chat-completions request body, keyed by its own model field. The seam a proxy uses to inject thinking control without the client knowing the per-family dialect.

Returns the body unchanged when it already carries an explicit chat_template_kwargs (the caller's choice always wins), has no string model, or the model is unknown/non-reasoning. Otherwise returns a shallow copy with the kwargs added — the input is never mutated.

Parameters

ParameterTypeDefault valueDescription
bodyRecord<string, unknown>undefinedThe parsed request body.
modeThinkingMode"auto"Desired thinking state; defaults to "auto" (family default).

Returns

Record<string, unknown>

The body to forward upstream.

On this page