Skip to content

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

refactor(embeddings): replace tinyagents_harness dependency with tinyinference

Steven Enamakelc5883a8da61d
diff --git a/src/openhuman/agent/tinyagents/embeddings.rs b/src/openhuman/agent/tinyagents/embeddings.rs
index 30b4320025..f7b0b927ba 100644
--- a/src/openhuman/agent/tinyagents/embeddings.rs
+++ b/src/openhuman/agent/tinyagents/embeddings.rs
@@ -6,8 +6,8 @@
//! (rate-limit + retry). This adapter is a **thin seam**: it wraps an
//! `Arc<dyn EmbeddingProvider>` and re-exposes it as the crate's provider-neutral
//! [`EmbeddingModel`] so the harness's retrieval surface
-//! ([`Retriever`](tinyagents_harness::embeddings::Retriever) /
-//! [`VectorStore`](tinyagents_harness::embeddings::VectorStore)) can drive
+//! ([`Retriever`](tinyinference::embeddings::Retriever) /
+//! [`VectorStore`](tinyinference::embeddings::VectorStore)) can drive
//! OpenHuman embeddings without cloning provider logic.
//!
//! The only real work here is bridging the batch signature: the crate trait
@@ -22,7 +22,7 @@
use std::sync::Arc;
use async_trait::async_trait;
-use tinyagents_harness::embeddings::EmbeddingModel as TaEmbeddingModel;
+use tinyinference::embeddings::EmbeddingModel as TaEmbeddingModel;
use tinyagents::{Result as TaResult, TinyAgentsError};
use crate::openhuman::inference::embeddings::EmbeddingProvider;
diff --git a/src/openhuman/agent/tinyagents/retriever.rs b/src/openhuman/agent/tinyagents/retriever.rs
index 96eb6e99dd..f55c295414 100644
--- a/src/openhuman/agent/tinyagents/retriever.rs
+++ b/src/openhuman/agent/tinyagents/retriever.rs
@@ -43,7 +43,7 @@ use std::collections::HashSet;
use std::sync::{Arc, OnceLock};
use serde_json::json;
-use tinyagents_harness::embeddings::{
+use tinyinference::embeddings::{
EmbeddingModel as TaEmbeddingModel, InMemoryVectorStore, Retriever, ScoredDoc,
};
use tinyagents_harness::events::{AgentEvent, EventSink};
diff --git a/src/openhuman/inference/embeddings/cloud_adapter.rs b/src/openhuman/inference/embeddings/cloud_adapter.rs
index b1e8b0f7ed..19bce91182 100644
--- a/src/openhuman/inference/embeddings/cloud_adapter.rs
+++ b/src/openhuman/inference/embeddings/cloud_adapter.rs
@@ -4,7 +4,7 @@ use std::path::PathBuf;
use std::sync::Arc;
use async_trait::async_trait;
-use tinyagents_harness::embeddings::{
+use tinyinference::embeddings::{
BearerResolver, CloudEmbeddingModel, DEFAULT_CLOUD_DIMENSIONS, DEFAULT_CLOUD_MODEL,
};
diff --git a/src/openhuman/inference/embeddings/factory.rs b/src/openhuman/inference/embeddings/factory.rs
index e56645c38f..cb28ef4eae 100644
--- a/src/openhuman/inference/embeddings/factory.rs
+++ b/src/openhuman/inference/embeddings/factory.rs
@@ -8,7 +8,7 @@ use super::cloud::{
};
use super::provider_trait::{EmbeddingProvider, TinyAgentsEmbeddingProvider};
use crate::openhuman::config::Config;
-use tinyagents_harness::embeddings::{
+use tinyinference::embeddings::{
CohereEmbeddingModel, NoopEmbeddingModel, OllamaEmbeddingModel, OpenAiEmbeddingModel,
VoyageEmbeddingModel,
};
@@ -77,7 +77,7 @@ pub fn create_embedding_provider(
"",
model,
dims,
- tinyagents_harness::embeddings::VOYAGE_API_BASE,
+ tinyinference::embeddings::VOYAGE_API_BASE,
),
)),
"ollama" => {
@@ -133,7 +133,7 @@ pub fn create_embedding_provider_with_credentials(
api_key,
model,
dims,
- tinyagents_harness::embeddings::VOYAGE_API_BASE,
+ tinyinference::embeddings::VOYAGE_API_BASE,
),
)),
"ollama" => {
diff --git a/src/openhuman/inference/embeddings/mod.rs b/src/openhuman/inference/embeddings/mod.rs
index 37164aab09..4c69e1fb3d 100644
--- a/src/openhuman/inference/embeddings/mod.rs
+++ b/src/openhuman/inference/embeddings/mod.rs
@@ -19,17 +19,17 @@ mod factory;
pub mod noop;
mod provider_trait;
pub mod rate_limit {
- pub use tinyagents_harness::embeddings::{
+ pub use tinyinference::embeddings::{
rate_limit as embedding_rate_limit, set_rate_limit as set_embedding_rate_limit,
DEFAULT_REQUESTS_PER_MINUTE as DEFAULT_EMBEDDING_RATE_LIMIT_PER_MIN,
};
pub async fn acquire_embedding_slot(base_url: &str) {
- tinyagents_harness::embeddings::acquire(base_url).await;
+ tinyinference::embeddings::acquire(base_url).await;
}
}
pub mod retry_after {
- pub use tinyagents_harness::embeddings::{
+ pub use tinyinference::embeddings::{
backoff_ms_for_attempt, parse_retry_after_ms, BASE_BACKOFF_MS, MAX_BACKOFF_MS,
MAX_RETRIES as MAX_429_RETRIES,
};
@@ -63,7 +63,7 @@ pub use schemas::{
all_controller_schemas as all_embeddings_controller_schemas,
all_registered_controllers as all_embeddings_registered_controllers,
};
-pub use tinyagents_harness::embeddings::{
+pub use tinyinference::embeddings::{
DEFAULT_OLLAMA_DIMENSIONS, DEFAULT_OLLAMA_MODEL, DEFAULT_OLLAMA_URL,
};
diff --git a/src/openhuman/inference/embeddings/provider_trait.rs b/src/openhuman/inference/embeddings/provider_trait.rs
index 764e08a3b7..7cb92e0d18 100644
--- a/src/openhuman/inference/embeddings/provider_trait.rs
+++ b/src/openhuman/inference/embeddings/provider_trait.rs
@@ -27,7 +27,7 @@
//!
//! The engine keeps its own copy for its own factory. That is not duplication of
//! *state*: the adapter is a stateless newtype over a boxed trait object, both
-//! sides wrap the same `tinyagents_harness::embeddings::EmbeddingModel` (one
+//! sides wrap the same `tinyinference::embeddings::EmbeddingModel` (one
//! crate — the root `[patch.crates-io]` points every consumer at
//! `vendor/tinyagents`), and both produce the same
//! `tinymemory_api::host::EmbeddingProvider`. Nothing reads the other's output,
@@ -39,7 +39,7 @@
//! before this move and one written after land in the same embedding space.
use async_trait::async_trait;
-use tinyagents_harness::embeddings::EmbeddingModel;
+use tinyinference::embeddings::EmbeddingModel;
pub use tinymemory_api::host::{format_embedding_signature, EmbeddingProvider};
diff --git a/src/openhuman/inference/local/model_requirements.rs b/src/openhuman/inference/local/model_requirements.rs
index 40406bac0a..6a78be4241 100644
--- a/src/openhuman/inference/local/model_requirements.rs
+++ b/src/openhuman/inference/local/model_requirements.rs
@@ -2,7 +2,7 @@
//!
//! The memory tree's embedder (`bge-m3`) is requested with
//! `num_ctx = 8192` (see
-//! [`tinyagents_harness::embeddings::RECOMMENDED_OLLAMA_CONTEXT_TOKENS`])
+//! [`tinyinference::embeddings::RECOMMENDED_OLLAMA_CONTEXT_TOKENS`])
//! and the summariser hard-caps its output to fit that 8192-token embed
//! ceiling. A local model whose native context window is below this floor
//! silently truncates chunks/summaries and corrupts recall, so we refuse
@@ -21,7 +21,7 @@ use serde::Serialize;
/// time. Changing the embedder's context request automatically moves the
/// acceptance floor with it.
pub const MIN_CONTEXT_TOKENS: u64 =
- tinyagents_harness::embeddings::RECOMMENDED_OLLAMA_CONTEXT_TOKENS as u64;
+ tinyinference::embeddings::RECOMMENDED_OLLAMA_CONTEXT_TOKENS as u64;
/// Verdict for a single model's context window against
/// [`MIN_CONTEXT_TOKENS`]. Serialized into the diagnostics payload so the
diff --git a/src/openhuman/inference/local/model_requirements_tests.rs b/src/openhuman/inference/local/model_requirements_tests.rs
index 3081ca7022..ef83c6a50b 100644
--- a/src/openhuman/inference/local/model_requirements_tests.rs
+++ b/src/openhuman/inference/local/model_requirements_tests.rs
@@ -6,7 +6,7 @@ fn min_context_tracks_embedder_request() {
// requests; this guards against the two drifting apart.
assert_eq!(
MIN_CONTEXT_TOKENS,
- tinyagents_harness::embeddings::RECOMMENDED_OLLAMA_CONTEXT_TOKENS as u64
+ tinyinference::embeddings::RECOMMENDED_OLLAMA_CONTEXT_TOKENS as u64
);
assert_eq!(MIN_CONTEXT_TOKENS, 8_192);
}
diff --git a/src/openhuman/inference/local/service/vision_embed.rs b/src/openhuman/inference/local/service/vision_embed.rs
index 7b0b05c30c..888b46d07a 100644
--- a/src/openhuman/inference/local/service/vision_embed.rs
+++ b/src/openhuman/inference/local/service/vision_embed.rs
@@ -7,7 +7,7 @@ use crate::openhuman::inference::local::ollama::{
use crate::openhuman::inference::model_ids;
use crate::openhuman::inference::presets::{self, VisionMode};
use crate::openhuman::inference::types::LocalAiEmbeddingResult;
-use tinyagents_harness::embeddings::{
+use tinyinference::embeddings::{
EmbeddingModel, OllamaEmbeddingModel, DEFAULT_OLLAMA_DIMENSIONS,
RECOMMENDED_OLLAMA_CONTEXT_TOKENS,
};