An AI-powered "Thinking Partner" for energy analysts, designed to synthesize complex financial reports and strategic presentations from Latvenergo. This project demonstrates a production-ready RAG (Retrieval-Augmented Generation) pipeline featuring high-fidelity OCR, a split-compute architecture, and advanced reasoning capabilities.
- Layout-Aware PDF Parsing: Utilizes Docling (IBM/Hugging Face) to reconstruct financial tables into Markdown/JSON. Unlike standard OCR, this maintains the structural integrity of complex energy KPI tables.
- Split-Compute Architecture: Orchestration, UI, and Embeddings run on a Mac M1 Pro (16GB), while high-reasoning LLM inference is offloaded to a Linux Server (128GB RAM) hosting DeepSeek-R1.
- Advanced Retrieval Pipeline: Implements HyDE (Hypothetical Document Embeddings) and LLM-Reranking to ensure that technical queries (like segment revenue or EBITDA drivers) map to the most relevant data chunks.
- Auditability & Traceability: Every response includes an expandable "Reasoning Chain" and specific citations with File Name and Page Number metadata.
- Framework: LlamaIndex (Data Orchestration)
- Vector DB: ChromaDB (Persistent local storage)
- LLMs: DeepSeek-R1 70B (Production) / Qwen3-Coder 30B (Testing) via Ollama
- Embeddings: BAAI/bge-m3 (Multilingual support for Latvian/English)
- Parsing: Docling (JSON export with metadata extraction)
- Environment: Managed via
uv(Faster, deterministic dependency management)
- Install
uv:curl -LsSf https://astral.sh/uv/install.sh | sh - Ensure Ollama is running on your inference server.
# Clone the repo
git clone [https://github.com/anetezepa/EnergyBot_RAG.git](https://github.com/anetezepa/EnergyBot_RAG.git)
cd EnergyBot_RAGCreate virtual environment and sync dependencies
uv syncActivate the environment
source .venv/bin/activateCreate a .env file in the root directory:
OLLAMA_BASE_URL=http://your-linux-ip:11434
DATA_PATH=./docs
uv run streamlit run main_ui.py# Build the image
docker build -t latvenergo-bot .
# Run it (Connects to your host network to reach Ollama)
# On Mac/Linux, adding --network="host" is the easiest way to reach localhost:11434
docker run --network="host" latvenergo-botuv run python test_rag_cases.pyor
uv run python test_rag_connection.pyThe system is currently indexed with Latvenergo Group 9M 2025 data, specifically optimized to track:
- EBITDA shifts and hydroelectricity generation nuances.
- Strategic AER (Renewable Energy) portfolio targets (1,144 MW).
- Cross-referencing 2024 vs 2025 performance drivers.
RAGAS Integration: Implementation of automated metrics for Faithfulness and Relevancy.
Knowledge Graphs: Transitioning to GraphRAG for better entity-relationship mapping between subsidiaries.
CI/CD: Automated vector store updates via GitHub Actions when new reports are uploaded.
