pub struct MockToolIndex { /* private fields */ }Available on crate feature
test-utils only.Expand description
A vector index that returns a predefined list of tool IDs from top_n_ids.
Implementations§
Source§impl MockToolIndex
impl MockToolIndex
Sourcepub fn new(tool_ids: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn new(tool_ids: impl IntoIterator<Item = impl Into<String>>) -> Self
Create a tool index that returns the given IDs in order.
Trait Implementations§
Source§impl VectorStoreIndex for MockToolIndex
impl VectorStoreIndex for MockToolIndex
Source§async fn top_n<T: for<'a> Deserialize<'a> + WasmCompatSend>(
&self,
_req: VectorSearchRequest,
) -> Result<Vec<VectorSearchResult<T>>, VectorStoreError>
async fn top_n<T: for<'a> Deserialize<'a> + WasmCompatSend>( &self, _req: VectorSearchRequest, ) -> Result<Vec<VectorSearchResult<T>>, VectorStoreError>
Returns the top N most similar documents, most similar first.
Source§async fn top_n_ids(
&self,
_req: VectorSearchRequest,
) -> Result<Vec<VectorSearchIdResult>, VectorStoreError>
async fn top_n_ids( &self, _req: VectorSearchRequest, ) -> Result<Vec<VectorSearchIdResult>, VectorStoreError>
Returns the top N most similar document IDs, most similar first.
Auto Trait Implementations§
impl Forget for MockToolIndex
impl Freeze for MockToolIndex
impl Move for MockToolIndex
impl RefUnwindSafe for MockToolIndex
impl Send for MockToolIndex
impl Sync for MockToolIndex
impl Unpin for MockToolIndex
impl UnsafeUnpin for MockToolIndex
impl UnwindSafe for MockToolIndex
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T, F> Tool for Twhere
F: SearchFilter<Value = Value> + WasmCompatSend + WasmCompatSync + DeserializeOwned,
T: VectorStoreIndex<Filter = F>,
impl<T, F> Tool for Twhere
F: SearchFilter<Value = Value> + WasmCompatSend + WasmCompatSync + DeserializeOwned,
T: VectorStoreIndex<Filter = F>,
Source§const NAME: &'static str = "search_vector_store"
const NAME: &'static str = "search_vector_store"
Unique registration and provider-facing name.
Source§type Error = VectorStoreError
type Error = VectorStoreError
Typed error returned by direct calls to this tool. Read more
Source§type Args = VectorSearchRequest<F>
type Args = VectorSearchRequest<F>
Typed JSON arguments.
Source§type Output = Vec<VectorSearchResult<Value>>
type Output = Vec<VectorSearchResult<Value>>
Output convertible into Rig’s canonical model presentation. Read more
Source§fn description(&self) -> String
fn description(&self) -> String
Model-facing description: what the tool does and when to pick it
over another, such as “Use it rather than
wc in shell”. The
model reads it with the tool’s parameters.Source§fn parameters(&self) -> Value
fn parameters(&self) -> Value
JSON Schema for arguments.
Source§async fn call(
&self,
_: &mut ToolContext,
args: <T as Tool>::Args,
) -> Result<<T as Tool>::Output, <T as Tool>::Error>
async fn call( &self, _: &mut ToolContext, args: <T as Tool>::Args, ) -> Result<<T as Tool>::Output, <T as Tool>::Error>
Execute the tool.
Source§fn annotations(&self) -> ToolAnnotations
fn annotations(&self) -> ToolAnnotations
What calling the tool does to the world, for the host’s policies
(approval, plan mode, which calls run side by side). Nothing is
stated by default, which reads as the protocol’s defaults
(
ToolAnnotations).