The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(ranker): switch default strategy to RetrieveThenDecide and fail on missing embeddings
Steven Enamakelb8b5a0c160dd
diff --git a/crates/openhuman-tinyhumans/src/jev/ranker.rs b/crates/openhuman-tinyhumans/src/jev/ranker.rsindex 33c6236261..4c020c5913 100644--- a/crates/openhuman-tinyhumans/src/jev/ranker.rs+++ b/crates/openhuman-tinyhumans/src/jev/ranker.rs@@ -66,12 +66,14 @@ impl Default for TinyHumansJevRanker {}impl TinyHumansJevRanker {- /// A ranker with the product defaults: family-then-decide (the- /// evaluator picks the toolkit or pack, then the tool), the process's- /// embedding provider as the retriever for any family too large for one- /// choice, a 3 s deadline per evaluation.+ /// A ranker with the product defaults: the process's embedding provider+ /// retrieves the top 20 tools by meaning, one Jev evaluation decides+ /// (`RetrieveThenDecide`), 6 s deadline per evaluation. Without a usable+ /// embedding provider the search does not run and the harness ranks+ /// with BM25 alone — a lexical shortlist would cap Jev at BM25's recall,+ /// which the bench measured at 70% on the Composio catalogue.pub fn new() -> Self {- Self::with_config(JevRankerConfig::new().with_strategy(JevStrategy::FamilyThenDecide))+ Self::with_config(JevRankerConfig::new().with_strategy(JevStrategy::RetrieveThenDecide))}/// A ranker with an explicit `tinytools-jev` configuration.@@ -139,7 +141,7 @@ impl TinyHumansJevRanker {// across rebuilds so the catalogue is embedded once per process.let retriever: Arc<dyn ToolRanker> = match cached.as_ref() {Some(entry) => entry.retriever.clone(),- None => retriever_for(&config),+ None => retriever_for(&config)?,};let ranker = JevRanker::new(evaluator,@@ -163,32 +165,39 @@ impl TinyHumansJevRanker {}}-/// The semantic retriever for `config`'s embedding provider, or BM25 when-/// the provider cannot embed (`none`, or a managed provider with no route).-fn retriever_for(config: &Config) -> Arc<dyn ToolRanker> {+/// The semantic retriever for `config`'s embedding provider.+///+/// A provider that cannot embed (`none`) is an error, not a BM25 substitute:+/// the harness answers the search with its own BM25 catalogue in that case,+/// and a Jev decision over a lexical shortlist would only add a network+/// round trip to the same recall.+fn retriever_for(config: &Config) -> Result<Arc<dyn ToolRanker>, RankError> {let provider = openhuman_core::inference::embedding_host::default_embedding_provider_with_config(config,);if !EmbeddingToolRanker::provider_is_usable(provider.as_ref()) {log::info!(- "[tool-search] embedding provider `{}` cannot embed; retrieving with bm25",+ "[tool-search] embedding provider `{}` cannot embed; jev search disabled, bm25 answers",provider.name());- return Arc::new(tinytools::Bm25Ranker);+ return Err(RankError::backend(format!(+ "no usable embedding provider (`{}`); jev search disabled",+ provider.name()+ )));}log::info!("[tool-search] retrieving with embeddings ({} / {})",provider.name(),provider.model_id());- Arc::new(+ Ok(Arc::new(EmbeddingToolRanker::new(provider).with_disk_cache(config.workspace_dir.join("cache").join("tool_search_embeddings.json"),),- )+ ))}fn fingerprint(secret: &str, base_url: &str) -> u64 {diff --git a/crates/openhuman-tinyhumans/src/jev/ranker_tests.rs b/crates/openhuman-tinyhumans/src/jev/ranker_tests.rsindex b3b7501e57..d91995a832 100644--- a/crates/openhuman-tinyhumans/src/jev/ranker_tests.rs+++ b/crates/openhuman-tinyhumans/src/jev/ranker_tests.rs@@ -51,3 +51,24 @@ async fn no_credential_is_a_backend_error_naming_the_gap() {other => panic!("expected a backend error, got {other}"),}}++/// A config whose embedding provider is `none` disables the Jev search+/// outright — the harness's BM25 answers — rather than quietly retrieving+/// lexically.+#[test]+fn no_embedding_provider_disables_the_search() {+ let tmp = tempfile::tempdir().expect("tempdir");+ let mut config = Config {+ workspace_dir: tmp.path().join("workspace"),+ action_dir: tmp.path().join("workspace"),+ config_path: tmp.path().join("config.toml"),+ ..Config::default()+ };+ config.memory.embedding_provider = "none".into();+ let err = retriever_for(&config).err().map(|e| e.to_string());+ assert!(+ err.as_deref()+ .is_some_and(|e| e.contains("no usable embedding provider")),+ "{err:?}"+ );+}