Skip to content

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

refactor(embedding_host): expose shared embedding model alias

Steven Enamakel46a142da8f00
diff --git a/crates/openhuman-core/src/inference/embedding_host/mod.rs b/crates/openhuman-core/src/inference/embedding_host/mod.rs
index 5fb2271d6d..0c58c171bc 100644
--- a/crates/openhuman-core/src/inference/embedding_host/mod.rs
+++ b/crates/openhuman-core/src/inference/embedding_host/mod.rs
@@ -28,8 +28,9 @@ pub use factory::{
default_embedding_provider_with_config,
};
pub use rpc::provider_from_config;
-/// The trait a provider built here implements, for hosts that hold one.
-pub use tinyinference_embeddings::EmbeddingModel;
+/// A shared embedding provider as this module's factories return it, nameable
+/// by hosts that hold one without depending on the embeddings crate.
+pub type SharedEmbeddingModel = std::sync::Arc<dyn tinyinference_embeddings::EmbeddingModel>;
pub use schemas::{
all_controller_schemas as all_embeddings_controller_schemas,
all_registered_controllers as all_embeddings_registered_controllers,
diff --git a/crates/openhuman-embed/src/host_internals.rs b/crates/openhuman-embed/src/host_internals.rs
index 3979e21def..569076a0a9 100644
--- a/crates/openhuman-embed/src/host_internals.rs
+++ b/crates/openhuman-embed/src/host_internals.rs
@@ -186,7 +186,7 @@ pub mod inference {
pub mod embedding_host {
pub use openhuman_core::inference::embedding_host::{
default_embedding_provider_for_chat, default_embedding_provider_with_config,
- EmbeddingModel,
+ SharedEmbeddingModel,
};
}
pub mod provider {
diff --git a/crates/openhuman-tinyhumans/src/jev/ranker.rs b/crates/openhuman-tinyhumans/src/jev/ranker.rs
index 57a6c91945..ea8535fcf9 100644
--- a/crates/openhuman-tinyhumans/src/jev/ranker.rs
+++ b/crates/openhuman-tinyhumans/src/jev/ranker.rs
@@ -13,7 +13,7 @@ use openhuman_embed::__host::agent::tinyagents::discovery::{
embedding_provider_is_usable, embedding_tool_ranker_in,
};
use openhuman_embed::__host::config::Config;
-use openhuman_embed::__host::inference::embedding_host::EmbeddingModel;
+use openhuman_embed::__host::inference::embedding_host::SharedEmbeddingModel;
use openhuman_embed::__host::security::approval::ApprovalChatContext;
use tinyjevclient::Client;
use tinytools::{RankCandidate, RankContext, RankError, RankHit, ToolRanker};
@@ -33,7 +33,7 @@ pub type ConfigLoader =
/// its egress disclosure there. The default is the core's configured provider;
/// a test hands in one that records the chat.
pub type EmbedderFactory =
- Arc<dyn Fn(&Config, Option<ApprovalChatContext>) -> Arc<dyn EmbeddingModel> + Send + Sync>;
+ Arc<dyn Fn(&Config, Option<ApprovalChatContext>) -> SharedEmbeddingModel + Send + Sync>;
/// The core's configured embedding provider, routed to the chat when there is one.
fn default_embedder() -> EmbedderFactory {