Skip to main content

Module message

Module message 

Source
Expand description

Conversation message model: Message, its block enums, and the SystemPrompt / CacheControl support types.

Structs§

SystemBlock
One entry inside a SystemPrompt::Blocks sequence.
ToolResultContent
Body of a tool reply sent back to the model in a UserBlock::ToolResult.

Enums§

AssistantBlock
One block inside a Message::Assistant turn.
CacheControl
Cache breakpoint placed on a content block, system prompt block, or tool definition. Providers that support prompt caching (Anthropic today) read these to decide which prefix is cacheable and at what TTL; providers without explicit caching ignore the field. The presence of cache_control only declares intent — the actual cache hit/miss is reported via crate::Usage::cached_input_tokens and the cache-creation counters.
Message
One turn in the conversation history exchanged with a provider.
Source
Source of an image or document content block.
SystemPrompt
System prompt passed to the provider. Plain(String) matches the pre-caching API and is what From<String> / From<&str> produce — callers that don’t care about prompt caching keep using strings. Blocks(...) opts in to per-block cache breakpoints (Anthropic emits the system field as an array; other providers concatenate the block texts).
ToolResultBlock
One block inside a ToolResultContent::blocks list.
UserBlock
One block inside a Message::User turn.