π¦ Embeddings Package v3
/docs/core-features/embeddings-package-v3
The embeddings package (v3.0.0-alpha.12) provides high-performance vector embeddings with multiple backends.
Key Features:
| Feature | Description | Performance |
|---|---|---|
| sql.js backend | Cross-platform SQLite (WASM) | No native compilation needed |
| Document chunking | Configurable overlap and size | Handles large documents |
| Normalization | L2, L1, min-max, z-score | 4 normalization methods |
| Hyperbolic embeddings | PoincarΓ© ball model | Better hierarchical representation |
| agentic-flow ONNX | Integrated ONNX runtime | faster with ONNX runtime than API calls |
| Neural substrate | RuVector integration | Full learning pipeline |
Models Available:
| Model | Dimensions | Speed | Quality |
|---|---|---|---|
all-MiniLM-L6-v2 | 384 | Fast | Good |
all-mpnet-base-v2 | 768 | Medium | Better |
Usage:
bash# Initialize embeddings system npx ruflo@latest embeddings init # Generate embedding for text npx ruflo@latest embeddings embed "authentication patterns" # Batch embed multiple texts npx ruflo@latest embeddings batch --file texts.txt # Search with semantic similarity npx ruflo@latest embeddings search "login flow" --top-k 5
Programmatic:
typescriptimport { createEmbeddingServiceAsync } from '@claude-flow/embeddings'; const service = await createEmbeddingServiceAsync({ model: 'all-MiniLM-L6-v2', hyperbolic: true, // Enable PoincarΓ© ball embeddings cacheSize: 256 }); // Generate embedding const embedding = await service.embed("authentication flow"); // Search similar patterns const results = await service.search("login", { topK: 5 });