1#![deny(warnings)]
2#![deny(clippy::all)]
3
4pub mod fetch;
7pub mod haiku;
8pub mod search;
9pub mod tools;
10pub mod types;
11
12use tokio::sync::OnceCell;
13
14pub struct WebTools {
19 pub(crate) http: reqwest::Client,
21 pub(crate) exa: exa_async::Client<exa_async::ExaConfig>,
23 pub(crate) anthropic: OnceCell<anthropic_async::Client<anthropic_async::AnthropicConfig>>,
25}
26
27impl WebTools {
28 #[must_use]
33 pub fn new() -> Self {
34 Self {
35 http: reqwest::Client::builder()
36 .connect_timeout(std::time::Duration::from_secs(5))
37 .timeout(std::time::Duration::from_secs(30))
38 .build()
39 .expect("reqwest client"),
40 exa: exa_async::Client::new(),
41 anthropic: OnceCell::new(),
42 }
43 }
44}
45
46impl Default for WebTools {
47 fn default() -> Self {
48 Self::new()
49 }
50}
51
52pub use tools::build_registry;
54
55#[cfg(test)]
56impl WebTools {
57 pub(crate) fn with_http_client(http: reqwest::Client) -> Self {
59 Self {
60 http,
61 exa: exa_async::Client::new(),
62 anthropic: OnceCell::new(),
63 }
64 }
65}