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(inference): route summarization to configured summarizer model
Steven Enamakeld2f1c7233438
diff --git a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs b/crates/openhuman-core/src/inference/provider/factory/chat_model.rsindex 2e740cb59c..ca8198a154 100644--- a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs+++ b/crates/openhuman-core/src/inference/provider/factory/chat_model.rs@@ -43,6 +43,10 @@ pub(crate) struct OpenHumanModelFactory<'a> {/// Attach OpenHuman's per-turn multimodal providers using the route this/// factory actually selected. One-shot probes do not need host attachments.pub(crate) attach_host_attachments: bool,+ /// The model the summarization request calls on its own provider route+ /// (`[context] summarizer_model`), in place of that route's model. `None`+ /// keeps the route's model; primary and workload requests ignore it.+ pub(crate) summarizer_model: Option<&'a str>,}impl OpenHumanModelFactory<'_> {@@ -56,10 +60,18 @@ impl OpenHumanModelFactory<'_> {fn provider_for(&self, request: &ModelBuildRequest) -> String {match &request.purpose {- ModelPurpose::Primary | ModelPurpose::Summarization => self- .primary_provider- .map(str::to_owned)- .unwrap_or_else(|| provider_for_role(&request.role, self.config)),+ ModelPurpose::Primary | ModelPurpose::Summarization => {+ let provider = self+ .primary_provider+ .map(str::to_owned)+ .unwrap_or_else(|| provider_for_role(&request.role, self.config));+ match (&request.purpose, self.summarizer_model) {+ (ModelPurpose::Summarization, Some(model)) => {+ route_with_model(&provider, model)+ }+ _ => provider,+ }+ }ModelPurpose::WorkloadTier(_) => provider_for_role(&request.role, self.config),}}@@ -319,6 +331,21 @@ impl OpenHumanModelFactory<'_> {}}+/// `provider` with its model replaced by `model`: the same provider (and so+/// the same credentials, endpoint and route temperature) serving another+/// model. A provider string with no model of its own (a routing sentinel such+/// as `cloud`, or the managed backend's bare `openhuman`) is returned as is;+/// those routes take the model from the request's pin instead.+fn route_with_model(provider: &str, model: &str) -> String {+ match ProviderRoute::parse(provider) {+ Some(route) if route.kind() != RouteKind::Sentinel => match route.temperature {+ Some(temperature) => format!("{}:{model}@{temperature}", route.provider),+ None => format!("{}:{model}", route.provider),+ },+ _ => provider.to_owned(),+ }+}+fn build_one_shot(ctx: &DispatchCtx,role: &str,@@ -333,6 +360,7 @@ fn build_one_shot(egress: &egress,thread_id: None,attach_host_attachments: false,+ summarizer_model: None,};let request = ModelBuildRequest {role: role.to_owned(),diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rsindex 55acc9dc7a..e161081209 100644--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rs@@ -32,6 +32,7 @@ fn build_native_factory_model(egress,thread_id: None,attach_host_attachments: false,+ summarizer_model: None,};let request = ModelBuildRequest {role: "chat".to_owned(),diff --git a/crates/openhuman-core/src/inference/provider/factory_model_gate_tests.rs b/crates/openhuman-core/src/inference/provider/factory_model_gate_tests.rsindex 04ff2cfad8..6f311d84f6 100644--- a/crates/openhuman-core/src/inference/provider/factory_model_gate_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_model_gate_tests.rs@@ -32,6 +32,7 @@ async fn turn_factory_checks_privacy_then_explicit_host_session_before_building_egress: &egress,thread_id: None,attach_host_attachments: false,+ summarizer_model: None,};crate::core::runtime::CoreContext::scope(ambient_library, async {