Skip to content

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

test(common): add provider model hooks to inference

Steven Enamakel6e345b6aa68b
diff --git a/crates/openhuman-embed/tests/common/mod.rs b/crates/openhuman-embed/tests/common/mod.rs
index 946c274647..210e43b10e 100644
--- a/crates/openhuman-embed/tests/common/mod.rs
+++ b/crates/openhuman-embed/tests/common/mod.rs
@@ -258,7 +258,8 @@ pub struct PointedInference;
impl PointedInference {
pub fn install(base_url: &str) {
use openhuman_embed::__host::inference_registry::{
- register_chat_model, ChatModelEntry, ChatModelRequest, PROVIDER_OPENHUMAN,
+ register_chat_model, ChatModelEntry, ChatModelRequest, ProviderModelHooks,
+ PROVIDER_OPENHUMAN,
};
use tinyinference_llm::providers::openai::OpenAiModel;
@@ -286,7 +287,35 @@ impl PointedInference {
ChatModelEntry {
build: std::sync::Arc::new(build),
probe: None,
- models: None,
+ models: Some(ProviderModelHooks {
+ default_model: std::sync::Arc::new(|| Some("embed-test-model".to_string())),
+ role_for_model: std::sync::Arc::new(|_| None),
+ is_alias: std::sync::Arc::new(|_| false),
+ is_raw_model: std::sync::Arc::new(|model| {
+ !model.trim().is_empty() && !model.starts_with("hint:")
+ }),
+ supports_vision: std::sync::Arc::new(|_| false),
+ resolve_model: std::sync::Arc::new(|_, config, model| {
+ model
+ .map(str::trim)
+ .filter(|model| !model.is_empty() && !model.starts_with("hint:"))
+ .map(str::to_string)
+ .or_else(|| {
+ config
+ .default_model
+ .as_deref()
+ .map(str::trim)
+ .filter(|model| {
+ !model.is_empty() && !model.starts_with("hint:")
+ })
+ .map(str::to_string)
+ })
+ .or_else(|| Some("embed-test-model".to_string()))
+ }),
+ context_window: std::sync::Arc::new(|_| None),
+ default_pricing: std::sync::Arc::new(|| None),
+ without_reasoning: std::sync::Arc::new(|request| request),
+ }),
},
);
}