Tort Rat is a CLI-based Discord chatbot developed as a side project for SMU's LAW105: Law of Torts course. It leverages Retrieval-Augmented Generation (RAG) to answer questions about key tort law cases and concepts. Trained on a curated set of case summaries, Tort Rat can:
- π Explain legal doctrines and tests;
- βοΈ Address basic hypothetical questions; and
- π§ Provide concise answers to enhance legal understanding.
- Built using PostgresML and Python
pip install pgml-chat
python -m venv {file_path}
Clone the .env
and ingest
folder from the repository:
git clone https://github.com/kevanwee/tortrat.git
Edit the .env
file and add the OpenAI API key, PostgresML database link, and Discord bot token:
OPENAI_API_KEY=<>
DATABASE_URL=<>
DISCORD_BOT_TOKEN=<>
To ingest data, run:
LOG_LEVEL=DEBUG pgml-chat --root_dir ingest --collection_name tort --stage {file_path/ingest}
To start the Discord bot, use:
LOG_LEVEL=ERROR pgml-chat --collection_name tort --chat_completion_model gpt-3.5-turbo --stage chat --chat_interface discord