pub trait Retriever: Send + Sync {
// Required methods
fn retrieve<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 DocumentTree,
query: &'life2 str,
options: &'life3 RetrieveOptions,
) -> Pin<Box<dyn Future<Output = RetrieverResult<RetrieveResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn name(&self) -> &str;
// Provided methods
fn supports_options(&self, _options: &RetrieveOptions) -> bool { ... }
fn estimate_cost(
&self,
tree: &DocumentTree,
options: &RetrieveOptions,
) -> CostEstimate { ... }
}Expand description
Trait for document retrieval strategies.
Implementations provide different approaches to navigating the document tree and finding relevant content.
Required Methods§
Sourcefn retrieve<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 DocumentTree,
query: &'life2 str,
options: &'life3 RetrieveOptions,
) -> Pin<Box<dyn Future<Output = RetrieverResult<RetrieveResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn retrieve<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 DocumentTree,
query: &'life2 str,
options: &'life3 RetrieveOptions,
) -> Pin<Box<dyn Future<Output = RetrieverResult<RetrieveResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Provided Methods§
Sourcefn supports_options(&self, _options: &RetrieveOptions) -> bool
fn supports_options(&self, _options: &RetrieveOptions) -> bool
Check if this retriever supports the given options.
Some retrievers may not support all features (e.g., sufficiency checking).
Sourcefn estimate_cost(
&self,
tree: &DocumentTree,
options: &RetrieveOptions,
) -> CostEstimate
fn estimate_cost( &self, tree: &DocumentTree, options: &RetrieveOptions, ) -> CostEstimate
Estimate the cost of a retrieval operation.
Returns an estimated number of LLM calls or tokens that will be used. Useful for cost-aware strategy selection.