Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(tinyhumans): route chat model construction through managed builder

Steven Enamakel64ae5c479724
diff --git a/crates/openhuman-tinyhumans/src/inference/mod.rs b/crates/openhuman-tinyhumans/src/inference/mod.rs
index 2b501fcca4..5176a38e76 100644
--- a/crates/openhuman-tinyhumans/src/inference/mod.rs
+++ b/crates/openhuman-tinyhumans/src/inference/mod.rs
@@ -6,7 +6,7 @@
//!
//! | Registry | Registered value |
//! | --- | --- |
-//! | chat models | [`managed_model::OpenHumanBackendModel`] built per request, plus its readiness probe |
+//! | chat models | TinyInference's [`tinyinference_llm::providers::tinyhumans::TinyHumansModel`] with host credentials, plus its readiness probe |
//! | embeddings | [`managed_embedding::ManagedEmbeddingModel`] |
//! | catalogs | the managed `/openai/v1/models?catalog=openrouter` listing and its limits request |
//!
@@ -14,13 +14,11 @@
//! calls it from `install()`.
mod backend_error_code;
-mod managed_calls;
mod managed_catalog;
mod managed_embedding;
mod managed_model;
mod managed_reasoning;
mod managed_session;
-mod managed_usage;
mod tiers;
#[cfg(test)]
pub(crate) use tiers::MODEL_MANAGED_DEFAULT;
@@ -36,7 +34,7 @@ use openhuman_embed::__host::inference_registry::{
use tinyinference_llm::model::ChatModel;
pub use managed_embedding::ManagedEmbeddingModel;
-pub use managed_model::{ManagedOptions, OpenHumanBackendModel};
+pub use managed_model::ManagedOptions;
use crate::install::InstallOptions;
@@ -76,10 +74,14 @@ pub(crate) fn build_chat_model(
request.native_tool_calling,
request.thread_id.is_some()
);
- let model =
- OpenHumanBackendModel::new(request.config.api_url.as_deref(), &options, default_model)
- .with_native_tool_calling(request.native_tool_calling)
- .with_thread_id(request.thread_id);
+ let model = managed_model::build_chat_model(
+ request.config.api_url.as_deref(),
+ &options,
+ &default_model,
+ request.native_tool_calling,
+ request.thread_id,
+ true,
+ )?;
Ok((Arc::new(model), pinned))
}
@@ -89,9 +91,21 @@ fn readiness_probe() -> ReadinessProbe {
Box::pin(async move {
log::debug!("[tinyhumans][inference] readiness probe role={role} model={model}");
let options = managed_options(&config);
- OpenHumanBackendModel::new(config.api_url.as_deref(), &options, model)
- .probe_readiness()
- .await
+ let managed = match managed_model::build_chat_model(
+ config.api_url.as_deref(),
+ &options,
+ &model,
+ true,
+ None,
+ false,
+ ) {
+ Ok(managed) => managed,
+ Err(error) => {
+ log::debug!("[tinyhumans][inference] readiness model construction failed, failing open: {error}");
+ return Ok(());
+ }
+ };
+ managed.probe_readiness().await
})
},
)