Skip to content

felixocker/german_law_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧑‍⚖️ german_law_bot

Static Badge

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.

Ideas

  • 💬 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 🚧

Demo

QA Bot

QA bot

Study buddy

Study buddy

Instructions

  • 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 .
  • 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
  • (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
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/

Contents

  • data/
    • chroma/ - the persistent vector store lives here
    • downloads/ - source files are stored here
  • docs/ - demo gifs
  • german_law_bot/
    • prompts/
      • prompt_qa.py - contains all prompts used
    • config.yaml - settings for what to load
    • constants.py - some generic settings
    • frontend.py - gradio-based frontend
    • history.py - keep track of interactions with the bot
    • ingest.py - download codes of law, extract data, feed into vector store
    • qa.py - QA using RAG
    • utils.py - utilities that are reused across modules

Dev notes

  • Package management: poetry
  • Linting: ruff
  • Formatting: black

About

a bot for german law

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages