ChatMessageContentBlock: {
    content: string;
    fileName?: string;
    fileSize?: number;
    height?: number;
    mimeType?: string;
    type: "text" | "image_url" | "video_url" | "audio_url" | "file_url";
    width?: number;
}

Defines the shape of a content block in a chat message. This can be used to represent different types of content in a message.

Type declaration

  • content: string

    The content of the block. This can be a string. In the case of 'image_url', 'video_url', 'audio_url', or 'file_url', it should be a URL to the resource, OR it can be a base64 encoded string. representing the content of the item. For base64 images, use the data URL format: data:image/png;base64,

  • Optional fileName?: string

    Optional original filename if the content was uploaded from a file.

  • Optional fileSize?: number

    Optional file size in bytes.

  • Optional height?: number

    Optional height in pixels (for images and videos).

  • Optional mimeType?: string

    Optional MIME type for media content (e.g., 'image/png', 'image/jpeg', 'audio/mp3'). When content is a data URL, this can be extracted from the URL. When content is raw base64, this field is required.

  • type: "text" | "image_url" | "video_url" | "audio_url" | "file_url"

    The type of content block. Can be 'text', 'image_url', 'video_url', 'audio_url', or 'file_url'.

  • Optional width?: number

    Optional width in pixels (for images and videos).