Skip to content

Wizo17/contextual_rag_application

Repository files navigation

Contextual Retrieval Augmented Generation Example

Build with

The project uses:

Architecture

Combine Contextual Retrieval and Reranking to maximize retrieval accuracy. https://www.anthropic.com/news/contextual-retrieval

Setup

Prerequisites

  • Python 3.8+
  • pip (Python package manager)

Installation

  1. Clone this repository:
git clone https://github.com/Wizo17/contextual_rag_application.git
cd contextual_rag_application
  1. Create a virtual environment:
python -m venv venv
  1. Activate the virtual environment:
# Unix / MacOS
source venv/bin/activate
# Windows
venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt

If you have some issues, use python 3.12.0 and requirements_all.txt

  1. Create .env file:
cp .env.example .env
  1. Update .env file

Running app

Keep or Delete and import your own document in data/raw

Start mlflow if MLFLOW_ENABLE = "yes"

Adapt host (MFFLOW_HOST) and port (MFFLOW_PORT)

mlflow server --host 127.0.0.1 --port 5000

Build index first

It is not necessary if you keep my docs and my indexes Remove all files in data/index before

python main.py

Test application

Update queries if you don't keep my docs and my indexes

python test.py

By launching streamlit, you can have competitive conflicts with torch. It is not a problem for this version.

streamlit run chatbot.py

Authors

License

This project is licensed under the MIT License - see LICENSE for more information.

About

RAG Application with Contextual Retrieval and Lexical Retrieval.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages