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(tinyhumans): register provider model hooks and error classifier
Steven Enamakel51439cbb0120
diff --git a/crates/openhuman-core/src/inference/registry.rs b/crates/openhuman-core/src/inference/registry.rsindex 9be0532cd7..5f149fea4c 100644--- a/crates/openhuman-core/src/inference/registry.rs+++ b/crates/openhuman-core/src/inference/registry.rs@@ -98,6 +98,8 @@ pub struct ProviderModelHooks {pub context_window: Arc<dyn Fn(&str) -> Option<u64> + Send + Sync>,/// Provider default pricing as (model id, input USD/1M, output USD/1M).pub default_pricing: Arc<dyn Fn() -> Option<(String, f64, f64)> + Send + Sync>,+ /// Applies a provider-specific request hint without exposing its wire key.+ pub without_reasoning: Arc<dyn Fn(tinyinference_llm::model::ModelRequest) -> tinyinference_llm::model::ModelRequest + Send + Sync>,}/// A provider-neutral semantic category for a backend error.@@ -252,6 +254,16 @@ pub fn provider_model_context_window(provider_id: &str, model: &str) -> Option<u(hooks.context_window)(model)}+/// Applies a provider-specific no-reasoning hint when the provider is installed.+pub fn provider_request_without_reasoning(+ provider_id: &str,+ request: tinyinference_llm::model::ModelRequest,+) -> tinyinference_llm::model::ModelRequest {+ provider_model_hooks(provider_id)+ .map(|hooks| (hooks.without_reasoning)(request))+ .unwrap_or(request)+}+/// Registers a generic config normalizer, such as a provider-owned migration/// that must also run after the config schema reaches its current version.pub type ConfigNormalizer = Arc<dyn Fn(&mut Config) -> bool + Send + Sync>;diff --git a/crates/openhuman-embed/src/host_internals.rs b/crates/openhuman-embed/src/host_internals.rsindex f54d18e54d..92cdc7e129 100644--- a/crates/openhuman-embed/src/host_internals.rs+++ b/crates/openhuman-embed/src/host_internals.rs@@ -361,7 +361,8 @@ pub mod inference_registry {register_backend_error_classifier_in, register_catalog, register_catalog_in,register_chat_model, register_chat_model_in, register_config_normalizer,register_config_normalizer_in, register_embedding, register_embedding_in,- resolve_provider_model, unregister_backend_error_classifier, unregister_catalog,+ provider_request_without_reasoning, resolve_provider_model,+ unregister_backend_error_classifier, unregister_catalog,unregister_chat_model, unregister_embedding, BackendErrorClassification,BackendErrorCodeClassifier, BackendErrorKind, BoxFuture, CatalogEntry, CatalogLimits,CatalogListing, CatalogRequest, ChatModelEntry, ChatModelFactory, ChatModelRequest,diff --git a/crates/openhuman-tinyhumans/src/inference/mod.rs b/crates/openhuman-tinyhumans/src/inference/mod.rsindex afdef923c0..8b40625d70 100644--- a/crates/openhuman-tinyhumans/src/inference/mod.rs+++ b/crates/openhuman-tinyhumans/src/inference/mod.rs@@ -20,13 +20,17 @@ mod managed_model;mod managed_reasoning;mod managed_session;mod managed_usage;+mod tiers;+mod backend_error_code;use std::sync::Arc;-use openhuman_embed::__host::config::{Config, MODEL_MANAGED_DEFAULT};+use openhuman_embed::__host::config::Config;use openhuman_embed::__host::inference_registry::{- register_catalog, register_chat_model, register_embedding, BoxFuture, ChatModelEntry,- ChatModelFactory, ChatModelRequest, ReadinessProbe, PROVIDER_OPENHUMAN,+ register_backend_error_classifier, register_catalog, register_chat_model,+ register_config_normalizer, register_embedding, BackendErrorClassification,+ BackendErrorKind, BoxFuture, ChatModelEntry, ChatModelFactory, ChatModelRequest,+ ProviderModelHooks, ReadinessProbe, PROVIDER_OPENHUMAN,};use tinyinference_llm::model::ChatModel;@@ -54,7 +58,8 @@ pub(crate) fn build_chat_model(.model_override.map(str::trim).filter(|model| !model.is_empty())- .unwrap_or(MODEL_MANAGED_DEFAULT)+ .or_else(|| tiers::default_model())+ .expect("TinyHumans registers its managed default").to_string();let default_model = request.default_model@@ -99,12 +104,28 @@ pub(crate) fn register(_options: &InstallOptions) {ChatModelEntry {build,probe: Some(readiness_probe()),+ models: Some(ProviderModelHooks {+ default_model: Arc::new(tiers::default_model),+ role_for_model: Arc::new(tiers::role_for_model),+ is_alias: Arc::new(tiers::is_alias),+ is_raw_model: Arc::new(tiers::is_raw_model),+ supports_vision: Arc::new(tiers::supports_vision),+ resolve_model: Arc::new(tiers::resolve_model),+ context_window: Arc::new(tiers::context_window),+ default_pricing: Arc::new(tiers::default_pricing),+ without_reasoning: Arc::new(managed_reasoning::without_reasoning),+ }),},);register_embedding(PROVIDER_OPENHUMAN, |request| {Ok(Box::new(ManagedEmbeddingModel::from_request(request)))});register_catalog(PROVIDER_OPENHUMAN, managed_catalog::entry());+ register_config_normalizer(+ PROVIDER_OPENHUMAN,+ Arc::new(tiers::normalize_config),+ );+ register_backend_error_classifier(Arc::new(backend_error_code::classify));log::debug!("[tinyhumans] inference: registered the managed chat model, embeddings and catalog");