Skip to content

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

feat(core): add host attachment support to chat model factory

Steven Enamakel1810c855cba6
diff --git a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs b/crates/openhuman-core/src/inference/provider/factory/chat_model.rs
index cc47ab6397..bf4beab68b 100644
--- a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/chat_model.rs
@@ -21,6 +21,9 @@ pub(crate) struct OpenHumanModelFactory<'a> {
pub(crate) primary_provider: Option<&'a str>,
pub(crate) egress: &'a EgressLedger,
pub(crate) thread_id: Option<&'a str>,
+ /// 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,
}
impl OpenHumanModelFactory<'_> {
@@ -305,6 +308,7 @@ fn build_one_shot(
primary_provider: provider,
egress: &egress,
thread_id: None,
+ attach_host_attachments: false,
};
let request = ModelBuildRequest {
role: role.to_owned(),
@@ -353,7 +357,24 @@ impl ModelFactory<()> for OpenHumanModelFactory<'_> {
model: (!route.model.is_empty()).then(|| route.model.clone()),
temperature: request.opts.temperature,
};
- let model = with_request_defaults(model, opts);
+ let mut model = with_request_defaults(model, opts);
+ if self.attach_host_attachments {
+ model = if self.injected(request).is_some() {
+ crate::attachments::provider::wrap_injected(
+ self.ctx,
+ model,
+ Arc::new(self.config.clone()),
+ )
+ } else {
+ crate::attachments::provider::wrap(
+ self.ctx,
+ model,
+ Arc::new(self.config.clone()),
+ &route.model,
+ &route.provider,
+ )
+ };
+ }
Ok((model, route))
}
}