Adapters
Upload and compose file attachment handlers.
Attachment adapters control how files become assistant-ui attachments.
import {
CompositeAttachmentAdapter,
SimpleImageAttachmentAdapter,
SimpleTextAttachmentAdapter,
useLocalRuntime,
} from "@assistant-ui/react";
const attachments = new CompositeAttachmentAdapter([
new SimpleImageAttachmentAdapter(),
new SimpleTextAttachmentAdapter(),
]);
const runtime = useLocalRuntime(chatModelAdapter, {
adapters: { attachments },
});Common Exports
AttachmentAdapteris the interface for custom attachment handling.SimpleImageAttachmentAdapterconverts supported image files.SimpleTextAttachmentAdapterconverts supported text files.CompositeAttachmentAdaptertries multiple attachment adapters in order.CloudFileAttachmentAdapteruploads files through Assistant Cloud.
For a custom implementation guide, see Custom Attachment Adapter.