Baymax_TC is an application designed to simplify complex Terms of Service agreements using the power of Large Language Models (LLMs). By leveraging RAG (Retrieval Augmented Generation), this application provides users with clear and concise explanations of legal jargon, making it easier to understand and comply with these often daunting documents.
- Document Store: The application maintains a repository of Terms of Service agreements from various platforms and services.
- RAG: When a user queries the application with a specific question or phrase related to a Terms of Service agreement, the RAG component searches the document store for relevant information.
- LLM Processing: The retrieved information is then processed by the LLM, which is trained to understand legal language and translate it into plain English.
- Explanation Generation: The LLM generates a comprehensive and easy-to-understand explanation of the query, addressing the user's specific concerns or questions.
- User-Friendly Interface: A simple and intuitive interface allows users to easily input their queries and receive clear explanations.
- Comprehensive Coverage: The application covers a wide range of Terms of Service agreements, from popular social media platforms to online marketplaces.
- Accurate and Reliable: The LLM is trained on a vast dataset of legal documents, ensuring accurate and reliable explanations.
- Customizable: Users can customize the level of detail in the explanations to suit their needs and understanding.
- Installation: Follow the installation instructions
- Data Preparation: Populate the document store with Terms of Service agreements in the desired format.
- Usage: Launch the application and start querying the Terms of Service agreements.
This project maintains high code quality standards through automated tools for formatting, style checking, and security analysis.
- Black: The uncompromising Python code formatter
- Line length: 88 characters
- Ensures consistent code style across the project
- isort: Import statement organizer
- Automatically formats and groups imports
- Maintains consistent import ordering
- Bandit: Security linter
- Finds common security issues in Python code
- Helps prevent security vulnerabilities
Install all development tools with pip:
bash
pip install black bandit isort pre-commit
pre-commit install
Check code without making changes:
black --check .
isort --check-only .
bandit -r .
black .
isort .
pre-commit run --all-files
Tool settings are maintained in the following files:
Tool | Configuration File | Use |
---|---|---|
Black & isort | pyproject.toml |
Code formatting settings |
Bandit | .bandit |
Security check settings |
Pre-commit | .pre-commit-config.yaml |
Pre-commit hook settings |
q_a.json
file: This file contains the question-answer pairs for evaluation.evaluate_rag.py
script: This script loads the data, generates answers using the language model, and then usesdeepeval
to calculate the three metrics.
- Correctness: How factually accurate are the answers?
- Faithfulness: How well do answers align with the information in the source document?
- Contextual Relevancy: How well do the answers address the specific question and its context within the source document?
- This project uses Python 3.10.12
- Dependencies listed in requirements.txt
If any tool fails:
- Run the tool manually (e.g., black . or isort .)
- Stage changes: git add .
- Try committing again