pub struct LlmRequest {
pub model: String,
pub system: String,
pub messages: Vec<LlmMessage>,
pub temperature: f32,
pub max_tokens: u32,
pub json_schema: Option<Value>,
pub timeout_ms: u64,
}Expand description
A single LLM call.
Field shape is frozen by BUILD_SPEC §12. Adapters MUST NOT reorder, rename,
or hide fields without bumping
cortex_core::SCHEMA_VERSION — the request
is part of the audit envelope downstream.
Fields§
§model: StringProvider-specific model identifier, e.g. claude-3-5-sonnet-20240620.
system: StringSystem prompt; may be empty.
messages: Vec<LlmMessage>Conversation history in chronological order.
temperature: f32Sampling temperature; passed through verbatim.
max_tokens: u32Hard cap on completion length.
json_schema: Option<Value>Optional JSON Schema constraint applied to the response (provider may enforce or just inject as guidance).
timeout_ms: u64Wallclock budget in milliseconds.
Implementations§
Source§impl LlmRequest
impl LlmRequest
Sourcepub fn prompt_hash(&self) -> String
pub fn prompt_hash(&self) -> String
Stable BLAKE3 hash over the canonical fields used for fixture matching:
(system, messages, temperature, max_tokens, json_schema).
Excludes model and timeout_ms so the same prompt can be
replayed against multiple models (matching is by (model, prompt_hash)
pair) and so transient budget tweaks do not invalidate fixtures.
The hash is over the serialized JSON of a tagged struct so that
serde_json field ordering is the deterministic input.
Trait Implementations§
Source§impl Clone for LlmRequest
impl Clone for LlmRequest
Source§fn clone(&self) -> LlmRequest
fn clone(&self) -> LlmRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more