Skip to content

stripReasoning

function stripReasoning(messages): ChatMessage[];

Defined in: core/src/types.ts:467

Prepare a history for a thinking-DISABLED turn: strip reasoning from every assistant message.

The chain-of-thought belongs only to thinking turns. A provider that requires it replayed while thinking is ON (DeepSeek) rejects it when thinking is off. This is exactly the shape of a forced-submit salvage turn, where a run reasons through its whole investigation and then drops thinking to serialize what it already found.

Returns a shallow-cleaned copy; the caller’s array is left untouched.

Parameter Type
messages readonly ChatMessage[]

ChatMessage[]