#[non_exhaustive]pub struct RequestPatch {
pub preamble: Option<String>,
pub temperature: Option<f64>,
pub max_tokens: Option<u64>,
pub tool_choice: Option<ToolChoice>,
pub active_tools: Option<Vec<String>>,
pub additional_params: Option<Value>,
pub extra_context: Vec<Document>,
pub history: Option<Vec<Message>>,
}Expand description
A non-sticky patch applied only to the current turn’s completion request.
A HookStack merges patches in hook registration order according to these
rules:
extra_contextdocuments are appended in order.- JSON-object
additional_paramsvalues are shallow-merged, with later top-level keys winning; a later non-object value replaces an earlier value. active_toolsallow-lists are intersected.- Scalar fields and
historyuse last-writer-wins semantics, with a warning when multiple hooks set the same field.
The merged patch does not mutate the agent’s configured baseline and is not carried into subsequent turns.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.preamble: Option<String>Preamble to use instead of the agent’s configured preamble for this turn.
temperature: Option<f64>Sampling temperature to use for this turn.
max_tokens: Option<u64>Maximum output-token count to use for this turn.
tool_choice: Option<ToolChoice>Tool-choice policy to use for this turn.
active_tools: Option<Vec<String>>Allow-list used to narrow the tools advertised for this turn.
additional_params: Option<Value>Provider-specific request parameters to apply for this turn.
extra_context: Vec<Document>Context documents appended to the request for this turn.
history: Option<Vec<Message>>Conversation history to use instead of the current history for this turn.
Implementations§
Source§impl RequestPatch
impl RequestPatch
Sourcepub fn preamble(self, value: impl Into<String>) -> Self
pub fn preamble(self, value: impl Into<String>) -> Self
Replaces the agent’s configured preamble for this turn.
Sourcepub fn temperature(self, value: f64) -> Self
pub fn temperature(self, value: f64) -> Self
Sets the sampling temperature for this turn.
Sourcepub fn max_tokens(self, value: u64) -> Self
pub fn max_tokens(self, value: u64) -> Self
Sets the maximum output-token count for this turn.
Sourcepub fn tool_choice(self, value: ToolChoice) -> Self
pub fn tool_choice(self, value: ToolChoice) -> Self
Sets the tool-choice policy for this turn.
Sourcepub fn active_tools<I, S>(self, values: I) -> Self
pub fn active_tools<I, S>(self, values: I) -> Self
Sets the allow-list used to narrow the tools advertised for this turn.
Sourcepub fn additional_params(self, value: Value) -> Self
pub fn additional_params(self, value: Value) -> Self
Sets provider-specific request parameters for this turn.
When multiple patches provide JSON objects, their top-level keys are shallow-merged and values from later hooks win.
Sourcepub fn extra_context<I>(self, values: I) -> Selfwhere
I: IntoIterator<Item = Document>,
pub fn extra_context<I>(self, values: I) -> Selfwhere
I: IntoIterator<Item = Document>,
Appends context documents to the request for this turn.
Sourcepub fn context(self, value: Document) -> Self
pub fn context(self, value: Document) -> Self
Appends one context document to the request for this turn.
Sourcepub fn history<I>(self, values: I) -> Selfwhere
I: IntoIterator<Item = Message>,
pub fn history<I>(self, values: I) -> Selfwhere
I: IntoIterator<Item = Message>,
Replaces the conversation history for this turn.
Trait Implementations§
Source§impl Clone for RequestPatch
impl Clone for RequestPatch
Source§fn clone(&self) -> RequestPatch
fn clone(&self) -> RequestPatch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more