Repository navigation
fix(core): feature-aware embedder default in open() + open_with_backend constructor - #1167
Merged
Merged
Conversation
…backend (#1166) - open() no longer hardcodes the 'onnx' embedder backend. On builds compiled without the onnx feature (e.g. pure vecq mobile profile) the default is now '' (no embedder configured), so the open path no longer fails with a misleading 'onnx disabled' error. - Add Uteke::open_with_backend(path, Option<&str>): explicit backend selection; None opens the store without an embedder for hosts that inject embeddings externally (FFI/mobile pipelines). - Dimension resolution ladder when no embedder is configured: UTEKE_EMBEDDING_DIMS > inferred from persisted embeddings > canonical 768 (DEFAULT_EMBEDDING_DIMS) with a warning. Previously dims 0 reached VecqIndex::new and panicked ('working_dim must be in 1..=0'). - remember() with no embedder stores the row FTS5-only (skips the vector index insert) instead of failing; vector backfill remains possible via uteke repair. - Store::infer_embedding_dims() reads the first persisted embedding length (length(blob)/4). - Tests: open/open_with_backend feature-aware matrix, FTS5 write+search without embedder (serial, UTEKE_EMBEDDING_DIMS), invalid-backend rejection, custom-backend behavior on non-onnx builds. Verified: - vecq-only (--no-default-features --features vecq): 526 passed, 0 failed - default (onnx+usearch): 531 passed, 0 failed - cli/server/mcp vecq build green, fmt clean
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
Cora review follow-up: remember_embed passed the empty (no-embedder) embedding into check_duplicate, and remember_precomputed passed it to auto_link_cosine. Both are cosine-based and meaningless without a vector — guard them on non-empty embeddings. vecq-only: 526 passed; default: 531 passed.
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Uteke::open()no longer hardcodes the"onnx"embedder backend. The default is now feature-aware:"onnx"when the onnx feature is compiled in,""(no embedder) otherwise.Uteke::open_with_backend(path, Option<&str>)—Noneopens the store without an embedder for hosts that inject embeddings externally (mobile/FFI).UTEKE_EMBEDDING_DIMS→ inferred from persisted embeddings (Store::infer_embedding_dims) → canonical 768 with a warning. Fixes the underlyingdims=0panic (working_dim must be in 1..=0) that a naive backend switch would have hit.remember()without an embedder stores rows FTS5-only (vector index insert skipped) instead of failing;uteke repairremains the backfill path.Why
--no-default-features --features vecq) failed atopen()with a misleading onnx-disabled error even though the consumer never requested onnx. Found during the tole embed spike; blocks nothing today (mobile profile is[onnx, vecq]), but the default was wrong and surprising for feature-restricted consumers.Testing
cargo test -p uteke-core --no-default-features --features vecq --lib): 526 passed, 0 failed — including the previously failing open pathcargo test -p uteke-core --lib): 531 passed, 0 failed — no regressioncargo buildfor cli/server/mcp with vecq features: greenopen_with_backend(None)FTS5 write+search round-trip (serial), invalid backend rejection, custom-backend behavior on non-onnx builds