IBEX 35 RAG
It turns the PDF reports of the companies in Spain's IBEX 35 index into a hybrid Qdrant index (dense embeddings plus BM25) and answers questions with a local LLM served by Ollama. The RAG core runs fully locally and needs no API keys; only the agent mode, with live market data, goes out to the internet.
How a question is answered
- Caches first: an exact-match Redis cache, then a semantic cache.
- Intent extraction: which companies, year and quarter the question is about.
- Hybrid search, in parallel per company, then cross-encoder reranking with a minimum number of chunks per company, so no company is crowded out in comparisons.
- Coverage gate: before generating, it checks that every company and period asked for is actually in the retrieved context. If not, it abstains and says why, instead of letting the LLM guess.
- Answer, streamed token by token, and stored in both caches.
Questions about companies outside the index (Tesla, Apple…) are turned down right away, without touching the index. Market and price questions are routed to a LangGraph agent that combines the reports with live data.
Built like production
The stack is deliberately bigger than a single-user app needs. Answering questions takes five services; the other eleven show how it would be run in production: Prometheus, Grafana, Loki, Tempo, OpenTelemetry and Alertmanager, plus rate limiting, structured logs and online RAG quality metrics with RAGAS.