Skip to content

feat: gate ONNX dependencies behind 'onnx' feature - #535

Merged
ajianaz merged 1 commit into
developfrom
fix/issue-533-534-feature-gate-ort
Jul 3, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/issue-533-534-feature-gate-ort

Conversation

@ajianaz

@ajianaz ajianaz commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add optional onnx feature (default enabled) to uteke-core that gates ort, ndarray, tokenizers, and sha2. External consumers (e.g. CorIn) can use default-features = false to skip ONNX compilation while still accessing SQLite, usearch, and remote embedders (Ollama, OpenAI).

Closes #533
Closes #534

Changes

File Change
uteke-core/Cargo.toml Add [features] with default = ["onnx"], gate ort/ndarray/tokenizers/sha2 as optional
uteke-core/src/embed/mod.rs Gate engine module + OnnxEmbedder re-export behind #[cfg(feature = "onnx")]
uteke-core/src/embed/embed_trait.rs Expand doc with all embedder implementations
uteke-core/src/lib.rs Gate OnnxEmbedder re-export + lazy-init/dims calls behind cfg
uteke-cli/Cargo.toml Explicit features = ["onnx"]
uteke-server/Cargo.toml Explicit features = ["onnx"]
uteke-mcp/Cargo.toml Explicit features = ["onnx"]

Verification

  • ✅ cargo check --workspace — pass
  • ✅ cargo check -p uteke-core --no-default-features — pass (feature gate works)
  • ✅ cargo fmt --all -- --check — pass
  • ✅ cargo clippy --workspace --all-targets — pass
  • ✅ cargo test --workspace — 339 passed, 13 ignored

Backward Compatibility

100% — default features unchanged. All existing uteke binaries continue to use ONNX embedding.

Impact on CorIn

CorIn can now depend on uteke-core with default-features = false:

uteke-core = { git = "...", branch = "develop", default-features = false }

This skips ort + numkong compilation issues on x86_64-darwin (#534) and ubuntu-22.04 (#533).

Add optional 'onnx' feature (default enabled) to uteke-core that gates
ort, ndarray, tokenizers, and sha2. External consumers (e.g. CorIn) can
use default-features = false to skip ONNX compilation while still
accessing SQLite, usearch, and remote embedders (Ollama, OpenAI).

All uteke binaries (CLI, Server, MCP) explicitly enable 'onnx' feature.
Verified: compiles both with and without onnx feature. All tests pass.

Closes #533
Closes #534
categories = ["science", "data-structures"]
readme = "../../README.md"

[features]
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

❌ Blocked — critical issues found.

🔴 Error (1)

  • crates/uteke-core/Cargo.toml:13 — The new feature section declares default = ["onnx"], which means uteke-core still enables the ONNX stack unless every dependent explicitly disables default features. This undermines the stated goal of making ONNX optional and keeps pulling in heavy dependencies like ort, ndarray, and tokenizers for normal consumers. The downstream crates in this diff even add features = ["onnx"], but without default-features = false they would still get ONNX anyway via the default feature.

Review powered by cora-cli · BYOK · MIT

@ajianaz
ajianaz merged commit e2d9d99 into develop Jul 3, 2026
8 of 9 checks passed
@ajianaz
ajianaz deleted the fix/issue-533-534-feature-gate-ort branch July 3, 2026 15:27
ajianaz added a commit that referenced this pull request Aug 13, 2026
…te-ort

feat: gate ONNX dependencies behind 'onnx' feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: ort-sys no prebuilt binary for x86_64-apple-darwin fix: numkong build failure on ubuntu-22.04 CI (AVX-512 unsupported)

2 participants