A QA bot and a study buddy for German law.
Disclaimer: This bot does not, and is not intended to, constitute legal advice.
To get good results, be as precise as possible with your prompts.
Just want to give the bot a try? Check out the OpenAI GPT.
Note that this requires a ChatGPT Plus subscription.
- 💬 Basic QA for German laws
- 🧑🎓 Study buddy for learning about German laws
- 🔭 A bot for coming up with legal arguments for specific cases based on German laws 🚧
- Note: Currently (01/24) no support for Python 3.12 due to missing wheels for multidict
- Set an environment variable for your
OPENAI_API_KEY
, see these instructions - Install dependencies
- With poetry (recommended):
poetry install
- With pip:
python -m venv .venv && source .venv/bin/activate && pip install .
- With poetry (recommended):
- Browser interface
- If installed with poetry:
cd german_law_bot && poetry run python frontend.py
- If installed with pip:
cd german_law_bot && python frontend.py
- If installed with poetry:
- (Limited) command line usage:
- Specify the codes of law you want to load in
config.yaml
(provide the download links for the XML zips, see the example for the BGB below) - Load the data:
python ingest.py
- Run QA bot:
python qa.py
- Specify the codes of law you want to load in
BGB:
desired: true
file: BJNR001950896.xml
link: https://www.gesetze-im-internet.de/bgb/xml.zip
loaded: true
website: https://www.gesetze-im-internet.de/bgb/
data/
chroma/
- the persistent vector store lives heredownloads/
- source files are stored here
docs/
- demo gifsgerman_law_bot/
prompts/
prompt_qa.py
- contains all prompts used
config.yaml
- settings for what to loadconstants.py
- some generic settingsfrontend.py
- gradio-based frontendhistory.py
- keep track of interactions with the botingest.py
- download codes of law, extract data, feed into vector storeqa.py
- QA using RAGutils.py
- utilities that are reused across modules
- Package management: poetry
- Linting: ruff
- Formatting: black