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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T, F> PortableTool for Twhere
F: SearchFilter<Value = Value> + WasmCompatSend + WasmCompatSync + for<'de> Deserialize<'de>,
T: VectorStoreIndex<Filter = F>,
impl<T, F> PortableTool for Twhere
F: SearchFilter<Value = Value> + WasmCompatSend + WasmCompatSync + for<'de> Deserialize<'de>,
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
Concrete author-facing failure.
Source§type Args = VectorSearchRequest<F>
type Args = VectorSearchRequest<F>
Owned JSON arguments.
Source§type Output = Vec<VectorStoreOutput>
type Output = Vec<VectorStoreOutput>
Canonical model-visible output.
Source§fn description(&self) -> String
fn description(&self) -> String
Model-facing description.
Source§fn parameters(&self) -> Value
fn parameters(&self) -> Value
JSON Schema for arguments.
Source§async fn call(
&self,
args: <T as PortableTool>::Args,
) -> Result<<T as PortableTool>::Output, <T as PortableTool>::Error>
async fn call( &self, args: <T as PortableTool>::Args, ) -> Result<<T as PortableTool>::Output, <T as PortableTool>::Error>
Execute one owned invocation without runtime access.
Source§fn map_error(&self, error: Self::Error) -> ToolExecutionError
fn map_error(&self, error: Self::Error) -> ToolExecutionError
Normalize a concrete failure at the runtime effect boundary.
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tool for Twhere
T: PortableTool,
impl<T> Tool for Twhere
T: PortableTool,
Source§const NAME: &'static str = const NAME: &'static str = <T as rig_core::tool::PortableTool>::NAME;
const NAME: &'static str = const NAME: &'static str = <T as rig_core::tool::PortableTool>::NAME;
Unique registration and provider-facing name.
Source§type Args = <T as PortableTool>::Args
type Args = <T as PortableTool>::Args
Typed JSON arguments.
Source§type Output = <T as PortableTool>::Output
type Output = <T as PortableTool>::Output
Output convertible into Rig’s canonical model presentation. Read more
Source§type Error = <T as PortableTool>::Error
type Error = <T as PortableTool>::Error
Typed error returned by direct calls to this tool. Read more
Source§fn description(&self) -> String
fn description(&self) -> String
Model-facing description.
Source§fn parameters(&self) -> Value
fn parameters(&self) -> Value
JSON Schema for arguments.