anhmtk/StillMe-Learning-AI-System-RAG-Foundation
[FEATURE] Integrate Ollama Local AI (llama3.1:8b) Support
Aberta
#55 aberto em 3 de nov. de 2025
aibackendenhancementgood first issue
Métricas do repositório
- Stars
- (6 estrelas)
- Métricas de merge de PR
- (Métricas PR pendentes)
Description
📋 Description
Hiện tại StillMe chỉ support DeepSeek (cloud) và OpenAI (cloud). Mục tiêu là thêm support cho Ollama local AI (llama3.1:8b) để:
- Giảm cost khi dùng local model
- Faster response cho simple queries
- Privacy-first option (no data sent to cloud)
🎯 Current Status
- ✅ Code đã có trong legacy folder
- ✅ Ollama đã được install và pull model llama3.1:8b
- ❌ Chưa integrate vào backend API
- ❌ Smart router chưa hỗ trợ routing local vs cloud
🛠️ Technical Requirements
- Integrate Ollama client vào
backend/api/main.py - Implement Smart Router logic:
- Simple queries → Ollama local (llama3.1:8b)
- Complex queries → DeepSeek cloud
- Fallback: Ollama → DeepSeek nếu Ollama fail
- Add Ollama health check endpoint
- Update
generate_ai_response()để support Ollama
📁 Files to Modify
backend/api/main.py- Add Ollama integrationbackend/services/- Create Ollama client service (optional)dashboard.py- Update model selection.env.example- Add OLLAMA_BASE_URL config
🧪 Testing Requirements
- Test Ollama connection
- Test Smart Router logic
- Test fallback mechanism
- Test với simple vs complex queries
💡 Implementation Ideas
- Use
requestshoặchttpxđể call Ollama API - Ollama endpoint:
http://localhost:11434/api/generate - Model:
llama3.1:8b - Smart routing based on:
- Query complexity (length, keywords)
- Estimated response time
- Ollama availability
✅ Acceptance Criteria
- Ollama integration working
- Smart router correctly routes queries
- Fallback mechanism works
- Health check endpoint responds
- Dashboard model selection works
🤝 Willing to Contribute?
- Yes, tôi có thể implement
- Maybe, cần guidance
- No, chỉ muốn suggest
📚 References
- Ollama API: https://github.com/ollama/ollama/blob/main/docs/api.md
- Legacy code:
legacy/stillme_core/adapters/ollama_client.py(reference)