A pure RAG pipeline with TUI, designed to work well with smaller local LLMs (via Ollama).
rag-app-readme.webm
- This project is a streamlined RAG application.
- By sticking to a pure RAG pipeline, this app works well with smaller models, such as
llama3.2:3b. - Smaller models don't handle agentic workflows and tool calling very well; they often get stuck in a loop or make things up.
- With this app you get answers referencing only the uploaded documents. When the information is not there, the app will tell you instead of making things up.
- The retrieval merges vector similarity search with full-text (keyword) search, so exact names, codes or IDs are found even when the embedding model misses them.
- You can have multiple workspaces that separates your resources, so not all resources are used every time
- Python: 3.14 or newer.
- Package Manager: uv
- LLM Engine: Ollama installed and running locally.
- Make sure Ollama is running (
ollama serve). Ideally, configure it to autostart on boot. - You need to download an LLM (e.g.,
ollama pull llama3.2:3b) and an embedding model (e.g.,ollama pull nomic-embed-text). - If your resources are not in English, use a multilingual embedding model (e.g.,
ollama pull bge-m3). - Run
ollama lsto verify that the models are downloaded.
- Make sure Ollama is running (
uv tool install git+https://github.com/jotalac/rag-app.git-
Clone the repository:
git clone git@github.com:jotalac/rag-app.git cd rag-app -
Install app:
uv tool install .
If you installed globally via Git: Run the upgrade command:
uv tool upgrade rag-appIf you installed via local clone (Alternative): Pull the latest code first, then upgrade:
git pull
uv tool install . --forceStart the TUI by running:
rag-appNote on Cold Starts: The first generation query is always slow because Ollama needs to load the model into memory. This delay also occurs anytime you change the model in the configuration.
- In the app, run
/helpto see all available options. ctrl+popens the default menu, where you can change theme or do other actions
- Create a folder anywhere on your device where all your resources will be stored.
- In the TUI config dialog (
/config), set the resources directory to your created folder. - Run
/add-resources file1 file2 ...or/add-resources-dir dir_nameto embed the files into the vector database (they are also added to the full-text search index). - Supported files are PDF, HTML and text files (txt, md, ...). Diagram files (
.svg,.puml,.drawio) are skipped, because they don't give any meaning to the RAG. - After the files are embedded, you can safely delete them from the resources directory.
- If you change the embedding model of a workspace, all its resources are removed and you need to add them again.
- Type your prompt in the input, and the app will automatically look at the uploaded resources.
- Smaller models might struggle if the resources are not in English.
- If no relevant data is retrieved from the resources, generation won't start, and you will see a info message.
- If you enable web search fallback in
/config, the app will search the web instead when nothing is found in the resources.
- Vector search: finds chunks with similar meaning to your prompt (cosine similarity), even when different words are used.
- Full-text search: finds chunks containing the exact words from your prompt (SQLite FTS5 with BM25 ranking), which helps with names, codes and IDs.
- Both results are merged with Reciprocal Rank Fusion - chunks found by both searches are ranked the highest.
- Full-text results that are not related to the prompt at all (very low vector similarity) are ignored, so it works with resources in any language.
- Add support for importing resources directly from web URLs.
- Add support for embedding and querying images, audio, and other media resources.
- Add support for cloud LLM providers.