Skip to content

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

refactor(inference): pass context extensions to context window resolution

Steven Enamakel85ebb7e88257
diff --git a/crates/openhuman-core/src/inference/turn_models.rs b/crates/openhuman-core/src/inference/turn_models.rs
index 6ef466ef16..d377eb4f37 100644
--- a/crates/openhuman-core/src/inference/turn_models.rs
+++ b/crates/openhuman-core/src/inference/turn_models.rs
@@ -472,11 +472,16 @@ impl TurnModelSource {
let provider_string = source.primary_override.clone().unwrap_or_else(|| {
crate::inference::provider::provider_for_role(&source.role, &source.config)
});
- crate::inference::context_window::resolve_context_window(
+ let resolved_context = source.ctx().resolved();
+ let extensions = resolved_context
+ .as_deref()
+ .map(crate::core::runtime::CoreContext::extensions);
+ crate::inference::context_window::resolve_context_window_in(
&source.role,
&provider_string,
model,
&source.config,
+ extensions,
)
.await
}
diff --git a/crates/openhuman-core/src/inference/turn_models_tests.rs b/crates/openhuman-core/src/inference/turn_models_tests.rs
index 6bc73322b8..6031ae584b 100644
--- a/crates/openhuman-core/src/inference/turn_models_tests.rs
+++ b/crates/openhuman-core/src/inference/turn_models_tests.rs
@@ -104,6 +104,10 @@ async fn explicit_turn_context_uses_its_model_and_capabilities_over_ambient_cont
),
Some(131_072)
);
+ assert_eq!(
+ source.effective_context_window("context-a-model").await,
+ Some(131_072)
+ );
})
.await;
}