pub trait BaseRetrievalTool: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn retrieve<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<RetrievalResult>, ToolError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Trait for retrieval tools that fetch relevant context.
Implementations search over a corpus and return ranked results that can be injected into the LLM context.
Required Methods§
Sourcefn retrieve<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<RetrievalResult>, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn retrieve<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<RetrievalResult>, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Search the corpus with a query and return ranked results.