Embedding Configuration
Configure embedding providers for semantic search and similarity features.
Configuration File
Section titled “Configuration File”Add to ~/.config/crucible/config.toml:
[embedding]provider = "fastembed"model = "all-MiniLM-L6-v2"batch_size = 32Providers
Section titled “Providers”FastEmbed (Default, Local)
Section titled “FastEmbed (Default, Local)”Fast local embeddings with no API needed:
[embedding]provider = "fastembed"model = "all-MiniLM-L6-v2"Available models:
all-MiniLM-L6-v2- Fast, good quality (default)nomic-embed-text-v1.5- Higher quality, slower
Advantages:
- No API key needed
- Works offline
- Fast for batch processing
- Free
Ollama
Section titled “Ollama”Use Ollama’s embedding models:
[embedding]provider = "ollama"model = "nomic-embed-text"endpoint = "http://localhost:11434"Available models:
nomic-embed-text- Good general purposemxbai-embed-large- Higher quality
Setup:
ollama pull nomic-embed-textOpenAI
Section titled “OpenAI”Use OpenAI’s embedding API:
[embedding]provider = "openai"model = "text-embedding-3-small"Environment variable:
export OPENAI_API_KEY=your-api-keyAvailable models:
text-embedding-3-small- Fast, cost-effectivetext-embedding-3-large- Highest quality
Parameters
Section titled “Parameters”batch_size
Section titled “batch_size”Number of texts to embed at once:
[embedding]batch_size = 32Larger batches are faster but use more memory.
endpoint
Section titled “endpoint”Custom API endpoint:
[embedding]endpoint = "http://localhost:11434" # OllamaEmbedding Dimensions
Section titled “Embedding Dimensions”Different models produce different vector dimensions:
| Model | Dimensions |
|---|---|
all-MiniLM-L6-v2 | 384 |
nomic-embed-text-v1.5 | 768 |
text-embedding-3-small | 1536 |
text-embedding-3-large | 3072 |
Higher dimensions may provide better quality but use more storage.
Processing
Section titled “Processing”Embeddings are generated during cru process:
# Process with current configcru process
# Force regenerate all embeddingscru process --forceStorage
Section titled “Storage”Embeddings are stored in the local database (SQLite by default) at:
<kiln_path>/.crucible/crucible-sqlite.dbChanging embedding provider requires reprocessing with --force.
Example Configurations
Section titled “Example Configurations”Local Development
Section titled “Local Development”[embedding]provider = "fastembed"model = "all-MiniLM-L6-v2"batch_size = 32No setup required.
High Quality Local
Section titled “High Quality Local”[embedding]provider = "ollama"model = "nomic-embed-text"endpoint = "http://localhost:11434"Requires Ollama with model installed.
Cloud API
Section titled “Cloud API”[embedding]provider = "openai"model = "text-embedding-3-small"batch_size = 100Faster with larger batches, but costs per API call.
Memory Constrained
Section titled “Memory Constrained”[embedding]provider = "fastembed"model = "all-MiniLM-L6-v2"batch_size = 8 # Lower memory usageTroubleshooting
Section titled “Troubleshooting””Embedding service unavailable”
Section titled “”Embedding service unavailable””For Ollama, check it’s running:
ollama listSlow processing
Section titled “Slow processing”Increase batch size:
[embedding]batch_size = 64Or use a faster model:
[embedding]provider = "fastembed"model = "all-MiniLM-L6-v2"Out of memory
Section titled “Out of memory”Decrease batch size:
[embedding]batch_size = 8Changed models
Section titled “Changed models”Reprocess to regenerate embeddings:
cru process --forceImplementation
Section titled “Implementation”Source code: crates/crucible-llm/src/embeddings/
Providers:
crates/crucible-llm/src/embeddings/fastembed.rscrates/crucible-llm/src/embeddings/ollama.rscrates/crucible-llm/src/embeddings/openai.rs
See Also
Section titled “See Also”:h config.llm- LLM configuration:h search- Using semantic search- process - Processing reference