SurfSense/surfsense_backend/app/services
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
..
__init__.py Fixed all ruff lint and formatting errors 2025-07-24 14:43:48 -07:00
connector_service.py feat: bumped version to v0.0.8 2025-10-16 22:44:12 -07:00
docling_service.py Fixed all ruff lint and formatting errors 2025-07-24 14:43:48 -07:00
grammar_check.py feat: Implement local-first European AI architecture with Mistral NeMo and TildeOpen 2025-11-17 19:58:20 +02:00
kokoro_tts_service.py feat: Added Local TTS (Kokoro TTS) Support 2025-08-13 17:25:34 -07:00
language_detector.py feat: Implement local-first European AI architecture with Mistral NeMo and TildeOpen 2025-11-17 19:58:20 +02:00
llm_service.py feat: added global llm configurations 2025-11-14 21:53:46 -08:00
page_limit_service.py feat: enhance Azure OpenAI embeddings and add voice support for Azure provider 2025-10-30 22:33:47 -07:00
query_service.py feat: moved LLMConfigs from User to SearchSpaces 2025-10-10 00:50:29 -07:00
reranker_service.py Fixed all ruff lint and formatting errors 2025-07-24 14:43:48 -07:00
streaming_service.py chore: removed content trunking for better UI 2025-10-14 14:19:48 -07:00
stt_service.py chore: updated docs & refactored sst_service.py 2025-10-15 14:31:38 -07:00
task_logging_service.py chore: removed chinese comments to pass ruff checks and updated migration nos 2025-10-13 20:07:32 -07:00