UNPKG

@tanstack/ai

Version:

Type-safe TypeScript AI SDK for streaming chat, tool calling, agents, structured outputs, and multimodal generation.

35 lines (34 loc) • 1.27 kB
import { SystemPrompt } from '../system-prompts.js'; import { ModelMessage } from '../types.js'; /** * Remove lone surrogates from the text `chat()` sends to a provider. A lone * surrogate is invalid UTF-8 / JSON on the wire, so providers reject the * whole request. */ export declare function sanitizeProviderRequest(messages: Array<ModelMessage>, systemPrompts: Array<SystemPrompt> | undefined): { messages: { toolCalls?: Array<import('..').ToolCall>; content: string | (import('..').ImagePart<unknown> | import('..').AudioPart<unknown> | import('..').VideoPart<unknown> | import('..').DocumentPart<unknown> | { content: string; type: "text"; metadata?: unknown; })[] | null; role: "user" | "assistant" | "tool"; name?: string; toolCallId?: string; thinking?: Array<{ content: string; signature?: string; redacted?: boolean; }>; error?: string; metadata?: Record<string, any>; structuredOutput?: import('..').StructuredOutputPart; id?: string; createdAt?: Date; }[]; systemPrompts: (string | { content: string; metadata?: unknown; })[] | undefined; };