A chat application using Ollama and Retrieval-Augmented Generation (RAG) for document retrieval and question answering.
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
.
├── 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
- Install Ollama and run it locally
- Install the project dependencies:
pip install -e .Process documents in the data/ directory and update the vector database:
python -m src.main --update-dbStart the chat application:
python -m src.mainOr in one step:
python -m src.main --update-dbRun the tests using pytest:
pytestThe 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 settings are in src/config.py. You can modify:
DATA_PATH: Path to the documents directoryCHROMA_PATH: Path to the vector databaseOLLAMA_MODEL: The Ollama model to useOLLAMA_URL: URL of the Ollama server- Text splitting and chunking parameters
MIT License - See LICENSE file for details
