Skip to content

Commit a6def97

Browse files
authored
feat(tools): integrate Seltz as a direct-API search tool (tinyhumansai#1717)
1 parent 45cd01a commit a6def97

9 files changed

Lines changed: 769 additions & 5 deletions

File tree

.env.example

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ OPENHUMAN_WEB_SEARCH_MAX_RESULTS=5
9999
# [optional] Default: 10
100100
OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS=10
101101

102+
# ---------------------------------------------------------------------------
103+
# Seltz search (direct API — https://seltz.ai)
104+
# ---------------------------------------------------------------------------
105+
# [optional] API key from https://console.seltz.ai. When set, enables the
106+
# seltz_search agent tool. Fast (<200ms), independent index, domain/date filters.
107+
# SELTZ_API_KEY=
108+
# [optional] Override API base URL (default: https://api.seltz.ai/v1)
109+
# SELTZ_API_URL=
110+
# [optional] Default max results per query (1-20, default 10)
111+
# OPENHUMAN_SELTZ_MAX_RESULTS=10
112+
102113
# ---------------------------------------------------------------------------
103114
# Proxy
104115
# ---------------------------------------------------------------------------

src/openhuman/config/schema/load.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,27 @@ impl Config {
872872
}
873873
}
874874

875+
// Seltz direct-API search.
876+
if let Some(key) = env.get_any(&["OPENHUMAN_SELTZ_API_KEY", "SELTZ_API_KEY"]) {
877+
if !key.is_empty() {
878+
self.seltz.api_key = Some(key);
879+
// Auto-enable when the key is set via env.
880+
self.seltz.enabled = true;
881+
}
882+
}
883+
if let Some(url) = env.get_any(&["OPENHUMAN_SELTZ_API_URL", "SELTZ_API_URL"]) {
884+
if !url.is_empty() {
885+
self.seltz.api_url = Some(url);
886+
}
887+
}
888+
if let Some(max) = env.get_any(&["OPENHUMAN_SELTZ_MAX_RESULTS", "SELTZ_MAX_RESULTS"]) {
889+
if let Ok(n) = max.parse::<usize>() {
890+
if (1..=20).contains(&n) {
891+
self.seltz.max_results = n;
892+
}
893+
}
894+
}
895+
875896
// `OPENHUMAN_WEB_SEARCH_ENABLED` is intentionally ignored —
876897
// web search is unconditionally registered in the tool set.
877898
// Only the result/timeout budget knobs remain environment-configurable.

src/openhuman/config/schema/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub use storage_memory::{
6464
pub use tools::{
6565
BrowserComputerUseConfig, BrowserConfig, ComposioConfig, ComputerControlConfig, CurlConfig,
6666
GitbooksConfig, HttpRequestConfig, IntegrationToggle, IntegrationsConfig, MultimodalConfig,
67-
SecretsConfig, WebSearchConfig,
67+
SecretsConfig, SeltzConfig, WebSearchConfig,
6868
};
6969
pub use update::{UpdateConfig, UpdateRestartStrategy};
7070
mod voice_server;

src/openhuman/config/schema/tools.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,47 @@ impl Default for GitbooksConfig {
223223
}
224224
}
225225

226+
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
227+
#[serde(default)]
228+
pub struct SeltzConfig {
229+
/// When `true`, register `seltz_search` as an agent tool.
230+
#[serde(default)]
231+
pub enabled: bool,
232+
/// Seltz API key. Can also be set via `SELTZ_API_KEY` or
233+
/// `OPENHUMAN_SELTZ_API_KEY` env var.
234+
#[serde(default)]
235+
pub api_key: Option<String>,
236+
/// Override the Seltz API base URL (default: `https://api.seltz.ai/v1`).
237+
#[serde(default)]
238+
pub api_url: Option<String>,
239+
/// Max results per query (1–20, default 10).
240+
#[serde(default = "default_seltz_max_results")]
241+
pub max_results: usize,
242+
/// Per-request timeout in seconds (default 15).
243+
#[serde(default = "default_seltz_timeout_secs")]
244+
pub timeout_secs: u64,
245+
}
246+
247+
fn default_seltz_max_results() -> usize {
248+
10
249+
}
250+
251+
fn default_seltz_timeout_secs() -> u64 {
252+
15
253+
}
254+
255+
impl Default for SeltzConfig {
256+
fn default() -> Self {
257+
Self {
258+
enabled: false,
259+
api_key: None,
260+
api_url: None,
261+
max_results: default_seltz_max_results(),
262+
timeout_secs: default_seltz_timeout_secs(),
263+
}
264+
}
265+
}
266+
226267
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
227268
#[serde(default)]
228269
pub struct WebSearchConfig {

src/openhuman/config/schema/types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ pub struct Config {
142142
#[serde(default)]
143143
pub multimodal: MultimodalConfig,
144144

145+
#[serde(default)]
146+
pub seltz: SeltzConfig,
147+
145148
#[serde(default)]
146149
pub web_search: WebSearchConfig,
147150

@@ -317,6 +320,7 @@ impl Default for Config {
317320
curl: CurlConfig::default(),
318321
gitbooks: GitbooksConfig::default(),
319322
multimodal: MultimodalConfig::default(),
323+
seltz: SeltzConfig::default(),
320324
web_search: WebSearchConfig::default(),
321325
proxy: ProxyConfig::default(),
322326
cost: CostConfig::default(),

src/openhuman/integrations/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub mod apify;
88
pub mod client;
99
pub mod google_places;
1010
pub mod parallel;
11+
pub mod seltz;
1112
pub mod stock_prices;
1213
pub mod twilio;
1314
pub mod types;
@@ -19,6 +20,7 @@ pub use parallel::{
1920
ParallelChatTool, ParallelDatasetTool, ParallelEnrichTool, ParallelExtractTool,
2021
ParallelResearchTool, ParallelSearchTool,
2122
};
23+
pub use seltz::SeltzSearchTool;
2224
pub use stock_prices::{
2325
StockCommodityTool, StockCryptoSeriesTool, StockExchangeRateTool, StockOptionsTool,
2426
StockQuoteTool,

0 commit comments

Comments
 (0)