Skip to content

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

feat(core): add provider model role resolution

Steven Enamakelb5e4c01a84ac
diff --git a/crates/openhuman-core/src/inference/provider_model.rs b/crates/openhuman-core/src/inference/provider_model.rs
index 3a9ab2385b..a5d7e1a55d 100644
--- a/crates/openhuman-core/src/inference/provider_model.rs
+++ b/crates/openhuman-core/src/inference/provider_model.rs
@@ -1,7 +1,7 @@
//! Provider-neutral helpers for resolving model ids against registered model
//! vocabularies.
-use crate::config::Config;
+use crate::config::{Config, WORKLOAD_ROLES};
/// The workload role represented by a provider-specific model alias, defaulting
/// to the generic `chat` role for concrete and unknown ids.
@@ -10,6 +10,14 @@ pub fn role_for_model(provider_id: &str, model: &str) -> String {
.unwrap_or_else(|| "chat".to_string())
}
+/// Generic workload role for a provider-owned model alias.
+pub fn role_for_provider_model(provider_id: &str, model: &str) -> &'static str {
+ let role = crate::inference::registry::provider_model_role(provider_id, model);
+ role.as_deref()
+ .and_then(|role| WORKLOAD_ROLES.iter().copied().find(|known| *known == role))
+ .unwrap_or("chat")
+}
+
/// Whether `model` is a provider-owned alias or a concrete model id.
pub fn is_raw_model(provider_id: &str, model: &str) -> bool {
crate::inference::registry::provider_model_is_raw(provider_id, model)
@@ -17,7 +25,7 @@ pub fn is_raw_model(provider_id: &str, model: &str) -> bool {
/// Resolve a model hint according to the configured provider route and the
/// route's registered provider model policy.
-pub fn resolve_model_hint(provider_id: &str, hint: &str, config: &Config) -> String {
+pub fn resolve_provider_model_hint(provider_id: &str, hint: &str, config: &Config) -> String {
let trimmed = hint.trim();
if trimmed.is_empty() {
return trimmed.to_string();