Skip to main content

SearchProvider

Trait SearchProvider 

Source
pub trait SearchProvider: Send + Sync {
    // Required methods
    fn search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        options: &'life2 SearchOptions,
        client: &'life3 Client,
    ) -> Pin<Box<dyn Future<Output = Result<SearchResults, SearchError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             Self: 'async_trait;
    fn provider_name(&self) -> &'static str;
    fn is_configured(&self) -> bool;
}
Available on crate feature agent and (crate features agent_search_serper or agent_search_brave or agent_search_bing or agent_search_tavily) only.
Expand description

Search provider trait for abstracting different search APIs.

Required Methods§

Source

fn search<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, query: &'life1 str, options: &'life2 SearchOptions, client: &'life3 Client, ) -> Pin<Box<dyn Future<Output = Result<SearchResults, SearchError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Execute a search query and return results.

Source

fn provider_name(&self) -> &'static str

Provider name for logging/debugging.

Source

fn is_configured(&self) -> bool

Check if the provider is properly configured.

Implementors§