pub trait SearchProvider: Send + Sync {
// Required method
fn search<'life0, 'async_trait>(
&'life0 self,
query: SearchQuery,
) -> Pin<Box<dyn Future<Output = Result<SearchResults, SearchError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
A backend that runs web searches for the promptforge/web/search tool.
The Host registers one under the key
SEARCH_PROVIDER. The tool validates the
model’s arguments before it calls the provider. The tool leaves the
deadline to the provider, which must limit how long each search takes.
Required Methods§
Sourcefn search<'life0, 'async_trait>(
&'life0 self,
query: SearchQuery,
) -> Pin<Box<dyn Future<Output = Result<SearchResults, SearchError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn search<'life0, 'async_trait>(
&'life0 self,
query: SearchQuery,
) -> Pin<Box<dyn Future<Output = Result<SearchResults, SearchError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Runs query and returns its results.
§Errors
Returns a SearchError whose kind says whether the transport or
the backend failed. The model sees the error’s message after a
web_search: prefix, so the message must not contain a credential.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".