Skip to content

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

test(inference): add provider model tests module

Steven Enamakelf256a5fd0f9e
diff --git a/crates/openhuman-core/src/inference/provider_model.rs b/crates/openhuman-core/src/inference/provider_model.rs
index 1423d64f49..2f080eb30c 100644
--- a/crates/openhuman-core/src/inference/provider_model.rs
+++ b/crates/openhuman-core/src/inference/provider_model.rs
@@ -70,3 +70,7 @@ pub fn resolve_provider_model_hint(provider_id: &str, hint: &str, config: &Confi
}
route.to_string()
}
+
+#[cfg(test)]
+#[path = "provider_model_tests.rs"]
+mod tests;
diff --git a/crates/openhuman-core/src/inference/provider_model_tests.rs b/crates/openhuman-core/src/inference/provider_model_tests.rs
new file mode 100644
index 0000000000..8052970af5
--- /dev/null
+++ b/crates/openhuman-core/src/inference/provider_model_tests.rs
@@ -0,0 +1,23 @@
+use super::*;
+
+#[test]
+fn absent_provider_keeps_default_absent_and_concrete_model_ids_verbatim() {
+ assert_eq!(
+ crate::inference::registry::provider_default_model("missing-provider"),
+ None
+ );
+ let config = Config::default();
+ assert_eq!(
+ resolve_provider_model_hint("missing-provider", "vendor/model-id", &config),
+ "vendor/model-id"
+ );
+}
+
+#[test]
+fn abstract_hint_markers_do_not_become_raw_model_ids() {
+ assert!(is_abstract_model("missing-provider", "hint:unknown"));
+ assert!(!is_raw_model("missing-provider", "hint:unknown"));
+ assert!(is_raw_model("missing-provider", "vendor/model-id"));
+ assert_eq!(role_for_provider_model("missing-provider", "hint:coding"), "coding");
+ assert_eq!(role_for_provider_model("missing-provider", "hint:unknown"), "chat");
+}