pub struct ScopedCollection<M, F> { /* private fields */ }Expand description
A ToolCollection<M> paired with a user-defined strategy closure.
Boxed into dyn TypedCollection when handed to the chat builder — the
generic M and F disappear at that boundary.
Implementations§
Source§impl<M, F> ScopedCollection<M, F>
impl<M, F> ScopedCollection<M, F>
Sourcepub fn new(tools: ToolCollection<M>, strategy: F) -> ScopedCollection<M, F>
pub fn new(tools: ToolCollection<M>, strategy: F) -> ScopedCollection<M, F>
Wrap a typed tool collection with a decision strategy.
Source§impl ScopedCollection<NoMeta, fn(&FunctionCall, &NoMeta) -> Action>
impl ScopedCollection<NoMeta, fn(&FunctionCall, &NoMeta) -> Action>
Sourcepub fn auto_execute(
tools: ToolCollection,
) -> ScopedCollection<NoMeta, fn(&FunctionCall, &NoMeta) -> Action>
pub fn auto_execute( tools: ToolCollection, ) -> ScopedCollection<NoMeta, fn(&FunctionCall, &NoMeta) -> Action>
Shortcut for the common case: wrap an unmetadata’d collection with
an always-execute strategy. Replaces the old
ChatBuilder::with_tools(collection) convenience path.
Trait Implementations§
Source§impl<M, F> TypedCollection for ScopedCollection<M, F>
impl<M, F> TypedCollection for ScopedCollection<M, F>
Source§fn names(&self) -> Vec<&'static str>
fn names(&self) -> Vec<&'static str>
Every tool name this collection owns. Used at builder time to
populate the routing table and detect collisions with other
collections.
Source§fn declarations(&self) -> Result<Value, ToolError>
fn declarations(&self) -> Result<Value, ToolError>
Tool declarations as the providers need them, in the same shape
ToolCollection::json returns today.Source§fn decide(&self, call: &FunctionCall) -> Action
fn decide(&self, call: &FunctionCall) -> Action
Ask the strategy what to do with this call. Pure decision — no
side effects.
Auto Trait Implementations§
impl<M, F> Freeze for ScopedCollection<M, F>where
F: Freeze,
impl<M, F> !RefUnwindSafe for ScopedCollection<M, F>
impl<M, F> Send for ScopedCollection<M, F>
impl<M, F> Sync for ScopedCollection<M, F>
impl<M, F> Unpin for ScopedCollection<M, F>
impl<M, F> UnsafeUnpin for ScopedCollection<M, F>where
F: UnsafeUnpin,
impl<M, F> !UnwindSafe for ScopedCollection<M, F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more