86 lines
2.2 KiB
Markdown
86 lines
2.2 KiB
Markdown
# Ollama Integration Complete ✅
|
|
|
|
## What Was Added
|
|
|
|
1. **Ollama Service in Docker Compose**
|
|
- Runs Ollama server on port 11434
|
|
- Persists models in `ollama_data` volume
|
|
- Health check ensures service is ready
|
|
|
|
2. **Automatic Model Download**
|
|
- `ollama-setup` service automatically pulls `phi3:latest` (2.2GB)
|
|
- Runs once on first startup
|
|
- Model is cached in volume for future use
|
|
|
|
3. **Configuration Files**
|
|
- `docs/OLLAMA_SETUP.md` - Comprehensive setup guide
|
|
- `configure-ollama.sh` - Helper script to switch between Docker/external Ollama
|
|
- Updated `README.md` with Ollama setup instructions
|
|
|
|
4. **Environment Configuration**
|
|
- Updated `backend/.env` to use `http://ollama:11434` (internal Docker network)
|
|
- All services can now communicate with Ollama via Docker network
|
|
|
|
## Current Status
|
|
|
|
✅ Ollama service running and healthy
|
|
✅ phi3:latest model downloaded (2.2GB)
|
|
✅ Translation feature working with integrated Ollama
|
|
✅ Summarization feature working with integrated Ollama
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# Start all services (including Ollama)
|
|
docker-compose up -d
|
|
|
|
# Wait for model download (first time only, ~2-5 minutes)
|
|
docker-compose logs -f ollama-setup
|
|
|
|
# Verify Ollama is ready
|
|
docker-compose exec ollama ollama list
|
|
|
|
# Test the system
|
|
docker-compose exec crawler python crawler_service.py 1
|
|
```
|
|
|
|
## Switching Between Docker and External Ollama
|
|
|
|
```bash
|
|
# Use integrated Docker Ollama (recommended)
|
|
./configure-ollama.sh
|
|
# Select option 1
|
|
|
|
# Use external Ollama server
|
|
./configure-ollama.sh
|
|
# Select option 2
|
|
```
|
|
|
|
## Performance Notes
|
|
|
|
- First request: ~6 seconds (model loading)
|
|
- Subsequent requests: 0.5-2 seconds (cached)
|
|
- Translation: 0.5-6 seconds per title
|
|
- Summarization: 5-90 seconds per article (depends on length)
|
|
|
|
## Resource Requirements
|
|
|
|
- RAM: 4GB minimum for phi3:latest
|
|
- Disk: 2.2GB for model storage
|
|
- CPU: Works on CPU, GPU optional
|
|
|
|
## Alternative Models
|
|
|
|
To use a different model:
|
|
|
|
1. Update `OLLAMA_MODEL` in `backend/.env`
|
|
2. Pull the model:
|
|
```bash
|
|
docker-compose exec ollama ollama pull <model-name>
|
|
```
|
|
|
|
Popular alternatives:
|
|
- `gemma2:2b` - Smaller, faster (1.6GB)
|
|
- `llama3.2:latest` - Larger, more capable (2GB)
|
|
- `mistral:latest` - Good balance (4.1GB)
|