SurfSense/surfsense_backend/app
Ojārs Kapteinis fdef50e78d feat: Implement local-first European AI architecture with Mistral NeMo and TildeOpen
- Add three-tier LLM architecture (Mistral NeMo, TildeOpen, Gemini fallback)
- Fix context window handling for mistral-nemo (128K tokens)
- Add LiteLLM context override to prevent 1M token bug
- Remove Google Analytics tracking from frontend
- Add migration and installation documentation
- Optimize for CPU-only inference on 32GB RAM servers

Performance improvements:
- 95% reduction in API costs
- Response times: 5-25 seconds (down from 30-120s)
- Better Latvian language quality with TildeOpen
- Eliminated timeout errors

Architecture changes:
- Primary: Mistral NeMo 12B (France, local via Ollama)
- Grammar: TildeOpen 30B (Latvia, local via Ollama)
- Fallback: Gemini 2.0 Flash (Google API, emergency only)

Technical fixes:
- Fixed LiteLLM reporting incorrect 1M token context (actual: 128K)
- Created mistral-nemo:128k model with proper num_ctx parameter
- Added context window override in backend utils
- Comprehensive security patterns in .gitignore

Documentation:
- MIGRATION_LOCAL_LLM.md: Complete architecture and history
- INSTALLATION_LOCAL_LLM.md: Step-by-step deployment guide
- PR_DESCRIPTION.md: Detailed PR description
- sync-from-production.sh: Secure deployment script

Tested on production at https://ai.kapteinis.lv since November 17, 2025.

Co-authored-by: Ojārs Kapteiņš <ojars@kapteinis.lv>
Co-authored-by: Claude AI Assistant <code@anthropic.com>
2025-11-17 19:58:20 +02:00
..
agents feat: Implement local-first European AI architecture with Mistral NeMo and TildeOpen 2025-11-17 19:58:20 +02:00
config feat: Implement local-first European AI architecture with Mistral NeMo and TildeOpen 2025-11-17 19:58:20 +02:00
connectors chore: linting 2025-11-03 16:00:58 -08:00
prompts Fixed all ruff lint and formatting errors 2025-07-24 14:43:48 -07:00
retriver recurse fix 2025-08-20 10:21:59 -07:00
routes feat: added global llm configurations 2025-11-14 21:53:46 -08:00
schemas feat: added global llm configurations 2025-11-14 21:53:46 -08:00
services feat: Implement local-first European AI architecture with Mistral NeMo and TildeOpen 2025-11-17 19:58:20 +02:00
tasks Merge pull request #430 from CREDO23/feat/chat-pannel 2025-11-11 17:04:39 -08:00
utils feat: Implement local-first European AI architecture with Mistral NeMo and TildeOpen 2025-11-17 19:58:20 +02:00
__init__.py feat: SurfSense v0.0.6 init 2025-03-14 18:53:14 -07:00
app.py feat: add ProxyHeadersMiddleware to support HTTPS redirects behind proxies 2025-10-31 00:24:53 -07:00
celery_app.py refactor: added batch commits and Increased task time limits in celery_app.py 2025-11-03 15:57:19 -08:00
db.py feat: added global llm configurations 2025-11-14 21:53:46 -08:00
users.py fix: docker backend entrpoint issues 2025-10-28 23:35:53 -07:00