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
refactor(inference): update model context window logic
Steven Enamakelb6813e567165
diff --git a/crates/openhuman-core/src/inference/model_context.rs b/crates/openhuman-core/src/inference/model_context.rsindex 34c8d7fef0..7967023c15 100644--- a/crates/openhuman-core/src/inference/model_context.rs+++ b/crates/openhuman-core/src/inference/model_context.rs@@ -45,11 +45,7 @@ pub(crate) fn static_context_window_for_model(model: &str) -> Option<u64> {return Some(window);}- // These generic estimates predate the hosted tier policy and apply to- // concrete model ids regardless of which provider owns them.- if normalized == "chat" {- return Some(1_000_000);- }+ // Keep conservative estimates for generic small-model ids.if normalized.starts_with("gemma") || normalized.contains(":1b") || normalized.contains("270m"){return Some(8_192);diff --git a/crates/openhuman-core/src/inference/model_context_tests.rs b/crates/openhuman-core/src/inference/model_context_tests.rsindex c28fe9c746..35675db2e4 100644--- a/crates/openhuman-core/src/inference/model_context_tests.rs+++ b/crates/openhuman-core/src/inference/model_context_tests.rs@@ -1,7 +1,6 @@use super::*;#[test]fn generic_model_window_patterns_retain_conservative_estimates() {- assert_eq!(context_window_for_model("chat"), Some(1_000_000));assert_eq!(context_window_for_model("gemma-3n-e2b"), Some(8_192));assert_eq!(context_window_for_model("custom-mini:1b"), Some(8_192));assert_eq!(context_window_for_model("llama3:1b"), Some(8_192));diff --git a/crates/openhuman-tinyhumans/src/inference/tiers.rs b/crates/openhuman-tinyhumans/src/inference/tiers.rsindex f42c60a9e2..6cc3510571 100644--- a/crates/openhuman-tinyhumans/src/inference/tiers.rs+++ b/crates/openhuman-tinyhumans/src/inference/tiers.rs@@ -94,7 +94,8 @@ pub(crate) fn supports_vision(model: &str) -> bool {pub(crate) fn context_window(model: &str) -> Option<u64> {let model = model.trim();- if model == MODEL_MANAGED_DEFAULT+ if model == "chat"+ || model == MODEL_MANAGED_DEFAULT|| matches!(role_for_model(model).as_deref(),Some("chat" | "summarization")diff --git a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rsindex 9bc60c6775..8a6dcc0372 100644--- a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs+++ b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs@@ -169,5 +169,10 @@ fn hosted_tier_context_windows_retain_the_legacy_alias_metadata() {] {assert_eq!(super::context_window(model), Some(expected), "{model}");}- assert_eq!(super::context_window("chat"), None);+ assert_eq!(super::context_window("chat"), Some(1_000_000));+ assert!(is_raw_model("chat"));+ assert_eq!(+ resolve_model("chat", &Config::default(), Some("chat")).as_deref(),+ Some("chat")+ );}