pub struct ToolServer { /* private fields */ }Expand description
A tool registry under construction; ToolServer::run turns it into
the shareable ToolServerHandle.
Implementations§
Source§impl ToolServer
impl ToolServer
Sourcepub fn owner(self, label: impl Into<String>) -> Self
pub fn owner(self, label: impl Into<String>) -> Self
Name the registry: the owner segment of every key it mints
(<owner>/tool:<name>#<n>, <owner>/retrieve:tools#<n>). The
default is tools#<m> from a per-process counter, distinct per
registry; name it when a host shares one table between registries and
wants to read the keys.
Sourcepub fn dynamic_tool(self, tool: DynamicTool) -> Self
pub fn dynamic_tool(self, tool: DynamicTool) -> Self
Add a runtime-defined tool.
Sourcepub fn dynamic_tools(self, tools: Vec<DynamicTool>) -> Self
pub fn dynamic_tools(self, tools: Vec<DynamicTool>) -> Self
Add runtime-defined tools.
Sourcepub fn registered_tool(self, tool: RegisteredTool) -> Self
pub fn registered_tool(self, tool: RegisteredTool) -> Self
Add a registration built elsewhere.
Sourcepub fn retrieved_tools<I, F>(
self,
sample: usize,
index: I,
toolset: ToolSet,
) -> Selfwhere
I: VectorStoreIndex<Filter = F> + 'static,
F: DynamicSearchFilter + WasmCompatSend + WasmCompatSync + 'static,
pub fn retrieved_tools<I, F>(
self,
sample: usize,
index: I,
toolset: ToolSet,
) -> Selfwhere
I: VectorStoreIndex<Filter = F> + 'static,
F: DynamicSearchFilter + WasmCompatSend + WasmCompatSync + 'static,
Add retrievable tools: sample of them are advertised per request,
chosen by index.
Sourcepub fn retrieved_tools_handler(
self,
sample: usize,
handler: impl Serve + 'static,
toolset: ToolSet,
) -> Self
pub fn retrieved_tools_handler( self, sample: usize, handler: impl Serve + 'static, toolset: ToolSet, ) -> Self
Add tools selected per request by a retrieval-family handler answering
TopNIds, registered under a generated retrieval index key.
Sourcepub fn run(self) -> ToolServerHandle
pub fn run(self) -> ToolServerHandle
Start the registry.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ToolServer
impl !UnwindSafe for ToolServer
impl Freeze for ToolServer
impl Send for ToolServer
impl Sync for ToolServer
impl Unpin for ToolServer
impl UnsafeUnpin for ToolServer
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