rag-gpt
RAG-GPT, leveraging LLM and RAG technology, learns from user-customized knowledge bases to provide contextually relevant answers for a wide range of queries, ensuring rapid and accurate information retrieval.
Stars: 228
RAG-GPT is a tool that allows users to quickly launch an intelligent customer service system with Flask, LLM, and RAG. It includes frontend, backend, and admin console components. The tool supports cloud-based and local LLMs, offers quick setup for conversational service robots, integrates diverse knowledge bases, provides flexible configuration options, and features an attractive user interface.
README:
Live Demo
- Features
- Online Retrieval Architecture
- Deploy the RAG-GPT Service
- Configure the admin console
- The frontend of admin console and chatbot
- Built-in LLM Support: Support cloud-based LLMs and local LLMs.
- Quick Setup: Enables deployment of production-level conversational service robots within just five minutes.
- Diverse Knowledge Base Integration: Supports multiple types of knowledge bases, including websites, isolated URLs, and local files.
- Flexible Configuration: Offers a user-friendly backend equipped with customizable settings for streamlined management.
- Attractive UI: Features a customizable and visually appealing user interface.
Clone the repository:
git clone https://github.com/open-kf/rag-gpt.git && cd rag-gpt
Before starting the RAG-GPT service, you need to modify the related configurations for the program to initialize correctly.
cp env_of_openai .env
The variables in .env
LLM_NAME="OpenAI"
OPENAI_API_KEY="xxxx"
GPT_MODEL_NAME="gpt-3.5-turbo"
MIN_RELEVANCE_SCORE=0.4
BOT_TOPIC="xxxx"
URL_PREFIX="http://127.0.0.1:7000/"
USE_PREPROCESS_QUERY=1
USE_RERANKING=1
USE_DEBUG=0
USE_LLAMA_PARSE=0
LLAMA_CLOUD_API_KEY="xxxx"
USE_GPT4O=0
- Don't modify
LLM_NAME
- Modify the
OPENAI_API_KEY
with your own key. Please log in to the OpenAI website to view your API Key. - Update the
GPT_MODEL_NAME
setting, replacinggpt-3.5-turbo
withgpt-4-turbo
orgpt-4o
if you want to use GPT-4. - Change
BOT_TOPIC
to reflect your Bot's name. This is very important, as it will be used inPrompt Construction
. Please try to use a concise and clear word, such asOpenIM
,LangChain
. - Adjust
URL_PREFIX
to match your website's domain. This is mainly for generating accessible URL links for uploaded local files. Such ashttp://127.0.0.1:7000/web/download_dir/2024_05_20/d3a01d6a-90cd-4c2a-b926-9cda12466caf/openssl-cookbook.pdf
. - Set
USE_LLAMA_PARSE
to 1 if you want to useLlamaParse
. - Modify the
LLAMA_CLOUD_API_KEY
with your own key. Please log in to the LLamaCloud website to view your API Key. - Set
USE_GPT4O
to 1 if you want to useGPT-4o
mode. - For more information about the meanings and usages of constants, you can check under the
server/constant
directory.
If you cannot use OpenAI's API services, consider using ZhipuAI as an alternative.
cp env_of_zhipuai .env
The variables in .env
LLM_NAME="ZhipuAI"
ZHIPUAI_API_KEY="xxxx"
GLM_MODEL_NAME="glm-4-air"
MIN_RELEVANCE_SCORE=0.4
BOT_TOPIC="xxxx"
URL_PREFIX="http://127.0.0.1:7000/"
USE_PREPROCESS_QUERY=1
USE_RERANKING=1
USE_DEBUG=0
USE_LLAMA_PARSE=0
LLAMA_CLOUD_API_KEY="xxxx"
- Don't modify
LLM_NAME
- Modify the
ZHIPUAI_API_KEY
with your own key. Please log in to the ZhipuAI website to view your API Key. - Update the
GLM_MODEL_NAME
setting, the model list is['glm-3-turbo', 'glm-4', 'glm-4-0520', 'glm-4-air', 'glm-4-airx', 'glm-4-flash']
. - Change
BOT_TOPIC
to reflect your Bot's name. This is very important, as it will be used inPrompt Construction
. Please try to use a concise and clear word, such asOpenIM
,LangChain
. - Adjust
URL_PREFIX
to match your website's domain. This is mainly for generating accessible URL links for uploaded local files. Such ashttp://127.0.0.1:7000/web/download_dir/2024_05_20/d3a01d6a-90cd-4c2a-b926-9cda12466caf/openssl-cookbook.pdf
. - Set
USE_LLAMA_PARSE
to 1 if you want to useLlamaParse
. - Modify the
LLAMA_CLOUD_API_KEY
with your own key. Please log in to the LLamaCloud website to view your API Key. - For more information about the meanings and usages of constants, you can check under the
server/constant
directory.
If you cannot use OpenAI's API services, consider using DeepSeek as an alternative.
[!NOTE] DeepSeek does not provide an
Embedding API
, so here we use ZhipuAI'sEmbedding API
.
cp env_of_deepseek .env
The variables in .env
LLM_NAME="DeepSeek"
ZHIPUAI_API_KEY="xxxx"
DEEPSEEK_API_KEY="xxxx"
DEEPSEEK_MODEL_NAME="deepseek-chat"
MIN_RELEVANCE_SCORE=0.4
BOT_TOPIC="xxxx"
URL_PREFIX="http://127.0.0.1:7000/"
USE_PREPROCESS_QUERY=1
USE_RERANKING=1
USE_DEBUG=0
USE_LLAMA_PARSE=0
LLAMA_CLOUD_API_KEY="xxxx"
- Don't modify
LLM_NAME
- Modify the
ZHIPUAI_API_KEY
with your own key. Please log in to the ZhipuAI website to view your API Key. - Modify the
DEEPKSEEK_API_KEY
with your own key. Please log in to the DeepSeek website to view your API Key. - Update the
DEEPSEEK_MODEL_NAME
setting if you want to use other models of DeepSeek. - Change
BOT_TOPIC
to reflect your Bot's name. This is very important, as it will be used inPrompt Construction
. Please try to use a concise and clear word, such asOpenIM
,LangChain
. - Adjust
URL_PREFIX
to match your website's domain. This is mainly for generating accessible URL links for uploaded local files. Such ashttp://127.0.0.1:7000/web/download_dir/2024_05_20/d3a01d6a-90cd-4c2a-b926-9cda12466caf/openssl-cookbook.pdf
. - Set
USE_LLAMA_PARSE
to 1 if you want to useLlamaParse
. - Modify the
LLAMA_CLOUD_API_KEY
with your own key. Please log in to the LLamaCloud website to view your API Key. - For more information about the meanings and usages of constants, you can check under the
server/constant
directory.
If you cannot use OpenAI's API services, consider using Moonshot as an alternative.
[!NOTE] Moonshot does not provide an
Embedding API
, so here we use ZhipuAI'sEmbedding API
.
cp env_of_moonshot .env
The variables in .env
LLM_NAME="Moonshot"
ZHIPUAI_API_KEY="xxxx"
MOONSHOT_API_KEY="xxxx"
MOONSHOT_MODEL_NAME="moonshot-v1-8k"
MIN_RELEVANCE_SCORE=0.4
BOT_TOPIC="xxxx"
URL_PREFIX="http://127.0.0.1:7000/"
USE_PREPROCESS_QUERY=1
USE_RERANKING=1
USE_DEBUG=0
USE_LLAMA_PARSE=0
LLAMA_CLOUD_API_KEY="xxxx"
- Don't modify
LLM_NAME
- Modify the
ZHIPUAI_API_KEY
with your own key. Please log in to the ZhipuAI website to view your API Key. - Modify the
MOONSHOT_API_KEY
with your own key. Please log in to the Moonshot website to view your API Key. - Update the
MOONSHOT_MODEL_NAME
setting if you want to use other models of Moonshot. - Change
BOT_TOPIC
to reflect your Bot's name. This is very important, as it will be used inPrompt Construction
. Please try to use a concise and clear word, such asOpenIM
,LangChain
. - Adjust
URL_PREFIX
to match your website's domain. This is mainly for generating accessible URL links for uploaded local files. Such ashttp://127.0.0.1:7000/web/download_dir/2024_05_20/d3a01d6a-90cd-4c2a-b926-9cda12466caf/openssl-cookbook.pdf
. - Set
USE_LLAMA_PARSE
to 1 if you want to useLlamaParse
. - Modify the
LLAMA_CLOUD_API_KEY
with your own key. Please log in to the LLamaCloud website to view your API Key. - For more information about the meanings and usages of constants, you can check under the
server/constant
directory.
If your knowledge base involves sensitive information and you prefer not to use cloud-based LLMs, consider using Ollama
to deploy large models locally.
[!NOTE] First, refer to ollama to Install Ollama, and download the embedding model
mxbai-embed-large
and the LLM model such asllama3
.
cp env_of_ollama .env
The variables in .env
LLM_NAME="Ollama"
OLLAMA_MODEL_NAME="xxxx"
OLLAMA_BASE_URL="http://127.0.0.1:11434"
MIN_RELEVANCE_SCORE=0.4
BOT_TOPIC="xxxx"
URL_PREFIX="http://127.0.0.1:7000/"
USE_PREPROCESS_QUERY=1
USE_RERANKING=1
USE_DEBUG=0
USE_LLAMA_PARSE=0
LLAMA_CLOUD_API_KEY="xxxx"
- Don't modify
LLM_NAME
- Update the
OLLAMA_MODEL_NAME
setting, select an appropriate model from ollama library. - If you have changed the default
IP:PORT
when startingOllama
, please updateOLLAMA_BASE_URL
. Please pay special attention, only enter the IP (domain) and PORT here, without appending a URI. - Change
BOT_TOPIC
to reflect your Bot's name. This is very important, as it will be used inPrompt Construction
. Please try to use a concise and clear word, such asOpenIM
,LangChain
. - Adjust
URL_PREFIX
to match your website's domain. This is mainly for generating accessible URL links for uploaded local files. Such ashttp://127.0.0.1:7000/web/download_dir/2024_05_20/d3a01d6a-90cd-4c2a-b926-9cda12466caf/openssl-cookbook.pdf
. - Set
USE_LLAMA_PARSE
to 1 if you want to useLlamaParse
. - Modify the
LLAMA_CLOUD_API_KEY
with your own key. Please log in to the LLamaCloud website to view your API Key. - For more information about the meanings and usages of constants, you can check under the
server/constant
directory.
[!NOTE] When deploying with Docker, pay special attention to the host of URL_PREFIX in the
.env
file. If usingOllama
, also pay special attention to the host of OLLAMA_BASE_URL in the.env
file. They need to use the actual IP address of the host machine.
docker-compose up --build
[!NOTE] Please use Python version 3.10.x or above.
It is recommended to install Python-related dependencies in a Python virtual environment to avoid affecting dependencies of other projects.
If you have not yet created a virtual environment, you can create one with the following command:
python3 -m venv myenv
After creation, activate the virtual environment:
source myenv/bin/activate
Once the virtual environment is activated, you can use pip
to install the required dependencies.
pip install -r requirements.txt
The RAG-GPT service uses SQLite as its storage DB. Before starting the RAG-GPT service, you need to execute the following command to initialize the database and add the default configuration for admin console.
python3 create_sqlite_db.py
If you have completed the steps above, you can try to start the RAG-GPT service by executing the following command.
- Start single process:
python3 rag_gpt_app.py
- Start multiple processes:
sh start.sh
[!NOTE]
- The service port for RAG-GPT is
7000
. During the first test, please try not to change the port so that you can quickly experience the entire product process.- We recommend starting the RAG-GPT service using
start.sh
in multi-process mode for a smoother user experience.
Access the admin console through the link http://your-server-ip:7000/open-kf-admin/
to reach the login page. The default username and password are admin
and open_kf_AIGC@2024
(can be checked in create_sqlite_db.py
).
After logging in successfully, you will be able to see the configuration page of the admin console.
On the page http://your-server-ip:7000/open-kf-admin/#/
, you can set the following configurations:
- Choose the LLM base, currently only the
gpt-3.5-turbo
option is available, which will be gradually expanded. - Initial Messages
- Suggested Messages
- Message Placeholder
- Profile Picture (upload a picture)
- Display name
- Chat icon (upload a picture)
After submitting the website URL, once the server retrieves the list of all web page URLs via crawling, you can select the web page URLs you need as the knowledge base (all selected by default). The initial Status
is Recorded
.
You can actively refresh the page http://your-server-ip:7000/open-kf-admin/#/source
in your browser to get the progress of web page URL processing. After the content of the web page URL has been crawled, and the Embedding calculation and storage are completed, you can see the corresponding Size
in the admin console, and the Status
will also be updated to Trained
.
Clicking on a webpage's URL reveals how many sub-pages the webpage is divided into, and the text size of each sub-page.
Clicking on a sub-page allows you to view its full text content. This will be very helpful for verifying the effects during the experience testing process.
Collect the URLs of the required web pages. You can submit up to 10
web page URLs at a time, and these pages can be from different domains.
Upload the required local files. You can upload up to 10
files at a time, and each file cannot exceed 30MB
. The following file types are currently supported: [".txt", ".md", ".pdf", ".epub", ".mobi", ".html", ".docx", ".pptx", ".xlsx", ".csv"]
.
After importing website data in the admin console, you can experience the chatbot service through the link http://your-server-ip:7000/open-kf-chatbot/
.
Through the admin console link http://your-server-ip:7000/open-kf-admin/#/embed
, you can see the detailed tutorial for configuring the iframe in your website.
Through the admin console link http://your-server-ip:7000/open-kf-admin/#/dashboard
, you can view the historical request records of all users within a specified time range.
The RAG-GPT service integrates 2 frontend modules, and their source code information is as follows:
An intuitive web-based admin interface for Smart QA Service, offering comprehensive control over content, configuration, and user interactions. Enables effortless management of the knowledge base, real-time monitoring of queries and feedback, and continuous improvement based on user insights.
An HTML5 interface for Smart QA Service designed for easy integration into websites via iframe, providing users direct access to a tailored knowledge base without leaving the site, enhancing functionality and immediate query resolution.
For Tasks:
Click tags to check more tools for each tasksFor Jobs:
Alternative AI tools for rag-gpt
Similar Open Source Tools
rag-gpt
RAG-GPT is a tool that allows users to quickly launch an intelligent customer service system with Flask, LLM, and RAG. It includes frontend, backend, and admin console components. The tool supports cloud-based and local LLMs, offers quick setup for conversational service robots, integrates diverse knowledge bases, provides flexible configuration options, and features an attractive user interface.
rag-gpt
RAG-GPT is a tool that allows users to quickly launch an intelligent customer service system with Flask, LLM, and RAG. It includes frontend, backend, and admin console components. The tool supports cloud-based and local LLMs, enables deployment of conversational service robots in minutes, integrates diverse knowledge bases, offers flexible configuration options, and features an attractive user interface.
shell-ai
Shell-AI (`shai`) is a CLI utility that enables users to input commands in natural language and receive single-line command suggestions. It leverages natural language understanding and interactive CLI tools to enhance command line interactions. Users can describe tasks in plain English and receive corresponding command suggestions, making it easier to execute commands efficiently. Shell-AI supports cross-platform usage and is compatible with Azure OpenAI deployments, offering a user-friendly and efficient way to interact with the command line.
nlux
nlux is an open-source Javascript and React JS library that makes it super simple to integrate powerful large language models (LLMs) like ChatGPT into your web app or website. With just a few lines of code, you can add conversational AI capabilities and interact with your favourite LLM.
rclip
rclip is a command-line photo search tool powered by the OpenAI's CLIP neural network. It allows users to search for images using text queries, similar image search, and combining multiple queries. The tool extracts features from photos to enable searching and indexing, with options for previewing results in supported terminals or custom viewers. Users can install rclip on Linux, macOS, and Windows using different installation methods. The repository follows the Conventional Commits standard and welcomes contributions from the community.
t3rn-airdrop-bot
A bot designed to automate transactions and bridge assets on the t3rn network, making the process seamless and efficient. It supports multiple wallets through a JSON file containing private keys, with robust error handling and retry mechanisms. The tool is user-friendly, easy to set up, and supports bridging from Optimism Sepolia and Arbitrum Sepolia.
holmesgpt
HolmesGPT is an open-source DevOps assistant powered by OpenAI or any tool-calling LLM of your choice. It helps in troubleshooting Kubernetes, incident response, ticket management, automated investigation, and runbook automation in plain English. The tool connects to existing observability data, is compliance-friendly, provides transparent results, supports extensible data sources, runbook automation, and integrates with existing workflows. Users can install HolmesGPT using Brew, prebuilt Docker container, Python Poetry, or Docker. The tool requires an API key for functioning and supports OpenAI, Azure AI, and self-hosted LLMs.
agnai
Agnaistic is an AI roleplay chat tool that allows users to interact with personalized characters using their favorite AI services. It supports multiple AI services, persona schema formats, and features such as group conversations, user authentication, and memory/lore books. Agnaistic can be self-hosted or run using Docker, and it provides a range of customization options through its settings.json file. The tool is designed to be user-friendly and accessible, making it suitable for both casual users and developers.
nlux
NLUX is an open-source JavaScript and React JS library that simplifies the integration of powerful large language models (LLMs) like ChatGPT into web apps or websites. With just a few lines of code, users can add conversational AI capabilities and interact with their favorite LLM. The library offers features such as building AI chat interfaces in minutes, React components and hooks for easy integration, LLM adapters for various APIs, customizable assistant and user personas, streaming LLM output, custom renderers, high customizability, and zero dependencies. NLUX is designed with principles of intuitiveness, performance, accessibility, and developer experience in mind. The mission of NLUX is to enable developers to build outstanding LLM front-ends and applications with a focus on performance and usability.
llm-vscode
llm-vscode is an extension designed for all things LLM, utilizing llm-ls as its backend. It offers features such as code completion with 'ghost-text' suggestions, the ability to choose models for code generation via HTTP requests, ensuring prompt size fits within the context window, and code attribution checks. Users can configure the backend, suggestion behavior, keybindings, llm-ls settings, and tokenization options. Additionally, the extension supports testing models like Code Llama 13B, Phind/Phind-CodeLlama-34B-v2, and WizardLM/WizardCoder-Python-34B-V1.0. Development involves cloning llm-ls, building it, and setting up the llm-vscode extension for use.
lexido
Lexido is an innovative assistant for the Linux command line, designed to boost your productivity and efficiency. Powered by Gemini Pro 1.0 and utilizing the free API, Lexido offers smart suggestions for commands based on your prompts and importantly your current environment. Whether you're installing software, managing files, or configuring system settings, Lexido streamlines the process, making it faster and more intuitive.
Deep-Live-Cam
Deep-Live-Cam is a software tool designed to assist artists in tasks such as animating custom characters or using characters as models for clothing. The tool includes built-in checks to prevent unethical applications, such as working on inappropriate media. Users are expected to use the tool responsibly and adhere to local laws, especially when using real faces for deepfake content. The tool supports both CPU and GPU acceleration for faster processing and provides a user-friendly GUI for swapping faces in images or videos.
NeoGPT
NeoGPT is an AI assistant that transforms your local workspace into a powerhouse of productivity from your CLI. With features like code interpretation, multi-RAG support, vision models, and LLM integration, NeoGPT redefines how you work and create. It supports executing code seamlessly, multiple RAG techniques, vision models, and interacting with various language models. Users can run the CLI to start using NeoGPT and access features like Code Interpreter, building vector database, running Streamlit UI, and changing LLM models. The tool also offers magic commands for chat sessions, such as resetting chat history, saving conversations, exporting settings, and more. Join the NeoGPT community to experience a new era of efficiency and contribute to its evolution.
sunone_aimbot
Sunone Aimbot is an AI-powered aim bot for first-person shooter games. It leverages YOLOv8 and YOLOv10 models, PyTorch, and various tools to automatically target and aim at enemies within the game. The AI model has been trained on more than 30,000 images from popular first-person shooter games like Warface, Destiny 2, Battlefield 2042, CS:GO, Fortnite, The Finals, CS2, and more. The aimbot can be configured through the `config.ini` file to adjust various settings related to object search, capture methods, aiming behavior, hotkeys, mouse settings, shooting options, Arduino integration, AI model parameters, overlay display, debug window, and more. Users are advised to follow specific recommendations to optimize performance and avoid potential issues while using the aimbot.
For similar tasks
rag-gpt
RAG-GPT is a tool that allows users to quickly launch an intelligent customer service system with Flask, LLM, and RAG. It includes frontend, backend, and admin console components. The tool supports cloud-based and local LLMs, enables deployment of conversational service robots in minutes, integrates diverse knowledge bases, offers flexible configuration options, and features an attractive user interface.
rag-gpt
RAG-GPT is a tool that allows users to quickly launch an intelligent customer service system with Flask, LLM, and RAG. It includes frontend, backend, and admin console components. The tool supports cloud-based and local LLMs, offers quick setup for conversational service robots, integrates diverse knowledge bases, provides flexible configuration options, and features an attractive user interface.
For similar jobs
sweep
Sweep is an AI junior developer that turns bugs and feature requests into code changes. It automatically handles developer experience improvements like adding type hints and improving test coverage.
teams-ai
The Teams AI Library is a software development kit (SDK) that helps developers create bots that can interact with Teams and Microsoft 365 applications. It is built on top of the Bot Framework SDK and simplifies the process of developing bots that interact with Teams' artificial intelligence capabilities. The SDK is available for JavaScript/TypeScript, .NET, and Python.
ai-guide
This guide is dedicated to Large Language Models (LLMs) that you can run on your home computer. It assumes your PC is a lower-end, non-gaming setup.
classifai
Supercharge WordPress Content Workflows and Engagement with Artificial Intelligence. Tap into leading cloud-based services like OpenAI, Microsoft Azure AI, Google Gemini and IBM Watson to augment your WordPress-powered websites. Publish content faster while improving SEO performance and increasing audience engagement. ClassifAI integrates Artificial Intelligence and Machine Learning technologies to lighten your workload and eliminate tedious tasks, giving you more time to create original content that matters.
chatbot-ui
Chatbot UI is an open-source AI chat app that allows users to create and deploy their own AI chatbots. It is easy to use and can be customized to fit any need. Chatbot UI is perfect for businesses, developers, and anyone who wants to create a chatbot.
BricksLLM
BricksLLM is a cloud native AI gateway written in Go. Currently, it provides native support for OpenAI, Anthropic, Azure OpenAI and vLLM. BricksLLM aims to provide enterprise level infrastructure that can power any LLM production use cases. Here are some use cases for BricksLLM: * Set LLM usage limits for users on different pricing tiers * Track LLM usage on a per user and per organization basis * Block or redact requests containing PIIs * Improve LLM reliability with failovers, retries and caching * Distribute API keys with rate limits and cost limits for internal development/production use cases * Distribute API keys with rate limits and cost limits for students
uAgents
uAgents is a Python library developed by Fetch.ai that allows for the creation of autonomous AI agents. These agents can perform various tasks on a schedule or take action on various events. uAgents are easy to create and manage, and they are connected to a fast-growing network of other uAgents. They are also secure, with cryptographically secured messages and wallets.
griptape
Griptape is a modular Python framework for building AI-powered applications that securely connect to your enterprise data and APIs. It offers developers the ability to maintain control and flexibility at every step. Griptape's core components include Structures (Agents, Pipelines, and Workflows), Tasks, Tools, Memory (Conversation Memory, Task Memory, and Meta Memory), Drivers (Prompt and Embedding Drivers, Vector Store Drivers, Image Generation Drivers, Image Query Drivers, SQL Drivers, Web Scraper Drivers, and Conversation Memory Drivers), Engines (Query Engines, Extraction Engines, Summary Engines, Image Generation Engines, and Image Query Engines), and additional components (Rulesets, Loaders, Artifacts, Chunkers, and Tokenizers). Griptape enables developers to create AI-powered applications with ease and efficiency.