Skip to main content

Module image

Module image 

Source
Expand description

Image-attachment wire-shape types + validation, shared between forge-agent and a view.

Re-exportsΒ§

use serde::Deserialize; πŸ”’
use serde::Deserialize; πŸ”’
use serde::Serialize; πŸ”’
use serde::Serialize; πŸ”’
use crate::content::ContentBlock; πŸ”’
use crate::messages::Extras; πŸ”’

StructsΒ§

ImageAttachment
A pending image attachment: base64-encoded data and its MIME type.

ConstantsΒ§

SUPPORTED_IMAGE_MIME_TYPES
MIME types the Anthropic Vision API accepts as image attachments.

FunctionsΒ§

display_blocks
The image blocks a prompt’s attachments draw as: the ones the sender would keep, in the order they were sent, each carrying the mime and the measured size rather than its payload.
is_supported_image_type
Returns true if mime_type is a supported image MIME type.
is_valid_base64
Returns true if data is non-empty, correctly padded, and decodes as valid standard base64.
payload_bytes
The bytes a base64 payload stands for: four characters carry three, and padding is not a byte.
validate_image
Validate an image attachment before sending to the API.