https://github.com/moashour93/construction_private_gpt
A versatile document query chatbot powered by GPT-4ALL and Llama, supporting multi-format document ingestion and efficient retrieval using embeddings and ChromaDB. Ideal for transforming unstructured data into insights interactively.
https://github.com/moashour93/construction_private_gpt
chatbot chromadb documents gpt4all llama llama-index python queries rag
Last synced: 2 months ago
JSON representation
A versatile document query chatbot powered by GPT-4ALL and Llama, supporting multi-format document ingestion and efficient retrieval using embeddings and ChromaDB. Ideal for transforming unstructured data into insights interactively.
- Host: GitHub
- URL: https://github.com/moashour93/construction_private_gpt
- Owner: MoAshour93
- License: apache-2.0
- Created: 2024-10-29T10:33:38.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-29T18:08:05.000Z (8 months ago)
- Last Synced: 2025-02-09T18:16:21.860Z (4 months ago)
- Topics: chatbot, chromadb, documents, gpt4all, llama, llama-index, python, queries, rag
- Language: Python
- Homepage:
- Size: 1.22 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# π GPT-4ALL Document Query Chatbot
This project enables users to query a wide variety of documents using an advanced chatbot powered by open-source LLMs like GPT-4ALL and Llama. Leveraging embeddings, vector databases, and data loaders, this system efficiently handles document parsing, storage, and retrieval.
## π Table of Contents
- [π Project Overview](#-project-overview)
- [π Features](#-features)
- [π Project Structure](#-project-structure)
- [π Installation](#-installation)
- [π Usage](#-usage)
- [π General Links & Resources](#-general-links--resources)
- [βοΈ Configuration](#%EF%B8%8F-configuration)
- [ποΈ Supported Document Formats](#%EF%B8%8F-supported-document-formats)
- [π Limitations & Next Steps](#-limitations--next-steps)
- [π License](#-license)
- [π Support](#-support)---
## π Project Overview
In todayβs data-intensive environments, thereβs a growing need to convert unstructured data into actionable insights. This chatbot bridges that gap by allowing users to interactively query documents, with support for multiple formats including PDF, Word, PowerPoint, Markdown, and more.
Built with `langchain` and `chromadb`, this solution processes documents by:
- Converting them into text chunks.
- Embedding these chunks as vectors.
- Storing them for easy retrieval, powered by a selected LLM model.---
## π Features
- **Multi-format Document Support**: Accepts documents in `.pdf`, `.docx`, `.pptx`, `.txt`, and other formats.
- **Embeddings with Langchain**: Uses `HuggingFaceBgeEmbeddings` for text chunk embeddings.
- **Vector Storage with ChromaDB**: Stores text embeddings as vectors for efficient retrieval.
- **Choice of LLMs**: Supports GPT-4ALL and Llama models for answering queries.
- **Customizable Environment**: Easily configure model and embedding options via `.env`.---
## π Project Structure
- `requirements.txt`: Lists necessary Python packages.
- `.env`: Contains environment variables for model and database settings.
- `constants.py`: Holds constants for Chroma database configuration.
- `ingest.py`: Processes and stores documents as vectors for future querying.
- `privateGPT.py`: Main chatbot script for querying stored documents.---
## π Installation
1. **Clone the repository**:
```bash
git clone https://github.com/MoAshour93/Construction_Private_GPT.git
cd Construction_Private_GPT
```2. **Install dependencies**:
```bash
pip install -r requirements.txt
```3. **Set up environment variables**:
- Create a `.env` file in the root directory, using the provided template:
```bash
PERSIST_DIRECTORY=db
MODEL_TYPE=GPT4All
MODEL_PATH=models/ggml-gpt4all-j-v1.3-groovy.bin
EMBEDDINGS_MODEL_NAME=all-MiniLM-L6-v2
MODEL_N_CTX=1000
MODEL_N_BATCH=8
TARGET_SOURCE_CHUNKS=4
```---
## π Usage
### 1. Ingest Documents
Use `ingest.py` to process and store document embeddings:
```bash
python ingest.py
```### 2. Run the Chatbot
Start querying documents using `privateGPT.py`:
```bash
python privateGPT.py
```
- Enter your query at the prompt.
- Type `exit` to end the session.### π§ Customizable Options
- Use `--hide-source` or `-S` to hide source documents used in responses.
- Use `--mute-stream` or `-M` to disable streaming output from the LLM.---
## π General Links & Resources
- **Our Website**: [www.apcmasterypath.co.uk](https://www.apcmasterypath.co.uk)
- **APC Mastery Path Blogposts**: [APC Blogposts](https://www.apcmasterypath.co.uk/blog-list)
- **LinkedIn Pages**: [Personal](https://www.linkedin.com/in/mohamed-ashour-0727/) | [APC Mastery Path](https://www.linkedin.com/company/apc-mastery-path)---
## βοΈ Configuration
- **Constants**: The `constants.py` file includes important settings for the ChromaDB database.
- **Environment Variables**: Set customizable parameters in `.env`, including model path and embedding model name.---
## ποΈ Supported Document Formats
| Format | Loader |
|-----------------|-------------------------------|
| PDF | `PyPDFLoader` |
| Word Documents | `UnstructuredWordDocumentLoader` |
| PowerPoint | `UnstructuredPowerPointLoader` |
| Markdown | `UnstructuredMarkdownLoader` |
| CSV | `CSVLoader` |
| Text | `TextLoader` |---
## π Limitations & Next Steps
This initial implementation is a command-line-based chatbot, but it can be extended:
1. **GUI Integration**: Integrate with `Streamlit` or `Chainlit` for a graphical user interface.
2. **Multi-agent Architecture**: Develop task-specific agents for more complex queries.
3. **Broader LLM Support**: Experiment with other open-source models from Hugging Face.---
## π License
This project is licensed under the [Apache 2.0 License](LICENSE).---
## π Support
For any questions, feel free to contact [Mohamed Ashour](https://www.linkedin.com/in/mohamed-ashour-0727/).