feat: expose embedding provider model signatures#1901
Conversation
📝 WalkthroughWalkthroughEmbeddingProvider trait now requires a ChangesEmbeddingProvider model_id expansion
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/openhuman/embeddings/mod.rs (1)
79-79: ⚡ Quick winAvoid hardcoding the default model name in the signature assertion.
This assertion duplicates the model literal (
"bge-m3") instead of reusingDEFAULT_OLLAMA_MODEL, which makes the test brittle when defaults change.♻️ Proposed fix
- assert_eq!(p.signature(), "provider=ollama;model=bge-m3;dims=768"); + assert_eq!( + p.signature(), + format!("provider=ollama;model={DEFAULT_OLLAMA_MODEL};dims=768") + );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openhuman/embeddings/mod.rs` at line 79, The test currently hardcodes the default Ollama model in the signature assertion; update the assertion to use the constant DEFAULT_OLLAMA_MODEL instead of the literal "bge-m3" so it automatically reflects changes to the default. Locate the assertion comparing p.signature() and replace the hardcoded model fragment with a constructed expected string that interpolates DEFAULT_OLLAMA_MODEL (keeping "provider=ollama" and "dims=768" as before) so the test remains correct when DEFAULT_OLLAMA_MODEL changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/openhuman/embeddings/mod.rs`:
- Line 79: The test currently hardcodes the default Ollama model in the
signature assertion; update the assertion to use the constant
DEFAULT_OLLAMA_MODEL instead of the literal "bge-m3" so it automatically
reflects changes to the default. Locate the assertion comparing p.signature()
and replace the hardcoded model fragment with a constructed expected string that
interpolates DEFAULT_OLLAMA_MODEL (keeping "provider=ollama" and "dims=768" as
before) so the test remains correct when DEFAULT_OLLAMA_MODEL changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0948dff6-bc4e-4130-b092-4b68bb84facd
📒 Files selected for processing (9)
src/openhuman/embeddings/cloud.rssrc/openhuman/embeddings/mod.rssrc/openhuman/embeddings/noop.rssrc/openhuman/embeddings/ollama.rssrc/openhuman/embeddings/ollama_tests.rssrc/openhuman/embeddings/openai.rssrc/openhuman/embeddings/openai_tests.rssrc/openhuman/embeddings/provider_trait.rssrc/openhuman/embeddings/store_tests.rs
Co-authored-by: honor2030 <19909783+honor2030@users.noreply.github.com>
Summary
EmbeddingProvider::model_id()so each embedder can expose the configured embedding modelEmbeddingProvider::signature()derived from provider, model, and dimensionsWhy this slice
This is the first small, reviewable step toward #1574. It creates a stable embedding-space identity that later storage/migration PRs can attach to rows without changing vector storage behavior in this PR.
Non-goals
Test Plan
cargo fmt --allRUSTC=/Users/lee/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin/rustc GGML_NATIVE=OFF cargo test -p openhuman --lib openhuman::embeddings -- --nocapture(109 passed)RUSTC=/Users/lee/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin/rustc GGML_NATIVE=OFF cargo check -p openhumangit diff --checkRefs #1574
Summary by CodeRabbit