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

Function getReasoningBlockText

src/api/transform/openai-format.ts:274–280  ·  view source on GitHub ↗

* Extracts the reasoning text if `part` is a ReasoningContentBlock, or `undefined` * otherwise. Providers like DeepSeek / Z.ai emit a `"reasoning"` content block that isn't part of * Anthropic's `ContentBlockParam` union, so `part` is treated as `unknown` and its shape is * validated at r

(part: unknown)

Source from the content-addressed store, hash-verified

272 * overlap with any variant of `ContentBlockParam`, so the narrowed type collapses to `never`.
273 */
274function getReasoningBlockText(part: unknown): string | undefined {
275 if (!part || typeof part !== "object") {
276 return undefined
277 }
278 const block = part as { type?: unknown; text?: unknown }
279 return block.type === "reasoning" && typeof block.text === "string" ? block.text : undefined
280}
281
282/**
283 * Non-standard fields Zoo Code attaches to Anthropic message params to

Callers 1

convertToOpenAiMessagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected