#[non_exhaustive]pub struct ToolChange {
pub added: Vec<ToolDefinition>,
pub removed: Vec<String>,
}Expand description
A change to the tools offered to the model, effective from the position of its block onward.
Applying a change removes the removed names first, then adds each of
added, a definition replacing any current one of the same name. The
first change in a context declares the initial set; current_tools
folds them all.
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.added: Vec<ToolDefinition>Definitions offered from here on, replacing same-name definitions.
removed: Vec<String>Names of tools withdrawn from here on. A name that is not offered is ignored.
Implementations§
Source§impl ToolChange
impl ToolChange
Sourcepub fn new(added: Vec<ToolDefinition>, removed: Vec<String>) -> Self
pub fn new(added: Vec<ToolDefinition>, removed: Vec<String>) -> Self
A change adding added after withdrawing removed.
Sourcepub fn between(previous: &[ToolDefinition], current: &[ToolDefinition]) -> Self
pub fn between(previous: &[ToolDefinition], current: &[ToolDefinition]) -> Self
The change that turns the set previous into the set current.
A tool whose definition differs is withdrawn and added again; a tool
that only moved in the list is unchanged, since order carries no
meaning to the model. added follows the order of current,
removed the order of previous.
Sourcepub fn apply_to(&self, tools: &mut Vec<ToolDefinition>)
pub fn apply_to(&self, tools: &mut Vec<ToolDefinition>)
Applies this change to a tool state in place.