This repository contains the code, data, and pipeline documentation for a chatbot project. The chatbot's primary task is to answer user questions about construction legislation based on the text of (EU) DIRECTIVE 2018/1972.
The demo includes the following steps:
- Ingestion: Parsing the data from a PDF file.
- Cleaning: Removing special characters.
- Tokenization: Splitting the text into paragraphs.
- Generating question-answer pairs for each paragraph.
- Fine-tuning a large language model (LLM) using the annotated data.
- Building a chatbot interface using HuggingFace's Gradio library.
The pipeline is summarized in the following diagram:
- Demo.ipynb: Contains the demo code for running the chatbot pipeline.
- chatbot_huggingface_env.yaml: Defines the Conda environment for the project.
datasets/: Directory containing pre-processed directive text:directive_dataset.json: Cached pre-processed dataset.directive_subset_400.json: Dataset with paragraphs of approximately 400 words.directive_subset_50.json: Dataset with paragraphs of approximately 50 words.
- Install Conda: Conda Installation Guide
- Create the environment using the provided YAML file:
conda env create -f chatbot_huggingface_env.yaml conda activate chatbot_env
- Open
Demo.ipynbin Jupyter Notebook or JupyterLab. - Follow the steps in the notebook to execute the pipeline.