pub struct LlmRequest {
pub model: Option<String>,
pub instructions: Vec<InstructionBlock>,
pub messages: Vec<Message>,
pub tools: Vec<ToolDefinition>,
pub tool_choice: Option<ToolChoice>,
pub sampling: SamplingParams,
pub output: OutputParams,
pub reasoning: ReasoningParams,
pub stream: bool,
pub extensions: ProviderExtensions,
pub preservation: PreservationMetadata,
}Expand description
Normalized request representation shared by Switchyard components.
Fields§
§model: Option<String>Model requested by the inbound client.
instructions: Vec<InstructionBlock>System and developer instructions separated from conversation turns.
messages: Vec<Message>Ordered conversation messages.
tools: Vec<ToolDefinition>Tools available to the model.
tool_choice: Option<ToolChoice>Policy controlling model tool selection.
sampling: SamplingParamsCommon sampling controls.
output: OutputParamsOutput budget and shape controls.
reasoning: ReasoningParamsReasoning controls.
stream: boolWhether the caller requested a streamed response.
extensions: ProviderExtensionsProvider fields without first-class normalized equivalents.
preservation: PreservationMetadataExact provider bodies used by codecs for lossless same-format round trips.
This is separate from a host’s optional
Request::raw_request.
Implementations§
Source§impl LlmRequest
impl LlmRequest
Sourcepub fn seal_preservation(&mut self)
pub fn seal_preservation(&mut self)
Records the current shape of this request against its preserved bodies.
Codecs call this once decoding is complete. Until it is called the preserved bodies are treated as stale, so an un-sealed request always re-encodes from normalized fields.
Sourcepub fn preserved_request_is_current(&self) -> bool
pub fn preserved_request_is_current(&self) -> bool
Whether the preserved bodies still describe this request.
Returns false once anything has changed since Self::seal_preservation
— a routing algorithm inserting a tier system prompt, appending a handoff
note, rewriting the model — which is what stops a same-format hop from
replaying a body that predates the change.
Trait Implementations§
Source§impl Clone for LlmRequest
impl Clone for LlmRequest
Source§fn clone(&self) -> LlmRequest
fn clone(&self) -> LlmRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more