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
refactor(embedding_host): unify custom provider name handling
Steven Enamakelbd19ddfc473e
diff --git a/crates/openhuman-core/src/inference/embedding_host/rpc.rs b/crates/openhuman-core/src/inference/embedding_host/rpc.rsindex 5ceee0d365..5d7587867d 100644--- a/crates/openhuman-core/src/inference/embedding_host/rpc.rs+++ b/crates/openhuman-core/src/inference/embedding_host/rpc.rs@@ -27,6 +27,7 @@ use tinyinference_embeddings::served_models::{use crate::config::Config;use crate::security::credentials::AuthService;+use tinyinference_providers::route::split_custom_provider;use super::factory::create_embedding_provider_with_config;@@ -58,11 +59,11 @@ fn build_embedder(dims: usize,) -> anyhow::Result<Box<dyn tinyinference_embeddings::EmbeddingModel>> {let api_key = resolve_api_key(config, provider_name);- let custom_endpoint = provider_name.strip_prefix("custom:").map(|s| s.to_string());- let provider_slug = if provider_name.starts_with("custom:") {+ let (provider_slug, custom_endpoint) = split_custom_provider(provider_name);+ let provider_slug = if custom_endpoint.is_some() {"custom"} else {- provider_name+ &provider_slug};create_embedding_provider_with_config(config,@@ -75,10 +76,11 @@ fn build_embedder(}pub(crate) fn resolve_api_key(config: &Config, provider_name: &str) -> String {- let slug = if provider_name.starts_with("custom:") {+ let (slug, endpoint) = split_custom_provider(provider_name);+ let slug = if endpoint.is_some() {"custom"} else {- provider_name+ &slug};let cred_provider = format!("embeddings:{slug}");let auth = AuthService::from_config(config);diff --git a/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rs b/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rsindex 3aee247073..41da274a8a 100644--- a/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rs+++ b/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rs@@ -5,6 +5,7 @@ use crate::core::Outcome;use super::{resolve_api_key, LOG_PREFIX};use crate::inference::embedding_host::factory::create_embedding_provider_with_config;+use tinyinference_providers::route::split_custom_provider;use tinyinference_embeddings::probe::probe_custom_embeddings;/// Generates embeddings for the given input texts using the currently@@ -19,18 +20,12 @@ pub async fn embed(let api_key = resolve_api_key(config, provider_name);- let custom_endpoint = if provider_name.starts_with("custom:") {- provider_name- .strip_prefix("custom:")- .map(|s: &str| s.to_string())- } else {- None- };+ let (provider_slug, custom_endpoint) = split_custom_provider(provider_name);- let provider_slug = if provider_name.starts_with("custom:") {+ let provider_slug = if custom_endpoint.is_some() {"custom"} else {- provider_name.as_str()+ provider_slug.as_str()};let embedder = create_embedding_provider_with_config(@@ -80,16 +75,12 @@ pub async fn test_connection(let api_key = resolve_api_key(config, slug);- let custom_endpoint = if slug.starts_with("custom:") {- slug.strip_prefix("custom:").map(|s| s.to_string())- } else {- None- };+ let (provider_slug, custom_endpoint) = split_custom_provider(slug);- let provider_tag = if slug.starts_with("custom:") {+ let provider_tag = if custom_endpoint.is_some() {"custom"} else {- slug+ provider_slug.as_str()};tracing::debug!(