Commit 01487a6
feat(embeddings): Add pluggable embedding provider system for AgenticDB
Implements a proper embedding abstraction layer to replace the hash-based placeholder:
## New Features
### EmbeddingProvider Trait
- Pluggable interface for any embedding system
- Methods: embed(), dimensions(), name()
- Thread-safe (Send + Sync)
### Built-in Providers
- **HashEmbedding**: Original placeholder (default, backward compatible)
- **ApiEmbedding**: Production-ready API providers (OpenAI, Cohere, Voyage AI)
- **CandleEmbedding**: Stub for candle-transformers (feature: real-embeddings)
### AgenticDB Updates
- New constructor: `AgenticDB::with_embedding_provider(options, provider)`
- Backward compatible: `AgenticDB::new(options)` still works with HashEmbedding
- Dimension validation ensures provider matches database configuration
### Files Added
- src/embeddings.rs: Core embedding provider system
- tests/embeddings_test.rs: Comprehensive test suite
- docs/EMBEDDINGS.md: Complete usage documentation
- examples/embeddings_example.rs: Working example
### Usage
```rust
// Production (OpenAI)
let provider = Arc::new(ApiEmbedding::openai(&key, "text-embedding-3-small"));
let db = AgenticDB::with_embedding_provider(options, provider)?;
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent cce57de commit 01487a6
File tree
9 files changed
+1307
-82
lines changed- crates/ruvector-core
- docs
- examples
- src
- tests
9 files changed
+1307
-82
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
| |||
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| 87 | + | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| |||
0 commit comments