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.

30 lines (25 loc) • 719 B
import type { SharedV4Warning } from '@ai-sdk/provider'; const streamRetryAttemptBoundarySymbol = Symbol('streamRetryAttemptBoundary'); export type StreamRetryAttemptBoundaryPart = { [streamRetryAttemptBoundarySymbol]: true; warnings: Array<SharedV4Warning>; }; export function createStreamRetryAttemptBoundaryPart({ warnings, }: { warnings: Array<SharedV4Warning>; }): StreamRetryAttemptBoundaryPart { return { [streamRetryAttemptBoundarySymbol]: true, warnings, }; } export function isStreamRetryAttemptBoundaryPart( part: unknown, ): part is StreamRetryAttemptBoundaryPart { return ( typeof part === 'object' && part != null && streamRetryAttemptBoundarySymbol in part ); }