Skip to main content

Module message

Module message 

Source

Re-exports§

pub use citation::Citation;
pub use citation::DocumentRange;
pub use citation::Source;
pub use citation::SourceLocation;
pub use citation::Span;

Modules§

citation
What a provider says supports an answer text. A Citation lives on the Text it cites, with a byte Span into that text or none for the whole block, and the Sources behind it. The list is bound to the text it was resolved against: once the text is edited, Text::citations reads empty.

Structs§

Api
The wire format a turn was produced by, for example "anthropic.messages", "openai.responses" or "openai.chat".
AssistantMessage
One assistant turn.
Audio
Audio content containing audio data and metadata about it.
Document
Document content containing document data and metadata about it.
EmptyCallId
A provider call id was empty.
EmptyToolName
A tool name was empty.
Fingerprint
A 64-bit FNV-1a hash of a value’s JSON serialization with every object’s keys in sorted order and every whole number written as an integer, so a store that reorders keys (Postgres jsonb, sorted-key dumps) or writes 20.0 as 20 never changes it. It is stored as 16 hex digits, since a store that reads JSON numbers as doubles would round a 64-bit number.
Image
Image content containing image data and metadata about it. On an assistant turn, native holds the provider item it was decoded from.
LocalCallId
A call id rig issued: a random (v4) UUID.
Native
One provider item, verbatim in its API’s JSON shape, beside the canonical block (or message) it was decoded to.
Opaque
A provider item with no canonical meaning, such as a hosted-tool step or a compaction record. Only the API that produced it reads it.
Origin
Which wire, provider and model produced an assistant turn.
ProviderCallId
The call-correlation id a provider issued and expects echoed back. Never empty.
Reasoning
Reasoning the model showed: its text, or a redacted block with none. Signatures, encrypted payloads and ids are provider data and live in native.
Text
Text. On an assistant turn, native holds the provider item the block was decoded from, and Text::citations what the provider says supports it; user and tool-result text leave both empty.
ToolCall
A tool call: its id, and the function and arguments requested.
ToolFunction
A tool function to call: its name and its arguments, always a JSON object.
ToolName
A tool name, never empty.
ToolResult
The result of a tool call, sent back to the model.
Video
Video content containing video data and metadata about it.

Enums§

AssistantContent
One block of an assistant turn: one provider output item. Deserialization requires the lowercase type tag.
AudioMediaType
Describes the audio media type of the content. Not every provider supports every media type. Convertible to and from MIME type strings.
CallId
A tool call’s one identity: the id the provider issued, or one rig issued because the provider sent none.
ContentFormat
Content representation as base64, text, or a URL.
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.
StopReason
How an assistant turn ended.
ToolChoice
ToolResultContent
Describes one typed item in a tool result.
UserContent
User text, tool results, or media. Supported source kinds and media types depend on the target provider.
VideoMediaType
Describes the video media type of the content. Not every provider supports every media type. Convertible to and from MIME type strings.

Traits§

MimeType
Trait for converting between MIME types and media types.

Functions§

turn_delivered_no_answer
Whether no block of the choice is an answer (AssistantContent::is_answer): reasoning, provider-only items and blank text are not, even when retained in history.
turn_failure
Why a run fails on a turn, or None when it goes on. A turn that will not replay (StopReason::is_failure, the rule adapt skips it by) runs none of its tool calls. A turn the provider failed (StopReason::Error) fails even when it holds an answer, so the caller never takes as a success a turn the next request leaves out. A turn that delivered no answer (turn_delivered_no_answer) also fails when the output budget or a filter cut it (finish is truncating). A turn that ended at the token limit with a call is finished, so its call runs. Every runtime reads this one rule.