Lower-level assistant-ui providers for custom renderers, scoped message parts, attachments, and advanced composition.
API Reference
ChainOfThoughtByIndicesProvider
- startIndexnumber
- endIndexnumber
ChainOfThoughtPartByIndexProvider
- indexnumber
ComposerAttachmentByIndexProvider
- indexnumber
MessageAttachmentByIndexProvider
- indexnumber
MessageByIndexProvider
- indexnumber
MessageProvider
- messageThreadMessage
- ThreadMessage
- status?ThreadAssistantMessage["status"]
- ThreadMessage["status"]
- type"running"
- metadataThreadMessage["metadata"]
- ThreadMessage["metadata"]
- unstable_state?ReadonlyJSONValue | undefinedunstable
- unstable_annotations?readonly ReadonlyJSONValue[] | undefinedunstable
- unstable_data?readonly ReadonlyJSONValue[] | undefinedunstable
- steps?readonly ThreadStep[] | undefined
- submittedFeedback?ThreadMessage["metadata"]["submittedFeedback"]
- ThreadMessage["metadata"]["submittedFeedback"]
- type"positive" | "negative"
- comment?string
- timing?MessageTiming | undefined
- ThreadMessage["metadata"]["timing"]
- streamStartTimenumber
- firstTokenTime?number
- totalStreamTime?number
- tokenCount?number
- tokensPerSecond?number
- totalChunksnumber
- toolCallCountnumber
- isOptimistic?boolean
Marks a client-side optimistic placeholder. Such messages are evicted once off the head branch and are never persisted.
- modality?MessageModality | undefined
Set when the message was produced by a voice session rather than typed.
- customRecord<string, unknown>
- attachments?ThreadUserMessage["attachments"]
- idstring
- createdAtDate
- role"system"
- contentreadonly [TextMessagePart]
- indexnumber
- isLast?boolean
- branchNumber?number
- branchCount?number
- submission?ComposerSubmission | undefined
Set when this row is a composer submission rather than a thread message.
MessageProvider props["submission"]- idstring
- roleMessageRole
- textstring
- quote?QuoteInfo | undefined
- MessageProvider props["submission"]["quote"]
- textstring
- messageIdstring
- attachmentsreadonly Attachment[]
PartByIndexProvider
- indexnumber
ReadonlyThreadProvider
- messagesreadonly ThreadMessage[]
RuntimeAdapterProvider
- adaptersRuntimeAdapters
- RuntimeAdapters
- modelContext?ModelContextProvider | undefined
- RuntimeAdapters["modelContext"]
- getModelContext() => ModelContext
- subscribe?(callback: () => void) => Unsubscribe
- history?ThreadHistoryAdapter | undefined
- RuntimeAdapters["history"]
- unstable_copy?(( branch: readonly ThreadMessage[], messageIds: readonly string[], ) => Promise<void>) | undefinedunstable
Keeps a copy of messages whose source of truth is the runtime's backend. `branch` is the conversation from its first message to its last, and `messageIds` names the ones in it that are new or changed; the adapter stores those, and first any earlier message of the branch it does not hold yet, keyed by each message's own id. It is undefined while the adapter keeps no copies, so the runtime then neither copies nor records tool interactions.
- load() => Promise<ExportedMessageRepository & { state?: ReadonlyJSONValue; unstable_resume?: boolean; }>
- resume?(options: ChatModelRunOptions) => AsyncGenerator<ChatModelRunResult, void, unknown>
- append(item: ExportedMessageRepositoryItem) => Promise<void>
- update?(item: ExportedMessageRepositoryItem) => Promise<void>
Rewrites a previously appended message in place, keyed by its message id. Adapters that implement this let a runtime persist a run paused for tool approval, finalize the same message once the run resumes, and record a tool result that arrives after the message settled, which can be a message later turns follow. An update may arrive for an id whose earlier write failed; treat it as an upsert keyed on the message id rather than assuming the entry exists.
- delete?(items: ExportedMessageRepositoryItem[]) => Promise<void>
- withFormat?<TMessage, TStorageFormat extends Record<string, unknown>>(formatAdapter: MessageFormatAdapter<TMessage, TStorageFormat>) => GenericThreadHistoryAdapter<TMessage>
Required when used with `useAISDKRuntime` / `useChatRuntime`.
- attachments?AttachmentAdapter | undefined
- RuntimeAdapters["attachments"]
- acceptstring
- add(state: { file: File; }) => Promise<PendingAttachment> | AsyncGenerator<PendingAttachment, void>
- remove(attachment: Attachment) => Promise<void>
- send(attachment: PendingAttachment, options?: { signal?: AbortSignal; }) => Promise<CompleteAttachment>
- feedback?FeedbackAdapter | undefined
- RuntimeAdapters["feedback"]
- submit(feedback: FeedbackAdapterFeedback) => void
- children?ReactNode
SuggestionByIndexProvider
- indexnumber
TextMessagePartProvider
- textstring
- isRunning?boolean
ThreadListItemByIndexProvider
- indexnumber
- archivedboolean
ThreadListItemRuntimeProvider
- runtimeThreadListItemRuntime
- ThreadListItemRuntime
- pathThreadListItemRuntimePath
- ThreadListItemRuntimePath
- refstring
- threadSelectorThreadListItemRuntimePath["threadSelector"]
- ThreadListItemRuntimePath["threadSelector"]
- type"main"
- getState() => ThreadListItemRuntimeState
- initialize() => Promise<{ remoteId: string; externalId: string | undefined; }>
- generateTitle(options?: ThreadListItemGenerateTitleOptions) => Promise<void>
- switchTo(options?: { unarchive?: boolean; }) => Promise<void>
- rename(newTitle: string) => Promise<void>
- updateCustom(custom: Record<string, unknown> | undefined) => Promise<void>
- archive() => Promise<void>
- unarchive() => Promise<void>
- delete() => Promise<void>
- detach() => void
- subscribe(callback: () => void) => Unsubscribe
- unstable_on<E extends ThreadListItemEventType>(event: E, callback: ThreadListItemEventCallback<E>) => Unsubscribeunstable