How abinash123hg/semcache-ai-a-local-semantic-caching-system-for-qwen-powered-llm-applications. works
SemCache is a local semantic-cache service in front of Ollama. A user submits a question through the browser UI; the API normalizes it, checks the cache using exact and semantic matching, and on a miss generates and stores an answer. The same API exposes cache management, tuning, analytics, model management, streaming, and benchmark features. The main request flow is visible in the README and sampled API code; some benchmark internals and UI sections were not sampled.
Main entry points: main.py FastAPI routes · cache.py Cache and analytics · benchmark.py Benchmark runner · ollama_client.py Ollama client
Components 12
Browser client
- Web UI
frontend/app.js
API orchestration
- FastAPI routes
backend/main.py - Runtime configuration
backend/config.py
Cache and evaluation
- Cache and analytics
backend/cache.py - SQLite cache
- Benchmark runner
backend/benchmark.py - Benchmark dataset
data/benchmark_dataset.json - Benchmark results
data/results
Embedding and models
- Embedding helpers
backend/embedding.py - Ollama client
backend/ollama_client.py
Other components
- User
- Local Ollama
Connections 13
- User → Web UI: asks question
README.md - Web UI → FastAPI routes: sends requests
frontend/app.js - FastAPI routes → Cache and analytics: checks and records
backend/main.py - FastAPI routes → Embedding helpers: embeds questions
backend/main.py - FastAPI routes → Ollama client: generates and checks
backend/main.py - Embedding helpers → Ollama client: requests embeddings
backend/embedding.py - Ollama client → Local Ollama: calls local API
backend/ollama_client.py - Cache and analytics → SQLite cache: reads and writes
backend/cache.py - Cache and analytics → Runtime configuration: loads defaults
backend/cache.py - FastAPI routes → Runtime configuration: uses settings
backend/main.py - FastAPI routes → Benchmark runner: runs experiments
backend/main.py - Benchmark runner → Benchmark dataset: evaluates pairs
README.md - Benchmark runner → Benchmark results: stores results
README.md