pub struct RequestPatch {
pub preamble: Option<String>,
pub temperature: Option<f32>,
pub max_tokens: Option<u32>,
pub tool_choice: Option<ToolChoice>,
pub active_tools: Option<Vec<String>>,
pub extra_params: BTreeMap<String, Value>,
pub documents: Vec<Message>,
pub history: Option<Vec<Message>>,
}Expand description
How a turn’s request differs from the agent’s defaults.
Every field is optional and every field is a this turn only decision. Providers that cannot express a field must say so rather than drop it silently: a patch nobody applied is worse than an error, because the model then looks irrational for reasons nothing records.
Fields§
§preamble: Option<String>An extra system message, sent ahead of the conversation. Use it for a per-turn reminder; the agent’s own system prompt stays where it is.
temperature: Option<f32>§max_tokens: Option<u32>§tool_choice: Option<ToolChoice>What the model may do with tools on this turn.
active_tools: Option<Vec<String>>An allow-list of tool names to advertise. Unknown names are dropped, so a hook that names a tool this build does not have narrows the list to what exists rather than failing the turn.
extra_params: BTreeMap<String, Value>Merged into the request body, shallow: a key here replaces the same key from the config
profile. This is the escape hatch for provider-specific knobs (top_p, min_p,
repeat_penalty) without teaching Eclipse every vendor’s spelling.
documents: Vec<Message>Extra messages inserted after the system prompt and ahead of the conversation. They are this turn only — they are never stored, so the session reads as if they were not there. Use for a per-turn reference document or a fetched excerpt.
history: Option<Vec<Message>>Replaces the assembled conversation (everything after the system prompt) for this turn.
The agent’s own system prompt is preserved; the history the loop would have sent is not.
Last writer wins, like preamble.
Implementations§
Source§impl RequestPatch
impl RequestPatch
pub fn is_empty(&self) -> bool
Sourcepub fn describe(&self) -> String
pub fn describe(&self) -> String
Names of the fields this patch sets, for an error or a log line.
Sourcepub fn merge(&mut self, later: RequestPatch)
pub fn merge(&mut self, later: RequestPatch)
Fold a later hook’s patch into this one: scalars are last-writer-wins, extra_params
merge key by key, and two allow-lists intersect.
Intersecting is the only composition that cannot widen what a hook meant to narrow: if hook A permits three tools and hook B permits two, the turn gets the two. Union would let a later hook quietly re-enable what an earlier one forbade.