Skip to content

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

refactor(inference): adjust model resolution logic

Steven Enamakel0c3320be08df
diff --git a/crates/openhuman-core/src/agent/session_host/test_support.rs b/crates/openhuman-core/src/agent/session_host/test_support.rs
index 5af94e4a52..34cb09f5fb 100644
--- a/crates/openhuman-core/src/agent/session_host/test_support.rs
+++ b/crates/openhuman-core/src/agent/session_host/test_support.rs
@@ -59,9 +59,6 @@ fn model_fixture_entry() -> ChatModelEntry {
}),
supports_vision: Arc::new(|_| false),
resolve_model: Arc::new(|role, config, model| {
- if role == "agentic" {
- return Some("test/session-fixture".to_string());
- }
match model {
Some("fixture-reasoning") => Some("test/selected-reasoning".to_string()),
Some(model) if !model.starts_with("hint:") => Some(model.to_string()),
@@ -69,6 +66,7 @@ fn model_fixture_entry() -> ChatModelEntry {
.strip_prefix("hint:")
.filter(|role| crate::config::WORKLOAD_ROLES.contains(role))
.map(|_| "test/session-fixture".to_string()),
+ None if role == "agentic" => Some("test/session-fixture".into()),
None => match config.default_model.as_deref() {
Some("fixture-reasoning") => Some("test/selected-reasoning".into()),
Some(model) => Some(model.to_string()),
diff --git a/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs b/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs
index c500ca2542..3e4efc4376 100644
--- a/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs
@@ -49,6 +49,7 @@ pub(super) fn managed_chat_model(
)
}
+#[allow(clippy::too_many_arguments)]
pub(super) fn managed_chat_model_for(
extensions: Option<&crate::core::slots::Extensions>,
role: &str,
diff --git a/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs b/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs
index e170491c13..87174bea30 100644
--- a/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs
@@ -97,6 +97,8 @@ async fn managed_factory_and_probe_use_the_explicit_provider_entry() {
probe_inference_readiness(&dispatch, "chat", &config)
.await
.expect("explicit model entry is ready");
+ let missing = DispatchCtx::new(CoreContext::for_test(DomainSet::full(), None));
+ assert!(create_chat_model_with_model_id_in(&missing, "chat", &config, 0.0).is_err());
})
.await;
assert!(a_probed.load(Ordering::SeqCst));