git clone https://github.com/maxenceleguery/enstrag.git
cd enstrag
conda env update --name <your env> --file rag_env.yaml
python3 -m pip install .For testing :
python3 -m pip install .[test]conda activate <your env>
python3 -m enstragdocker compose up [-d]For evaluation :
python3 -m enstrag.metrics.evaluationfrom datasets import load_dataset
dataset = load_dataset('Maxenceleguery/enstrag_dataset')This repository is a python module to build a RAG application.
When importing the module, the environment variables MODELS_PATH and PERSIST_PATH will be set to default. Feel free to override those to fit your use case. The module will only look to Huggingface models stored in MODELS_PATH directory.
from enstrag.rag import RagAgent
from enstrag.models import get_pipeline, RagEmbedding
from enstrag.data import VectorDB, Parser, FileDocument
from enstrag.front import GradioFront, XAIConsoleFront
embedding = RagEmbedding("path/to/embedding/model")
db = VectorDB(embedding, persist_directory="...")
db.add_documents(
Parser.get_documents_from_filedocs([
FileDocument(pdf_url, None, name, label)
])
)
agent = RagAgent(
pipe=get_pipeline("path/to/llm/model"),
db=db,
)
front = GradioFront(agent) # or XAIConsoleFront
front.launch()Maxence Leguéry, Antoine Domingues, Albin Joyeux, Mattéo Denis, Simon Zarka