Skip to content

DottsGit/Open-Ollama-RAG-ChatApp

 
 

Repository files navigation

Ollama RAG Chat App

A chat application using Ollama and Retrieval-Augmented Generation (RAG) for document retrieval and question answering.

Architecture

This application uses the following components:

  • Ollama: A lightweight API for running LLMs locally
  • LangChain: For document processing and RAG implementation
  • ChromaDB: Vector database for storing document embeddings
  • Gradio: Web interface for the chat application

RAG Architecture

Project Structure

.
├── data/                 # Documents to be processed
├── src/                  # Application source code
│   ├── app.py            # Gradio app for the chat interface
│   ├── chat.py           # Chat functionality with Ollama
│   ├── config.py         # Configuration settings
│   ├── document_processor.py # Document loading and processing
│   ├── main.py           # Main entry point
│   ├── update_db.py      # Database update functionality
│   └── vector_db.py      # Vector database interactions
├── tests/                # Tests for the application
│   ├── conftest.py       # Pytest configuration
│   ├── monkey_patch.py   # Runtime patches for library warnings
│   ├── test_document_processor.py
│   ├── test_document_tracker.py
│   └── test_vector_db.py
├── chroma/               # Vector database storage (created at runtime)
└── pyproject.toml        # Python project configuration

Installation

  1. Install Ollama and run it locally
  2. Install the project dependencies:
pip install -e .

Usage

Update the Vector Database

Process documents in the data/ directory and update the vector database:

python -m src.main --update-db

Start the Chat Application

Start the chat application:

python -m src.main

Or in one step:

python -m src.main --update-db

Run Tests

Run the tests using pytest:

pytest

The test suite includes runtime fixes for common dependency warnings:

  • Protobuf: Updated to version 5.x along with compatible dependencies to address deprecation warnings
  • ONNX Runtime: Applied a runtime patch to suppress false Windows version warnings

Configuration

Configuration settings are in src/config.py. You can modify:

  • DATA_PATH: Path to the documents directory
  • CHROMA_PATH: Path to the vector database
  • OLLAMA_MODEL: The Ollama model to use
  • OLLAMA_URL: URL of the Ollama server
  • Text splitting and chunking parameters

License

MIT License - See LICENSE file for details

About

Retrieval-Augmented Generation Chat Bot using Ollama, Langchain and Gradio. Extended and optimized from a fork from Tr33Bug with a specific goal of using RAG to navigate the results of a custom OCR of the JFK files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 87.3%
  • Jupyter Notebook 12.7%