MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / mapReasoningDetails

Function mapReasoningDetails

src/api/transform/openai-format.ts:328–344  ·  view source on GitHub ↗
(details: unknown)

Source from the content-addressed store, hash-verified

326 const openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = []
327
328 const mapReasoningDetails = (details: unknown): any[] | undefined => {
329 if (!Array.isArray(details)) {
330 return undefined
331 }
332
333 return details.map((detail: any) => {
334 // Strip `id` from openai-responses-v1 blocks because OpenAI's Responses API
335 // requires `store: true` to persist reasoning blocks. Since we manage
336 // conversation state client-side, we don't use `store: true`, and sending
337 // back the `id` field causes a 404 error.
338 if (detail?.format === "openai-responses-v1" && detail?.id) {
339 const { id, ...rest } = detail
340 return rest
341 }
342 return detail
343 })
344 }
345
346 // Use provided normalization function or identity function
347 const normalizeId = options?.normalizeToolCallId ?? ((id: string) => id)

Callers 1

convertToOpenAiMessagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected