UNPKG

ai

Version:

AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.

11 lines (9 loc) 369 B
import type { ReasoningPart, ReasoningFilePart } from '@ai-sdk/provider-utils'; export function asReasoningText( reasoningParts: Array<ReasoningPart | ReasoningFilePart>, ): string | undefined { const reasoningText = reasoningParts .map(part => ('text' in part ? part.text : '')) .join(''); return reasoningText.length > 0 ? reasoningText : undefined; }