Skip to main content

Module message

Module message 

Source

Structs§

AdditionalParams
Provider extras on a content block: a non-empty JSON object, by construction.
Audio
Audio content containing audio data and metadata about it.
Document
Document content containing document data and metadata about it.
EmptyToolCallId
Error adopting the empty string as a tool-call identifier.
Image
Image content containing image data and metadata about it.
ProviderCallId
What the provider issued for a call — the only identifiers that may travel back on that provider’s wire.
Reasoning
Assistant reasoning payload with an optional provider-supplied identifier.
Text
Basic text content.
ToolCall
Describes a tool call with an id and function to call, generally produced by a provider.
ToolCallId
Rig’s tool-call correlation handle: non-empty by construction, minted at the provider boundary when the provider issued no identifier.
ToolFunction
Describes a tool function to call with a name and arguments, generally produced by a provider.
ToolResult
Tool result content containing information about a tool call and it’s resulting content.
Video
Video content containing video data and metadata about it.

Enums§

AssistantContent
Describes responses from a provider which is either text or a tool call.
AudioMediaType
Describes the audio media type of the content. Not every provider supports every media type. Convertible to and from MIME type strings.
ContentFormat
Describes the format of the content, which can be base64 or string.
DocumentMediaType
Describes the document media type of the content. Not every provider supports every media type. Includes also programming languages as document types for providers who support code running. Convertible to and from MIME type strings.
DocumentSourceKind
The kind of image source (to be used).
ImageDetail
Describes the detail of the image content, which can be low, high, or auto (open-ai specific).
ImageMediaType
Describes the image media type of the content. Not every provider supports every media type. Convertible to and from MIME type strings.
MediaType
Helper enum that tracks the media type of the content.
Message
A provider-agnostic chat message.
MessageError
Error type to represent issues with converting messages to and from specific provider messages.
ReasoningContent
A typed reasoning block used by providers that emit structured thinking data.
ToolChoice
ToolResultContent
Describes one typed item in a tool result.
UserContent
Describes the content of a message, which can be text, a tool result, an image, audio, or a document. Dependent on provider supporting the content type. Multimedia content is generally base64 (defined by it’s format) encoded but additionally supports urls (for some providers).
VideoMediaType
Describes the video media type of the content. Not every provider supports every media type. Convertible to and from MIME type strings.

Constants§

EMPTY_RESPONSE_ERROR
The shared wording for a response whose converted choice is empty.

Traits§

MimeType
Trait for converting between MIME types and media types.

Functions§

keys_lost_in_round_trip
Migration verification: every key path present in original (with a non-null value) that is missing or unequal after a tolerant load-and-reserialize round trip.
non_empty
The Option sibling of require_non_empty: None for an empty list, Some(items) otherwise.
optional_additional_params
Serde route for Option<AdditionalParams> fields: an explicit null or {} decodes as None, exactly like an absent field — a mechanically migrated block that wrote "additional_params": {} classifies identically to one that omitted the key. Any other non-object value is a loud decode error: extras are a keyed namespace (every producer stores an object, every extractor gets a key), so a mis-migrated [] or bare string is malformed data, not a phantom annotation no reader can see.
require_non_empty
Reject an empty content list, with the error the call site chose.
require_non_empty_response
require_non_empty with the shared response-direction rejection — the one-line guard for a provider decode whose converted choice is empty. Pairing the guard with EMPTY_RESPONSE_ERROR here keeps the wording from forking per wire. A decode with a legal empty case (anthropic’s documented empty end_turn) branches around the guard for that case and still routes every other empty through it.