@tanstack/ai
Version:
Type-safe TypeScript AI SDK for streaming chat, tool calling, agents, structured outputs, and multimodal generation.
31 lines (29 loc) • 982 B
text/typescript
import type { InterruptSubmissionError } from '../interrupts'
import type { ContentPart, StreamChunk, ToolOutputState } from '../types'
/**
* Adapter / engine yield before normalize. Public StreamChunk is spec-only.
* This type still allows the old extra fields.
*/
export type AdapterYieldChunk = StreamChunk & {
model?: string
finishReason?: 'stop' | 'length' | 'content_filter' | 'tool_calls' | null
// `any` so TokenUsage adapter yields stay assignable after public usage[]
usage?: any
content?: string
args?: string
toolName?: string
toolCallName?: string
index?: number
input?: unknown
output?: unknown
result?: string | Array<ContentPart>
state?: ToolOutputState | Record<string, unknown>
stepId?: string
stepType?: string
delta?: string | ReadonlyArray<unknown>
signature?: string
error?: { message: string; code?: string }
'tanstack:interruptErrors'?: ReadonlyArray<InterruptSubmissionError>
threadId?: string
runId?: string
}