pub enum Provider {
Duckduckgo,
Brave {
api_key: String,
},
Tavily {
api_key: String,
},
Searxng {
base_url: String,
api_key: Option<String>,
},
}Expand description
Which backend answers a search, and the credential it needs.
Variants§
Duckduckgo
Scraped DuckDuckGo Lite. No key, no contract. The default, so the tool works with no configuration at all.
Brave
Brave Search API. Key travels in X-Subscription-Token.
Tavily
Tavily, which returns cleaned page content alongside each hit.
Searxng
A self-hosted SearXNG instance’s JSON API.
Implementations§
Source§impl Provider
impl Provider
Sourcepub fn label(&self) -> &'static str
pub fn label(&self) -> &'static str
Stable identifier recorded on the output so a fallback is visible.
Sourcepub fn parse_name(s: &str) -> Option<&'static str>
pub fn parse_name(s: &str) -> Option<&'static str>
Parse a provider name with no credential attached. Used by the CLI’s
--search-provider flag, which selects an entry the config file (or an
environment variable) supplies the key for.
Sourcepub async fn search(
&self,
options: &SearchOptions,
) -> Result<(Vec<SearchResult>, SearchStatus)>
pub async fn search( &self, options: &SearchOptions, ) -> Result<(Vec<SearchResult>, SearchStatus)>
Run a query against this backend.
Trait Implementations§
Source§impl Debug for Provider
Redacting Debug: SearchOptions derives Debug and is routinely printed
in error paths, so a derived impl here would put API keys on stderr.
impl Debug for Provider
Redacting Debug: SearchOptions derives Debug and is routinely printed
in error paths, so a derived impl here would put API keys on stderr.
Source§impl<'de> Deserialize<'de> for Provider
impl<'de> Deserialize<'de> for Provider
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Provider
impl RefUnwindSafe for Provider
impl Send for Provider
impl Sync for Provider
impl Unpin for Provider
impl UnsafeUnpin for Provider
impl UnwindSafe for Provider
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