MCPcopy Create free account
hub / github.com/MatterAIOrg/OrbCode / stripReasoningDetails

Function stripReasoningDetails

src/api/llmClient.ts:31–41  ·  view source on GitHub ↗
(
	messages: OpenAI.Chat.ChatCompletionMessageParam[],
)

Source from the content-addressed store, hash-verified

29/** Drop the reasoning side-channel from assistant messages bound for an OpenAI
30 * `/chat/completions` request (it isn't a valid input field there). */
31export function stripReasoningDetails(
32 messages: OpenAI.Chat.ChatCompletionMessageParam[],
33): OpenAI.Chat.ChatCompletionMessageParam[] {
34 return messages.map((message) => {
35 if (message.role !== "assistant") return message
36 const record = message as unknown as Record<string, unknown>
37 if (!(REASONING_DETAILS_FIELD in record)) return message
38 const { [REASONING_DETAILS_FIELD]: _omit, ...rest } = record
39 return rest as unknown as OpenAI.Chat.ChatCompletionMessageParam
40 })
41}

Callers 1

createMessageMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected