Available on crate feature
conversation only.Expand description
Multi-turn conversation helper.
Conversation holds the system prompt, message history, default
request settings, and accumulated usage for a multi-turn exchange. Each
call to Conversation::send runs one turn against the API and
appends the assistant response to the history automatically.
Optional auto-cache mode (set via Conversation::with_auto_cache or
Conversation::with_cache_breakpoint_on_system) applies an ephemeral
cache_control breakpoint to the system prompt and optionally the most
recent user turn before each request, so cache hits stay high without
the app needing to think about it.
Conversation is Serialize + Deserialize, so a session can be
persisted to disk and resumed later.
Gated on the conversation feature.
Structs§
- Context
Compaction Policy - Policy controlling when and how
Conversationdrops older turns to stay under a token budget. - Conversation
- Multi-turn conversation state plus per-request defaults.
- Usage
Record - One turn’s
Usagepaired with the model it ran on.
Enums§
- Auto
Cache Mode - Automatic cache-breakpoint placement for outgoing requests.