use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
pub struct WebSearchConfig {
pub max_uses: Option<u32>,
pub allowed_domains: Option<Vec<String>>,
pub blocked_domains: Option<Vec<String>>,
}
impl WebSearchConfig {
pub fn with_max_uses(mut self, max_uses: u32) -> Self {
self.max_uses = Some(max_uses);
self
}
pub fn with_allowed_domains<I, S>(mut self, allowed_domains: I) -> Self
where
I: IntoIterator<Item = S>,
S: Into<String>,
{
self.allowed_domains = Some(allowed_domains.into_iter().map(Into::into).collect());
self
}
pub fn with_blocked_domains<I, S>(mut self, blocked_domains: I) -> Self
where
I: IntoIterator<Item = S>,
S: Into<String>,
{
self.blocked_domains = Some(blocked_domains.into_iter().map(Into::into).collect());
self
}
}