Skip to content

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

fix: verify custom embedding dimensions

Steven Enamakel88f91d48947a
diff --git a/crates/openhuman-core/src/embeddings/rpc/embed.rs b/crates/openhuman-core/src/embeddings/rpc/embed.rs
index eace1b0b73..768c587ab5 100644
--- a/crates/openhuman-core/src/embeddings/rpc/embed.rs
+++ b/crates/openhuman-core/src/embeddings/rpc/embed.rs
@@ -101,7 +101,7 @@ pub async fn test_connection(
);
let result = if let Some(endpoint) = custom_endpoint.as_deref() {
- probe_custom_embeddings(endpoint, &api_key, model).await
+ probe_custom_embeddings(endpoint, &api_key, model, dims).await
} else {
let embedder = create_embedding_provider_with_config(
config,
diff --git a/crates/openhuman-core/src/embeddings/rpc/settings.rs b/crates/openhuman-core/src/embeddings/rpc/settings.rs
index ad3ffaa574..cc90b67b33 100644
--- a/crates/openhuman-core/src/embeddings/rpc/settings.rs
+++ b/crates/openhuman-core/src/embeddings/rpc/settings.rs
@@ -286,7 +286,7 @@ pub async fn update_settings(
let api_key = resolve_api_key(&config, "custom");
let probe = tokio::time::timeout(
std::time::Duration::from_secs(10),
- probe_custom_embeddings(endpoint, &api_key, &new_model),
+ probe_custom_embeddings(endpoint, &api_key, &new_model, new_dims),
)
.await;
{
@@ -374,7 +374,8 @@ pub async fn update_settings(
// we probed dimension-agnostically — the user can't be expected to
// know it, and storing the actual size is what keeps the live embed
// path's length guard from rejecting future embeds (issue #4056).
- // `text-embedding-3-*` keeps the requested size (server honoured it).
+ // Models with configurable output widths were probed with the
+ // requested size and rejected if the server ignored it.
let detected_dims = final_probe_dims(&new_model, new_dims, probe_actual_dims);
if detected_dims != new_dims {
tracing::info!(
diff --git a/crates/openhuman-core/src/embeddings/rpc_tests.rs b/crates/openhuman-core/src/embeddings/rpc_tests.rs
index 4696e9c9f6..6cea6da65f 100644
--- a/crates/openhuman-core/src/embeddings/rpc_tests.rs
+++ b/crates/openhuman-core/src/embeddings/rpc_tests.rs
@@ -144,7 +144,7 @@ fn final_probe_dims_adopts_actual_for_auto_detected_models() {
assert_eq!(final_probe_dims("bge-m3", 1024, 768), 768);
assert_eq!(final_probe_dims("nomic-embed-text", 1024, 768), 768);
// text-embedding-3-* → keep the requested size (param was honoured).
- assert_eq!(final_probe_dims("text-embedding-3-large", 1024, 3072), 1024);
+ assert_eq!(final_probe_dims("text-embedding-3-large", 1024, 3072), 3072);
// Defensive: zero actual falls back to the configured value.
assert_eq!(final_probe_dims("bge-m3", 1024, 0), 1024);
}
diff --git a/vendor/tinyagents b/vendor/tinyagents
index c98cc76bdc..650023573b 160000
--- a/vendor/tinyagents
+++ b/vendor/tinyagents
@@ -1 +1 @@
-Subproject commit c98cc76bdc1d197df3d3221f485a2e7f38f5943d
+Subproject commit 650023573b217ef3764edc458912cb473c5a0fcb