Skip to content

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

refactor(core): simplify turn model source logic

Steven Enamakel7d8e5ad66c9d
diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
index f0e1488e54..77ac3d79d7 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -269,15 +269,7 @@ impl OpenHumanSessionHost {
// layers on the turn path (it still governs the non-seam provider paths).
let (mut model_name, supports_native) = match &turn_model_source {
Some((source, model_name)) => {
- let models = source.build(
- model_name,
- target_def.map_or(config.default_temperature, |definition| {
- definition.temperature
- }),
- None,
- None,
- )?;
- (model_name.clone(), models.native_tools())
+ (model_name.clone(), source.supports_native_tool_calling())
}
None => {
let (resolved_chat_model, model_name) =
diff --git a/crates/openhuman-core/src/inference/turn_models.rs b/crates/openhuman-core/src/inference/turn_models.rs
index 317fbf48ac..6fbbb6758c 100644
--- a/crates/openhuman-core/src/inference/turn_models.rs
+++ b/crates/openhuman-core/src/inference/turn_models.rs
@@ -357,24 +357,20 @@ impl TurnModelSource {
.host_overrides()
.and_then(|local| local.model_for(&source.role))
{
- return custom
- .profile()
- .cloned()
- .unwrap_or_default()
- .tool_calling;
+ return custom.profile().cloned().unwrap_or_default().tool_calling;
}
}
if let Some(direct) = &self.direct_model {
- return direct
- .profile()
- .cloned()
- .unwrap_or_default()
- .tool_calling;
+ return direct.profile().cloned().unwrap_or_default().tool_calling;
}
if let Some(source) = &self.crate_native {
- let provider_string = source.primary_override.as_deref().map(str::to_owned).unwrap_or_else(|| {
- crate::inference::provider::provider_for_role(&source.role, &source.config)
- });
+ let provider_string = source
+ .primary_override
+ .as_deref()
+ .map(str::to_owned)
+ .unwrap_or_else(|| {
+ crate::inference::provider::provider_for_role(&source.role, &source.config)
+ });
return !tinyinference_local::profile::is_local_provider_string(&provider_string);
}
false
diff --git a/crates/openhuman-core/src/triage/escalation_model_tests.rs b/crates/openhuman-core/src/triage/escalation_model_tests.rs
index 38339b7701..65a6cc67cb 100644
--- a/crates/openhuman-core/src/triage/escalation_model_tests.rs
+++ b/crates/openhuman-core/src/triage/escalation_model_tests.rs
@@ -1,12 +1,10 @@
use super::*;
use crate::agent_registry::host_definition::AgentDefinitionRegistry;
use crate::core::events::DomainEvent;
-use serde_json::json;
use std::sync::{Arc, Mutex};
use tinyinference_llm::model::{
ChatModel, ModelProfile, ModelRequest, ModelResponse, ModelStream, ModelStreamItem,
};
-use tokio::time::{Duration, sleep, timeout};
struct TriageReplyModel {
requests: Arc<Mutex<Vec<(String, String, ModelRequest)>>>,