The goal of this project is to build a Contract Q&A Retrieval-Augmented Generation (RAG) system similar to Lizzy AI, an artificial contract assistant developed by an Israeli startup. Lizzy AI can draft and review contracts quickly, providing functionalities such as summarization, error detection, clause generation, and more. This challenge aims to create, evaluate, and improve a RAG system that allows users to interact with contracts and ask questions about them.
- Interactive Q&A: Allow users to chat with the system and ask questions about the contract.
- LangChain: Framework for building applications with LLMs.
- Chroma: Vector database for efficient data storage and retrieval.
- OpenAI API: Provides access to GPT-3.5-Turbo for language processing.
- GPT-4: Used for advanced language understanding and generation.
- Introduction
- Project Structure
- Getting Started
- Contributing
- CI/CD Pipeline
- Dockerization
- Makefile
- Documentation
Users can interact with the system to ask questions and get detailed answers about specific contracts. The system uses LangChain, Chroma, OpenAI API, and GPT-3.5-Turbo and GPT-4o-mini models.
app.py
: The main Streamlit application.Dockerfile
: Docker configuration for building the application container.Makefile
: Automation of common tasks such as installation, build, and deployment..github/workflows/ci-cd.yml
: GitHub Actions configuration for CI/CD pipeline.scripts
: Python scripts for various langchain retrievers and ragas evaluation.notebooks
: All the notebooks.
- Python 3.7 or higher
-
Clone the repository:
git clone https://github.com/cheronodaisy/contract-advisor-rag.git
-
Navigate to the project directory:
cd contract-advisor-rag
-
Create and activate a virtual environment (optional but recommended):
python -m venv myenv source myenv/bin/activate # On Windows use `myenv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a .env in the root directory and add an OpenAI API key:
OPENAI_API_KEY="Your OpenAI key"
-
Build and run the Docker container:
-
To build the Docker image:
make build
-
To deploy the Docker container:
make deploy
Alternatively, you can run the Streamlit app directly without Docker
streamlit run app.py
-
Contributions from the community are welcome. If you would like to contribute to this project, please follow these steps:
-
Fork the repository.
-
Create a new branch:
git checkout -b feature-branch
-
Make your changes and commit them:
git commit -m 'Add some feature'
-
Push to the branch:
git push origin feature-branch
-
Open a pull request.
- GitHub Actions: Automated workflows for building, and deploying the application. Configured in the
.github/workflows/ci-cd.yml
file.
- Dockerfile: Defines how the application is containerized and run.
- Makefile: Automates dependency installation, building Docker images, and deploying containers. Use
make
commands to streamline the development workflow.