Skip to content

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

test(inference): update catalog tests for new list signature

Steven Enamakel0303d4fae35e
diff --git a/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs b/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs
index d9bd844851..b984277c41 100644
--- a/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs
@@ -4,7 +4,7 @@ use super::*;
async fn managed_factory_and_probe_use_the_explicit_provider_entry() {
use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};
use crate::core::slots::Extensions;
- use crate::inference::registry::{ChatModelEntry, ProviderModelMetadata};
+ use crate::inference::registry::{ChatModelEntry, ProviderContext, ProviderModelMetadata};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use tinyinference_llm::message::Message;
@@ -134,7 +134,7 @@ async fn hosted_cloud_slug_uses_explicit_auth_policy_and_model_entry() {
use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};
use crate::core::slots::Extensions;
use crate::inference::registry::{
- register_catalog_in, CatalogEntry, ChatModelEntry, ProviderModelMetadata,
+ register_catalog_in, CatalogEntry, CatalogRequest, ChatModelEntry, ProviderContext, ProviderModelMetadata,
};
use std::sync::Arc;
use tinyinference_llm::message::Message;
@@ -165,9 +165,9 @@ async fn hosted_cloud_slug_uses_explicit_auth_policy_and_model_entry() {
}
}
- fn catalog(name: &'static str) -> CatalogEntry {
+ fn catalog(name: &'static str) -> CatalogEntry<ProviderContext> {
CatalogEntry {
- list: Arc::new(|_, _| {
+ list: Arc::new(|_| {
Box::pin(async { Err("model listing is not used by this test".to_string()) })
}),
limits: Some(Arc::new(move |model, _| {
diff --git a/crates/openhuman-core/src/inference/registry_tests.rs b/crates/openhuman-core/src/inference/registry_tests.rs
index be71b1e41a..3762235c37 100644
--- a/crates/openhuman-core/src/inference/registry_tests.rs
+++ b/crates/openhuman-core/src/inference/registry_tests.rs
@@ -148,12 +148,9 @@ async fn a_registered_catalog_answers_the_model_listing_for_its_provider() {
register_catalog(
"fake-catalog",
CatalogEntry {
- list: Arc::new(|_, _| {
+ list: Arc::new(|_| {
Box::pin(async {
- Ok(Outcome::new(
- serde_json::json!({ "models": [{ "id": "registered" }] }),
- vec![],
- ))
+ Ok(serde_json::json!({ "models": [{ "id": "registered" }] }))
})
}),
limits: None,
@@ -186,7 +183,7 @@ fn a_registered_catalog_supplies_the_managed_limits_request() {
register_catalog(
PROVIDER_OPENHUMAN,
CatalogEntry {
- list: Arc::new(|_, _| Box::pin(async { Err("unused".to_string()) })),
+ list: Arc::new(|_| Box::pin(async { Err("unused".to_string()) })),
limits: Some(Arc::new(|model, _| {
Some(DiscoveryRequest::new("https://catalog.example/v1", model))
})),
@@ -241,9 +238,9 @@ async fn a_registered_catalog_receives_the_entrys_provider_key() {
register_catalog(
PROVIDER_OPENHUMAN,
CatalogEntry {
- list: Arc::new(move |_, request| {
- *sink.lock().unwrap() = request.provider_key.clone();
- Box::pin(async { Ok(Outcome::new(serde_json::json!({ "models": [] }), vec![])) })
+ list: Arc::new(move |request: CatalogRequest<ProviderContext>| {
+ *sink.lock().unwrap() = request.context.catalog.as_ref().unwrap().request.provider_key.clone();
+ Box::pin(async { Ok(serde_json::json!({ "models": [] })) })
}),
limits: None,
},