Course RAG Assistant
Local RAG assistant for querying CINF104 course PDFs using Ollama, LangChain, and ChromaDB.
01 Problem and context
Estudiar un curso desde decenas de PDF implica buscar a mano; los buscadores por palabra clave fallan con preguntas en lenguaje natural y los LLM genéricos alucinan contenido que no está en el material.
02 Solution
Pipeline RAG con LangChain (LCEL): carga de PDF con PyPDF, chunking recursivo (1000/200), embeddings FastEmbed (BAAI/bge-small-en-v1.5) y recuperación top-5 desde ChromaDB. La generación corre en LLMs locales vía Ollama (llama3:8b, mistral, phi) con un prompt que restringe la respuesta al contexto recuperado, cita la página fuente y responde explícitamente cuando la información no está en los documentos.
03 How it's built
Conversational assistant based on RAG (Retrieval-Augmented Generation) architecture to query PDF materials from the CINF104 — Machine Learning course in natural language. It indexes documents using local embeddings (FastEmbed) in ChromaDB and answers using local LLMs served by Ollama, with a LangChain chain that restricts responses to the retrieved context. The entire solution (Streamlit app and Ollama server) is orchestrated with Docker Compose, featuring model and vector database persistence.
04 Highlights
- End-to-end RAG pipeline built with LangChain (LCEL): PyPDF, recursive chunking (1000/200), FastEmbed embeddings, and top-5 retrieval from ChromaDB.
- 100% local and private execution: LLMs served via Ollama in a Docker container, with no external API dependencies.
- Docker Compose orchestration of two services (Ollama and Streamlit app) with a dedicated network and persistent volumes.
- Streamlit chat interface with dynamic model selection (llama3:8b, mistral, phi) and temperature control.
- RAG prompt constrained to the retrieved context, with source page citations and explicit responses when information is not found in the documents.