Skip to content

toOpenAIMessages

function toOpenAIMessages(messages, provider?): unknown[];

Defined in: core/src/providers/openai.ts:413

Assistant turns carry reasoning_content when the history has it. Thinking providers require the prior turn’s chain-of-thought replayed on a turn that made a tool call. A caller running a turn with thinking OFF must strip it first (stripReasoning); the two cannot be mixed.

Parameter Type Default value
messages readonly ChatMessage[] undefined
provider string "openai"

unknown[]