pub struct ChatRequest<'a> {
pub model: String,
pub max_tokens: Option<Ceiling>,
pub system: Vec<SystemBlock>,
pub messages: Cow<'a, [ChatMessage]>,
pub tools: Cow<'a, [ToolDef]>,
pub breakpoint: MessageBreakpoint,
pub effort: Option<Effort>,
}Expand description
The canonical request conversation (city dialect = Anthropic Messages). Both production dialects and the scripted model consume this one shape — the seam carries it so replay, citysim and the real gateway argue about the same object.
messages and tools are borrowed on the turn’s path, because a
request lives for one call; a holder that keeps a request past the
call (the keep-warm renewal) owns a ChatRequest<'static>.
Fields§
§model: String§max_tokens: Option<Ceiling>Absent when no catalogue row states this model’s ceiling. The OpenAI wire then omits the field and takes the provider’s own default; the Anthropic wire, which requires it, refuses.
system: Vec<SystemBlock>§messages: Cow<'a, [ChatMessage]>§tools: Cow<'a, [ToolDef]>§breakpoint: MessageBreakpointOutside serde, like every request-side annotation: the bytes a ledger or a transcript records are the same with and without it.
effort: Option<Effort>Frozen at run start: changing it mid-run would start a new cached
prompt prefix, so the value rides in from crate::FrozenConfig.
Implementations§
Source§impl ChatRequest<'_>
impl ChatRequest<'_>
Sourcepub fn empty(model: &str, max_tokens: Ceiling) -> ChatRequest<'static>
pub fn empty(model: &str, max_tokens: Ceiling) -> ChatRequest<'static>
An empty conversation shell for adapters and tests that argue about hashes, not content.
Sourcepub fn carries_breakpoint(&self, index: usize) -> bool
pub fn carries_breakpoint(&self, index: usize) -> bool
Whether the message at index carries this request’s breakpoint.
The one reading of MessageBreakpoint; a dialect only spells
the answer on its wire.
Sourcepub fn into_owned(self) -> ChatRequest<'static>
pub fn into_owned(self) -> ChatRequest<'static>
The same request, owning what it borrowed: for a holder that keeps it past the call it was assembled for.