This project leverages Retrieval-Augmented Generation (RAG) to help employees and Heads of Departments (HoDs) quickly understand and comply with company policies. By using a locally deployed Language Model (LLM) through LM Studio and Streamlit for the web interface, users can ask questions and get accurate, contextually relevant answers based on preloaded company policies stored in markdown format.
- Markdown File Processing: Reads company policies from a specified directory containing markdown files.
- Chunking and Storage: Splits the documents into manageable chunks and stores them in a vector database (LanceDB).
- Query Handling: Uses a local LLM to generate responses to policy-related queries.
- Streamlit Interface: Provides a web interface for users to ask questions and view responses.
- Policy Training Module: Interactive training module that quizzes users on policy knowledge and provides feedback.
-
Clone the repository:
git clone https://github.com/ckabuya/policies-qa-llm.git cd policies-qa-llm -
Install the dependencies:
pip install -r requirements.txt
-
Download NLTK data:
import nltk nltk.download("punkt")
-
Set up LM Studio:
- Download and install LM Studio from the official LM Studio website.
- Use LM Studio to download the desired LLM model.
- Enable the server in LM Studio to make the API available locally.
-
Prepare the policies directory:
- Ensure your company policies are stored in markdown format (.md files) in a directory. Update the
policy_directoryvariable in the script with the path to this directory.
- Ensure your company policies are stored in markdown format (.md files) in a directory. Update the
-
Run the Streamlit app:
streamlit run streamlit_app.py
-
Interact with the app:
- Open the provided URL in your browser.
- Use the sidebar to navigate between the "Policy Q&A" and "Policy Training" sections.
- Ask questions about the company policies and view the responses generated by the local LLM.
- Participate in the policy training module to test your knowledge and get feedback.
policies-qa-llm/
│
├── policies/ # Directory containing markdown files with company policies
├── streamlit_app.py # Main application script
├── requirements.txt # List of dependencies
├── README.md # Project documentation