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<(f64, String, T)>, VectorStoreError>
async fn top_n<T: for<'a> Deserialize<'a> + WasmCompatSend>( &self, _req: VectorSearchRequest, ) -> Result<Vec<(f64, String, T)>, VectorStoreError>
Returns the top N most similar documents as
(score, id, document) tuples.Source§async fn top_n_ids(
&self,
_req: VectorSearchRequest,
) -> Result<Vec<(f64, String)>, VectorStoreError>
async fn top_n_ids( &self, _req: VectorSearchRequest, ) -> Result<Vec<(f64, String)>, VectorStoreError>
Returns the top N most similar document IDs as
(score, id) tuples.Auto Trait Implementations§
impl Freeze 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T, F> Tool for Twhere
F: SearchFilter<Value = Value> + WasmCompatSend + WasmCompatSync + for<'de> Deserialize<'de>,
T: VectorStoreIndex<Filter = F>,
impl<T, F> Tool for Twhere
F: SearchFilter<Value = Value> + WasmCompatSend + WasmCompatSync + for<'de> Deserialize<'de>,
T: VectorStoreIndex<Filter = F>,
Source§const NAME: &'static str = const NAME: &'static str = "search_vector_store";
const NAME: &'static str = const NAME: &'static str = "search_vector_store";
The name of the tool. This name should be unique within a single
ToolSet or other registration scope that dispatches tools by name.Source§type Error = VectorStoreError
type Error = VectorStoreError
The error type of the tool.
Source§type Args = VectorSearchRequest<F>
type Args = VectorSearchRequest<F>
The arguments type of the tool.
Source§type Output = Vec<VectorStoreOutput>
type Output = Vec<VectorStoreOutput>
The output type of the tool.
Source§async fn definition(&self, _prompt: String) -> ToolDefinition
async fn definition(&self, _prompt: String) -> ToolDefinition
A method returning the tool definition. The user prompt can be used to
tailor the definition to the specific use case.
Source§impl<T> ToolDyn for Twhere
T: Tool,
impl<T> ToolDyn for Twhere
T: Tool,
Source§fn definition<'a>(
&'a self,
prompt: String,
) -> Pin<Box<dyn Future<Output = ToolDefinition> + Send + 'a>>
fn definition<'a>( &'a self, prompt: String, ) -> Pin<Box<dyn Future<Output = ToolDefinition> + Send + 'a>>
Returns the provider-facing tool schema.