GenAI Chat is an intelligent question-answering chatbot designed to help users interact with their data. Built on the Retrieval Augmented Generation (RAG) technique, it leverages the power of OpenAI’s large language models (LLMs) and Redis vector databases to provide accurate and context-aware answers to complex user queries.
Key Features:
- Dynamic Knowledge Retrieval: It retrieve relevant documents from Redis Vector databases in real time, allowing them to respond with up-to-date and contextually accurate information.
- Natural language understanding: It utilizes Large language models (LLMs). LLMs can analyze complex patterns in language and can accurately interpret subtle meanings, respond appropriately to diverse queries, and adapt to various conversational styles, significantly enhancing the quality of human-computer communication.
- Multiple File Support: Project currently supports
.txt
,.pdf
and.docx
file formats (Support for.pptx
,.csv
,.xlsx
and.json
files will be coming in next release). - Multiple Data Source Support: Project supports 3 different sources for document indexing Local,
Azure
andAWS
.
Technology Used:
For more detailed explanation of this project, including its design and implementation, check out the accompanying Medium blog post.
The chatbot consists of these core components:
- Frontend: Takes user queries and sends them to the backend. It's built with HTML + JavaScript and is running in a Docker container with Nginx.
- Backend: Takes user queries, fetches relevant documents from Redis Vector DB, builds prompts, and sends them to the LLM for generating response. Its built with Flask and is running in a Docker container.
- Redis Vector Database: Stores the document text, embedding vectors and session data. It’s also running in a Docker container.
- OpenAI LLM: Takes prompt and generates response. We will be using
gpt-4o
model for generating response andtext-embedding-3-small
model for generating embedding vectors (embedding dimension 1536). These models are hosted in cloud Chatbot makes API call in order to communicate with the models. These models can be updated inbackend/config.py
.
Follow below steps in either on Mac and Linux (Ubuntu) machine.
Step 1: Install Docker
Step 2: Clone the repository
$ git clone https://github.com/atinesh-s/GenAI-Chat.git
Step 3: Configure OpenAI credentials
- Login to OpenAI
- In the upper right corner of the page, choose
Your profile
. - Create
API keys
. - Configure OpenAI key in
GenAI-Chat/.env
environment file as follows.
OPENAI_API_KEY=key
Step 4: Create a data
directory in the project root if it doesn't already exist. This directory will be used to store the Redis dump file.
$ cd GenAI-Chat
$ mkdir data
Step 5: Download the model.safetensors
file from this link and place it in the backend/model
directory.
Step 6: Build Images and Run Containers
$ cd GenAI-Chat
$ ./deploy.sh
Step 7: Index the data into Redis by following the instructions provided in the README.md file.
Step 8: Once indexing is complete, you can interact with the frontend by visiting http://localhost:8080/.
Note: RedisInsight can be accessed at http://localhost:8001/
If you found this repository helpful, please consider giving it a star ⭐ to show your support! It helps others discover the project and keeps me motivated to improve it further. If you'd like to support my work even more, consider buying me a coffee.
If you encounter any issues, please open an issue with detailed steps to reproduce the problem. I’ll look into it as soon as possible.
I’m always looking to improve this project! If you have suggestions for new features or enhancements, feel free to submit a feature request.
Thank you for your support and contributions! 🙌
This project is licensed under the GNU General Public License v3.0
. See the LICENSE file for more details.