This repository provides a user-friendly AI chatbot assistant to support German legal inquiries. The chatbot generates legal notices (Bescheide
) based on user-uploaded case files (Sachverhalte
), offers customization options before finalizing the file, and has potential for further expansion and integration.
π The chatbot is still under development and based on a dataset of German federal laws and the state laws of Baden-WΓΌrttemberg.
ποΈ Smart Legal Assistance:
The chatbot analyzes the uploaded case file (Sachverhalte
) in DOCX
or PDF
format and offers context-aware responses leveraging OpenAI's GPT-3.5 language model.
ποΈ Automated Notice Generation:
The chatbot generates draft legal notices (Bescheide
) based on the uploaded case file and the user's input. The legal notice includes the decision of the authority, the legal justification for the decision, and information on legal remedies.
ποΈ Customization: The user can review and edit the generated draft notice before finalizing it through customization options such as adding additional information or changing the existing content.
ποΈ Downloadable:
The user can manually download the generated legal notice in text format (DOCX
).
π Upload case file by clicking on the upload button (HOCHLADEN
).
- Now the chatbot will create a draft legal notice for you, which takes a short amount of time.
- You will receive the generated legal notice as a message in the chat.
π Adjust the draft legal notice according to the desired adjustments:
- For best customization results, use phrases like:
PROMPT: "Γndere mir den Bescheid [specify the part you want to change] [specify the adjustment you want to make]"
π Click the download button (HERUNTERLADEN
) to download the generated and customized legal notice.
π You can ask questions about the uploaded case file or the generated legal notice, as well as generated questions if you wish.
- For the best results, mention the case file or legal notice directly as the specific words in your question:
Sachverhalt
orBescheid
.
π The chatbot is not a substitute for legal advice from a qualified attorney.
This chatbot uses AI to generate legal notices from case files uploaded by users. The chatbot is not a legal advisor and does not ensure the accuracy or validity of the notices or information. Users must verify the notices and information with their own legal counsel or other sources. The chatbot and its creators are not liable for any harm or loss from using the chatbot or the information. Users agree to these terms by using the chatbot.
- Install Python version via Ubuntu 22.04 using WSL2:
https://learn.microsoft.com/en-us/windows/wsl/
(Installation Guide).- If you encounter error code 0x80370102, run
wsl --set-default-version 1
in CMD as Administrator. - To use WSL with VSCode:
https://code.visualstudio.com/docs/remote/wsl
(WSL Extension).
- If you encounter error code 0x80370102, run
- Node.js v18.7.1:
- How to install Node.js, nvm and npm on WSL2:
https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-wsl
- How to install Node.js, nvm and npm on WSL2:
Open WSL to run:
sudo apt update
andsudo apt upgrade
before creating a virtual environment.python3.10-venv
withsudo apt install python3.10-venv
.python3-pip
withapt install python3-pip
.
- Install Python version:
https://www.python.org/downloads/release/python-3117/
.- Installation Guide:
https://docs.python.org/3/using/windows.html
.
- Installation Guide:
- Node.js v18.7.1:
- How to install:
https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-overview
- How to install:
- Navigate to project's
backend folder
and open the.env
file. - Replace only these following placeholders (e.g. "ENTER OPENAI KEY") with your actual credential values:
AZURE_OPENAI_KEY="ENTER OPENAI KEY"
AZURE_OPENAI_ENDPOINT="ENTER OPENAI ENDPOINT"
- Save the file β
- Clone the GitHub repository
git clone https://github.com/SJinKim/SmartCity_Chatbot.git
.- If you encounter an error, run
git config --system core.protectNTFS false
in CMD as Administrator.
- If you encounter an error, run
- Navigate to the directory where you want to install the project
cd <your-home-directory>
. - Navigate to project directory
cd SmartCity_Chatbot
. - Navigate to backend folder
cd backend
. - Create a virtual environment
python3 -m venv <venv-directory-name>
. - Activate the created virtual environment
source <venv-directory-name>/bin/activate
. - Install the required packages
pip3 install -r requirements.unix.txt
. - Check if your
.env
file (containing the Azure OpenAI credentials) is in the root directory of backend folder. - Start backend server
uvicorn main:app
/ optionaluvicorn main:app --reload
to enable auto-reload. - Open the browser via
http://127.0.0.1:8000
/ to exitCtrl+C
.
- Clone the GitHub repository
git clone https://github.com/SJinKim/SmartCity_Chatbot.git
.- If you encounter an error, run
git config --system core.protectNTFS false
in CMD as Administrator.
- If you encounter an error, run
- Navigate to the directory where you want to install the project
cd <your-home-directory>
. - Navigate to project directory
cd SmartCity_Chatbot
. - Navigate to backend folder
cd backend
. - Create a virtual environment
python -m venv <venv-directory-name>
. - Activate the created virtual environment
./<venv-directory-name>/Scripts/Activate.ps1
. - Install the required packages
pip install -r requirements.win.txt
. - Check if your
.env
file (containing the Azure OpenAI credentials) is in the root directory of backend folder. - Start backend server
uvicorn main:app
/ optionaluvicorn main:app --reload
to enable auto-reload. - Open the browser via
http://127.0.0.1:8000
/ to exitCtrl+C
.
π Assuming Node.js(18.7.1), nvm and npm are installed:
- Navigate to project directory
cd SmartCity_Chatbot
. - Navigate to frontend folder
cd frontend
. - Install node-modules
npm install
. - Start frontend server in development mode
npm run dev
. - Open browser via
http://localhost:5173/
. - Make production build
npm run build
. - Build and deploy to backend
npm run build:deploy
.
π Assuming Docker Desktop is installed https://www.docker.com/products/docker-desktop/
.
- Start the
Docker Daemon
(by simply executingDocker Desktop
). - Place your
"AZURE_OPENAI_KEY"
and"AZURE_OPENAI_ENDPOINT"
in the env file(.env)
. - Open the Windows console, switch to the folder where
docker-compose.yaml
is located.- Relative path :
../SmartCity_Chatbot/backend/
.
- Relative path :
- Run
docker-compose up -d
in the console. - To run the application, open the browser via
http://localhost:8000
/ to exitCtrl+C
.
π See "Installation" section.
- Python (Linux:
v3.10.12
| Windows:v3.11.7
)https://www.python.org/
- Azure OpenAi Service (LLM-Model:
GPT 3.5 Turbo
, Embedding-Model:text-embedding-ada-002
) - LangChain
https://www.langchain.com/
- FastAPI
https://fastapi.tiangolo.com/
- JavaScript (
https://learn.microsoft.com/en-us/windows/dev-environment/javascript/
) - React
https://react.dev/
- Material-UI (MUI)
https://mui.com/
- Node.js (
v18.7.1
)https://nodejs.org/en
- Vite
https://vitejs.dev/
- axios
https://axios-http.com/
- Pull requests are welcome, but for major changes, please open an issue first to discuss what you would like to change.
Β© 2023 "Practical Lab for Bachelors (BP)" of TUDa in cooperation with [ui!].