docs: Add clear documentation for Ollama embedding usage
This commit is contained in:
25
README.md
25
README.md
@@ -98,6 +98,27 @@ uv sync
|
||||
</details>
|
||||
|
||||
|
||||
### 🆕 Using Ollama for Embeddings (Privacy-Focused)
|
||||
|
||||
LEANN now supports Ollama for generating embeddings locally, perfect for privacy-sensitive applications:
|
||||
|
||||
```bash
|
||||
# First, pull an embedding model from Ollama
|
||||
ollama pull nomic-embed-text # or mxbai-embed-large, bge-m3, etc.
|
||||
|
||||
# Build an index using Ollama embeddings
|
||||
leann build my-project --docs ./documents --embedding-model nomic-embed-text --embedding-mode ollama
|
||||
|
||||
# Use with example apps
|
||||
python -m apps.document_rag --embedding-model nomic-embed-text --embedding-mode ollama --query "Your question"
|
||||
```
|
||||
|
||||
**Available Ollama Embedding Models:**
|
||||
- `nomic-embed-text`: High-performing 768-dim embeddings
|
||||
- `mxbai-embed-large`: Large 1024-dim embeddings
|
||||
- `bge-m3`: Multilingual embeddings
|
||||
- See [Ollama library](https://ollama.com/library) for more embedding models
|
||||
|
||||
## Quick Start
|
||||
|
||||
Our declarative API makes RAG as easy as writing a config file.
|
||||
@@ -189,8 +210,8 @@ All RAG examples share these common parameters. **Interactive mode** is availabl
|
||||
--force-rebuild # Force rebuild index even if it exists
|
||||
|
||||
# Embedding Parameters
|
||||
--embedding-model MODEL # e.g., facebook/contriever, text-embedding-3-small or mlx-community/multilingual-e5-base-mlx
|
||||
--embedding-mode MODE # sentence-transformers, openai, or mlx
|
||||
--embedding-model MODEL # e.g., facebook/contriever, text-embedding-3-small, nomic-embed-text, or mlx-community/multilingual-e5-base-mlx
|
||||
--embedding-mode MODE # sentence-transformers, openai, mlx, or ollama
|
||||
|
||||
# LLM Parameters (Text generation models)
|
||||
--llm TYPE # LLM backend: openai, ollama, or hf (default: openai)
|
||||
|
||||
@@ -49,14 +49,25 @@ Based on our experience developing LEANN, embedding models fall into three categ
|
||||
- **Cons**: Slower inference, longer index build times
|
||||
- **Use when**: Quality is paramount and you have sufficient compute resources. **Highly recommended** for production use
|
||||
|
||||
### Quick Start: OpenAI Embeddings (Fastest Setup)
|
||||
### Quick Start: Cloud and Local Embedding Options
|
||||
|
||||
**OpenAI Embeddings (Fastest Setup)**
|
||||
For immediate testing without local model downloads:
|
||||
```bash
|
||||
# Set OpenAI embeddings (requires OPENAI_API_KEY)
|
||||
--embedding-mode openai --embedding-model text-embedding-3-small
|
||||
```
|
||||
|
||||
**Ollama Embeddings (Privacy-Focused)**
|
||||
For local embeddings with complete privacy:
|
||||
```bash
|
||||
# First, pull an embedding model
|
||||
ollama pull nomic-embed-text
|
||||
|
||||
# Use Ollama embeddings
|
||||
--embedding-mode ollama --embedding-model nomic-embed-text
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary><strong>Cloud vs Local Trade-offs</strong></summary>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user