From 0f278d026f2fffbed9f3470c922d17cef744d0fc Mon Sep 17 00:00:00 2001 From: "magic.chen" Date: Wed, 17 May 2023 14:02:25 +0800 Subject: [PATCH 01/22] Update README.en.md Add discord account --- README.en.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.en.md b/README.en.md index 5a8b1601b..7435d29d2 100644 --- a/README.en.md +++ b/README.en.md @@ -215,9 +215,5 @@ This project follows the git-contributor [spec](https://github.com/xudafeng/git- The MIT License (MIT) ## Contact Information -We are working on building a community, if you have any ideas about building the community, feel free to contact me us. - -name | email| ----------|--------------------- - yushun06| my_prophet@hotmail.com - csunny | cfqcsunny@gmail.com \ No newline at end of file +We are working on building a community, if you have any ideas about building the community, feel free to contact us. +[Discord](https://discord.com/invite/twmZk3vv) From 4302ae908727ec974c30e5aee16c5310351db0de Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 18 May 2023 15:44:29 +0800 Subject: [PATCH 02/22] Add: multi model support --- pilot/model/adapter.py | 96 ++++++++++++++++++++++++++++++++++++++++++ pilot/model/loader.py | 32 +++++++------- 2 files changed, 113 insertions(+), 15 deletions(-) create mode 100644 pilot/model/adapter.py diff --git a/pilot/model/adapter.py b/pilot/model/adapter.py new file mode 100644 index 000000000..fa5803d3a --- /dev/null +++ b/pilot/model/adapter.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +from typing import List +from functools import cache + +from transformers import ( + AutoTokenizer, + AutoModelForCausalLM, + AutoModel +) + +class BaseLLMAdaper: + """The Base class for multi model, in our project. + We will support those model, which performance resemble ChatGPT """ + + def match(self, model_path: str): + return True + + def loader(self, model_path: str, from_pretrained_kwargs: dict): + tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False) + model = AutoModelForCausalLM.from_pretrained( + model_path, low_cpu_mem_usage=True, **from_pretrained_kwargs + ) + return model, tokenizer + + +llm_model_adapters = List[BaseLLMAdaper] = [] + +# Register llm models to adapters, by this we can use multi models. +def register_llm_model_adapters(cls): + """Register a llm model adapter.""" + llm_model_adapters.append(cls()) + + +@cache +def get_llm_model_adapter(model_path: str) -> BaseLLMAdaper: + for adapter in llm_model_adapters: + if adapter.match(model_path): + return adapter + + raise ValueError(f"Invalid model adapter for {model_path}") + + +# TODO support cpu? for practise we support gpt4all or chatglm-6b-int4? + +class VicunaLLMAdapater(BaseLLMAdaper): + """Vicuna Adapter """ + def match(self, model_path: str): + return "vicuna" in model_path + + def loader(self, model_path: str, from_pretrained_kwagrs: dict): + tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False) + model = AutoModelForCausalLM.from_pretrained( + model_path, + low_cpu_mem_usage=True, + **from_pretrained_kwagrs + ) + return model, tokenizer + +class ChatGLMAdapater(BaseLLMAdaper): + """LLM Adatpter for THUDM/chatglm-6b""" + def match(self, model_path: str): + return "chatglm" in model_path + + def loader(self, model_path: str, from_pretrained_kwargs: dict): + tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True) + model = AutoModel.from_pretrained( + model_path, trust_remote_code=True, **from_pretrained_kwargs + ).half().cuda() + return model, tokenizer + +class KoalaLLMAdapter(BaseLLMAdaper): + """Koala LLM Adapter which Based LLaMA """ + def match(self, model_path: str): + return "koala" in model_path + + +class RWKV4LLMAdapter(BaseLLMAdaper): + """LLM Adapter for RwKv4 """ + def match(self, model_path: str): + return "RWKV-4" in model_path + + def loader(self, model_path: str, from_pretrained_kwargs: dict): + # TODO + pass + +class GPT4AllAdapter(BaseLLMAdaper): + """A light version for someone who want practise LLM use laptop.""" + def match(self, model_path: str): + return "gpt4all" in model_path + + +register_llm_model_adapters(VicunaLLMAdapater) +# TODO Default support vicuna, other model need to tests and Evaluate + +register_llm_model_adapters(BaseLLMAdaper) \ No newline at end of file diff --git a/pilot/model/loader.py b/pilot/model/loader.py index 3c0b9a6a7..66d9c733e 100644 --- a/pilot/model/loader.py +++ b/pilot/model/loader.py @@ -2,21 +2,19 @@ # -*- coding: utf-8 -*- import torch +import warnings from pilot.singleton import Singleton -from transformers import ( - AutoTokenizer, - AutoModelForCausalLM, - AutoModel -) - from pilot.model.compression import compress_module +from pilot.model.adapter import get_llm_model_adapter + class ModelLoader(metaclass=Singleton): """Model loader is a class for model load Args: model_path - + + TODO: multi model support. """ kwargs = {} @@ -31,9 +29,11 @@ class ModelLoader(metaclass=Singleton): "device_map": "auto", } + # TODO multi gpu support def loader(self, num_gpus, load_8bit=False, debug=False): if self.device == "cpu": kwargs = {} + elif self.device == "cuda": kwargs = {"torch_dtype": torch.float16} if num_gpus == "auto": @@ -46,18 +46,20 @@ class ModelLoader(metaclass=Singleton): "max_memory": {i: "13GiB" for i in range(num_gpus)}, }) else: + # Todo Support mps for practise raise ValueError(f"Invalid device: {self.device}") - if "chatglm" in self.model_path: - tokenizer = AutoTokenizer.from_pretrained(self.model_path, trust_remote_code=True) - model = AutoModel.from_pretrained(self.model_path, trust_remote_code=True).half().cuda() - else: - tokenizer = AutoTokenizer.from_pretrained(self.model_path, use_fast=False) - model = AutoModelForCausalLM.from_pretrained(self.model_path, - low_cpu_mem_usage=True, **kwargs) + + llm_adapter = get_llm_model_adapter(self.model_path) + model, tokenizer = llm_adapter.loader(self.model_path, kwargs) if load_8bit: - compress_module(model, self.device) + if num_gpus != 1: + warnings.warn( + "8-bit quantization is not supported for multi-gpu inference" + ) + else: + compress_module(model, self.device) if (self.device == "cuda" and num_gpus == 1): model.to(self.device) From 8d16a027851537b0e2c8efec99c9eb52ad779bdd Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 18 May 2023 16:20:09 +0800 Subject: [PATCH 03/22] globalization, upgrade --- README.en.md | 219 ----------------------- README.md | 261 ++++++++++++++-------------- README.zh.md | 224 ++++++++++++++++++++++++ pilot/conversation.py | 4 +- pilot/plugins.py | 2 +- pilot/vector_store/extract_tovec.py | 4 +- pilot/vector_store/file_loader.py | 14 +- 7 files changed, 364 insertions(+), 364 deletions(-) delete mode 100644 README.en.md create mode 100644 README.zh.md diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 7435d29d2..000000000 --- a/README.en.md +++ /dev/null @@ -1,219 +0,0 @@ -# DB-GPT ![GitHub Repo stars](https://img.shields.io/github/stars/csunny/db-gpt?style=social) - ---- - -[中文版](README.md) - -[![Star History Chart](https://api.star-history.com/svg?repos=csunny/DB-GPT)](https://star-history.com/#csunny/DB-GPT) - -## What is DB-GPT? - -As large models are released and iterated upon, they are becoming increasingly intelligent. However, in the process of using large models, we face significant challenges in data security and privacy. We need to ensure that our sensitive data and environments remain completely controlled and avoid any data privacy leaks or security risks. Based on this, we have launched the DB-GPT project to build a complete private large model solution for all database-based scenarios. This solution supports local deployment, allowing it to be applied not only in independent private environments but also to be independently deployed and isolated according to business modules, ensuring that the ability of large models is absolutely private, secure, and controllable. - -DB-GPT is an experimental open-source project that uses localized GPT large models to interact with your data and environment. With this solution, you can be assured that there is no risk of data leakage, and your data is 100% private and secure. - -## Features - -Currently, we have released multiple key features, which are listed below to demonstrate our current capabilities: - -- SQL language capabilities - - SQL generation - - SQL diagnosis -- Private domain Q&A and data processing - - Database knowledge Q&A - - Data processing -- Plugins - - Support custom plugin execution tasks and natively support the Auto-GPT plugin, such as: - - Automatic execution of SQL and retrieval of query results - - Automatic crawling and learning of knowledge -- Unified vector storage/indexing of knowledge base - - Support for unstructured data such as PDF, Markdown, CSV, and WebURL - - -## Demo - -Run on an RTX 4090 GPU. [YouTube](https://www.youtube.com/watch?v=1PWI6F89LPo) - -### Run - -

- -

- -### SQL Generation - -1. Generate Create Table SQL - -

- -

- -2. Generating executable SQL:To generate executable SQL, first select the corresponding database and then the model can generate SQL based on the corresponding database schema information. The successful result of running it would be demonstrated as follows: -

- -

- -### Q&A - -

- -

- -1. Based on the default built-in knowledge base, question and answer. - -

- -

- -2. Add your own knowledge base. - -

- -

- -3. Learning from crawling data from the Internet - - - TODO - - -## Introduction -DB-GPT creates a vast model operating system using [FastChat](https://github.com/lm-sys/FastChat) and offers a large language model powered by [Vicuna](https://huggingface.co/Tribbiani/vicuna-7b). In addition, we provide private domain knowledge base question-answering capability through LangChain. Furthermore, we also provide support for additional plugins, and our design natively supports the Auto-GPT plugin. - -Is the architecture of the entire DB-GPT shown in the following figure: - -

- -

- -The core capabilities mainly consist of the following parts: -1. Knowledge base capability: Supports private domain knowledge base question-answering capability. -2. Large-scale model management capability: Provides a large model operating environment based on FastChat. -3. Unified data vector storage and indexing: Provides a uniform way to store and index various data types. -4. Connection module: Used to connect different modules and data sources to achieve data flow and interaction. -5. Agent and plugins: Provides Agent and plugin mechanisms, allowing users to customize and enhance the system's behavior. -6. Prompt generation and optimization: Automatically generates high-quality prompts and optimizes them to improve system response efficiency. -7. Multi-platform product interface: Supports various client products, such as web, mobile applications, and desktop applications. - -Below is a brief introduction to each module: - -### Knowledge base capability - -As the knowledge base is currently the most significant user demand scenario, we natively support the construction and processing of knowledge bases. At the same time, we also provide multiple knowledge base management strategies in this project, such as: -1. Default built-in knowledge base -2. Custom addition of knowledge bases -3. Various usage scenarios such as constructing knowledge bases through plugin capabilities and web crawling. Users only need to organize the knowledge documents, and they can use our existing capabilities to build the knowledge base required for the large model. - -### LLMs Management - -In the underlying large model integration, we have designed an open interface that supports integration with various large models. At the same time, we have a very strict control and evaluation mechanism for the effectiveness of the integrated models. In terms of accuracy, the integrated models need to align with the capability of ChatGPT at a level of 85% or higher. We use higher standards to select models, hoping to save users the cumbersome testing and evaluation process in the process of use. - -### Vector storage and indexing - -In order to facilitate the management of knowledge after vectorization, we have built-in multiple vector storage engines, from memory-based Chroma to distributed Milvus. Users can choose different storage engines according to their own scenario needs. The storage of knowledge vectors is the cornerstone of AI capability enhancement. As the intermediate language for interaction between humans and large language models, vectors play a very important role in this project. - -### Connections - -In order to interact more conveniently with users' private environments, the project has designed a connection module, which can support connection to databases, Excel, knowledge bases, and other environments to achieve information and data exchange. - -### Agent and Plugin - -The ability of Agent and Plugin is the core of whether large models can be automated. In this project, we natively support the plugin mode, and large models can automatically achieve their goals. At the same time, in order to give full play to the advantages of the community, the plugins used in this project natively support the Auto-GPT plugin ecology, that is, Auto-GPT plugins can directly run in our project. - -### Prompt Automatic Generation and Optimization - -Prompt is a very important part of the interaction between the large model and the user, and to a certain extent, it determines the quality and accuracy of the answer generated by the large model. In this project, we will automatically optimize the corresponding prompt according to user input and usage scenarios, making it easier and more efficient for users to use large language models. - -### Multi-Platform Product Interface - -TODO: In terms of terminal display, we will provide a multi-platform product interface, including PC, mobile phone, command line, Slack and other platforms. - -## Deployment - -### 1. Hardware Requirements -As our project has the ability to achieve ChatGPT performance of over 85%, there are certain hardware requirements. However, overall, the project can be deployed and used on consumer-grade graphics cards. The specific hardware requirements for deployment are as follows: - -| GPU | VRAM Size | Performance | -| --------- | --------- | ------------------------------------------- | -| RTX 4090 | 24 GB | Smooth conversation inference | -| RTX 3090 | 24 GB | Smooth conversation inference, better than V100 | -| V100 | 16 GB | Conversation inference possible, noticeable stutter | - -### 2. Install - -This project relies on a local MySQL database service, which you need to install locally. We recommend using Docker for installation. - -```bash -$ docker run --name=mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=aa12345678 -dit mysql:latest -``` -We use [Chroma embedding database](https://github.com/chroma-core/chroma) as the default for our vector database, so there is no need for special installation. If you choose to connect to other databases, you can follow our tutorial for installation and configuration. -For the entire installation process of DB-GPT, we use the miniconda3 virtual environment. Create a virtual environment and install the Python dependencies. -``` -python>=3.10 -conda create -n dbgpt_env python=3.10 -conda activate dbgpt_env -pip install -r requirements.txt -``` -Alternatively, you can use the following command: -``` -cd DB-GPT -conda env create -f environment.yml -``` -It is recommended to set the Python package path to avoid runtime errors due to package not found. -``` -echo "/root/workspace/DB-GPT" > /root/miniconda3/env/dbgpt_env/lib/python3.10/site-packages/dbgpt.pth -``` -Notice: You need replace the path to your owner. - -### 3. Run -You can refer to this document to obtain the Vicuna weights: [Vicuna](https://github.com/lm-sys/FastChat/blob/main/README.md#model-weights) . - -If you have difficulty with this step, you can also directly use the model from [this link](https://huggingface.co/Tribbiani/vicuna-7b) as a replacement. - -1. Run server -```bash -$ python pilot/server/llmserver.py -``` - -Run gradio webui - -```bash -$ python pilot/server/webserver.py -``` -Notice: the webserver need to connect llmserver, so you need change the pilot/configs/model_config.py file. change the VICUNA_MODEL_SERVER = "http://127.0.0.1:8000" to your address. It's very important. - -## Usage Instructions -We provide a user interface for Gradio, which allows you to use DB-GPT through our user interface. Additionally, we have prepared several reference articles (written in Chinese) that introduce the code and principles related to our project. -- [LLM Practical In Action Series (1) — Combined Langchain-Vicuna Application Practical](https://medium.com/@cfqcsunny/llm-practical-in-action-series-1-combined-langchain-vicuna-application-practical-701cd0413c9f) - -## Acknowledgement - -The achievements of this project are thanks to the technical community, especially the following projects: -- [FastChat](https://github.com/lm-sys/FastChat) for providing chat services -- [vicuna-13b](https://lmsys.org/blog/2023-03-30-vicuna/) as the base model -- [langchain](https://langchain.readthedocs.io/) tool chain -- [Auto-GPT](https://github.com/Significant-Gravitas/Auto-GPT) universal plugin template -- [Hugging Face](https://huggingface.co/) for big model management -- [Chroma](https://github.com/chroma-core/chroma) for vector storage -- [Milvus](https://milvus.io/) for distributed vector storage -- [ChatGLM](https://github.com/THUDM/ChatGLM-6B) as the base model -- [llama_index](https://github.com/jerryjliu/llama_index) for enhancing database-related knowledge using [in-context learning](https://arxiv.org/abs/2301.00234) based on existing knowledge bases. - - - -## Contributors - -|[
csunny](https://github.com/csunny)
|[
xudafeng](https://github.com/xudafeng)
|[
明天](https://github.com/yhjun1026)
| [
Aries-ckt](https://github.com/Aries-ckt)
|[
thebigbone](https://github.com/thebigbone)
| -| :---: | :---: | :---: | :---: |:---: | - - -This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sun May 14 2023 23:02:43 GMT+0800`. - - - -## Licence - -The MIT License (MIT) - -## Contact Information -We are working on building a community, if you have any ideas about building the community, feel free to contact us. -[Discord](https://discord.com/invite/twmZk3vv) diff --git a/README.md b/README.md index 3ef04884b..f5d991208 100644 --- a/README.md +++ b/README.md @@ -1,205 +1,202 @@ # DB-GPT ![GitHub Repo stars](https://img.shields.io/github/stars/csunny/db-gpt?style=social) -[English Edition](README.en.md) +--- + +[中文版](README.zh.md) [![Star History Chart](https://api.star-history.com/svg?repos=csunny/DB-GPT)](https://star-history.com/#csunny/DB-GPT) -## DB-GPT 是什么? -随着大模型的发布迭代,大模型变得越来越智能,在使用大模型的过程当中,遇到极大的数据安全与隐私挑战。在利用大模型能力的过程中我们的私密数据跟环境需要掌握自己的手里,完全可控,避免任何的数据隐私泄露以及安全风险。基于此,我们发起了DB-GPT项目,为所有以数据库为基础的场景,构建一套完整的私有大模型解决方案。 此方案因为支持本地部署,所以不仅仅可以应用于独立私有环境,而且还可以根据业务模块独立部署隔离,让大模型的能力绝对私有、安全、可控。 +## What is DB-GPT? -DB-GPT 是一个开源的以数据库为基础的GPT实验项目,使用本地化的GPT大模型与您的数据和环境进行交互,无数据泄露风险,100% 私密,100% 安全。 +As large models are released and iterated upon, they are becoming increasingly intelligent. However, in the process of using large models, we face significant challenges in data security and privacy. We need to ensure that our sensitive data and environments remain completely controlled and avoid any data privacy leaks or security risks. Based on this, we have launched the DB-GPT project to build a complete private large model solution for all database-based scenarios. This solution supports local deployment, allowing it to be applied not only in independent private environments but also to be independently deployed and isolated according to business modules, ensuring that the ability of large models is absolutely private, secure, and controllable. + +DB-GPT is an experimental open-source project that uses localized GPT large models to interact with your data and environment. With this solution, you can be assured that there is no risk of data leakage, and your data is 100% private and secure. + +## Features + +Currently, we have released multiple key features, which are listed below to demonstrate our current capabilities: + +- SQL language capabilities + - SQL generation + - SQL diagnosis +- Private domain Q&A and data processing + - Database knowledge Q&A + - Data processing +- Plugins + - Support custom plugin execution tasks and natively support the Auto-GPT plugin, such as: + - Automatic execution of SQL and retrieval of query results + - Automatic crawling and learning of knowledge +- Unified vector storage/indexing of knowledge base + - Support for unstructured data such as PDF, Markdown, CSV, and WebURL -## 特性一览 +## Demo -目前我们已经发布了多种关键的特性,这里一一列举展示一下当前发布的能力。 -- SQL 语言能力 - - SQL生成 - - SQL诊断 -- 私域问答与数据处理 - - 数据库知识问答 - - 数据处理 -- 插件模型 - - 支持自定义插件执行任务,原生支持Auto-GPT插件。如: - - SQL自动执行,获取查询结果 - - 自动爬取学习知识 -- 知识库统一向量存储/索引 - - 非结构化数据支持包括PDF、MarkDown、CSV、WebURL +Run on an RTX 4090 GPU. [YouTube](https://www.youtube.com/watch?v=1PWI6F89LPo) -## 效果演示 - -示例通过 RTX 4090 GPU 演示,[YouTube 地址](https://www.youtube.com/watch?v=1PWI6F89LPo) -### 运行环境演示 +### Run

- +

+### SQL Generation + +1. Generate Create Table SQL +

- +

-### SQL 生成 +2. Generating executable SQL:To generate executable SQL, first select the corresponding database and then the model can generate SQL based on the corresponding database schema information. The successful result of running it would be demonstrated as follows: +

+ +

-1. 生成建表语句 +### Q&A

- +

-2. 生成可运行SQL -首先选择对应的数据库, 然后模型即可根据对应的数据库 Schema 信息生成 SQL, 运行成功的效果如下面的演示: +1. Based on the default built-in knowledge base, question and answer.

- +

-3. 自动分析执行SQL输出运行结果 +2. Add your own knowledge base.

- +

-### 数据库问答 +3. Learning from crawling data from the Internet -

- -

+ - TODO -1. 基于默认内置知识库问答 +## Introduction +DB-GPT creates a vast model operating system using [FastChat](https://github.com/lm-sys/FastChat) and offers a large language model powered by [Vicuna](https://huggingface.co/Tribbiani/vicuna-7b). In addition, we provide private domain knowledge base question-answering capability through LangChain. Furthermore, we also provide support for additional plugins, and our design natively supports the Auto-GPT plugin. -

- -

- -2. 自己新增知识库 - -

- -

- -3. 从网络自己爬取数据学习 -- TODO - -## 架构方案 -DB-GPT基于 [FastChat](https://github.com/lm-sys/FastChat) 构建大模型运行环境,并提供 vicuna 作为基础的大语言模型。此外,我们通过LangChain提供私域知识库问答能力。同时我们支持插件模式, 在设计上原生支持Auto-GPT插件。 - -整个DB-GPT的架构,如下图所示 +Is the architecture of the entire DB-GPT shown in the following figure:

-核心能力主要有以下几个部分。 -1. 知识库能力:支持私域知识库问答能力 -2. 大模型管理能力:基于FastChat提供一个大模型的运营环境。 -3. 统一的数据向量化存储与索引:提供一种统一的方式来存储和索引各种数据类型。 -4. 连接模块:用于连接不同的模块和数据源,实现数据的流转和交互。 -5. Agent与插件:提供Agent和插件机制,使得用户可以自定义并增强系统的行为。 -6. Prompt自动生成与优化:自动化生成高质量的Prompt,并进行优化,提高系统的响应效率。 -7. 多端产品界面:支持多种不同的客户端产品,例如Web、移动应用和桌面应用等。 +The core capabilities mainly consist of the following parts: +1. Knowledge base capability: Supports private domain knowledge base question-answering capability. +2. Large-scale model management capability: Provides a large model operating environment based on FastChat. +3. Unified data vector storage and indexing: Provides a uniform way to store and index various data types. +4. Connection module: Used to connect different modules and data sources to achieve data flow and interaction. +5. Agent and plugins: Provides Agent and plugin mechanisms, allowing users to customize and enhance the system's behavior. +6. Prompt generation and optimization: Automatically generates high-quality prompts and optimizes them to improve system response efficiency. +7. Multi-platform product interface: Supports various client products, such as web, mobile applications, and desktop applications. -下面对每个模块也做一些简要的介绍: +Below is a brief introduction to each module: -### 知识库能力 -知识库作为当前用户需求最大的场景,我们原生支持知识库的构建与处理。同时在本项目当中,也提供了多种知识库的管理策略。 如: -1. 默认内置知识库 -2. 自定义新增知识库 -3. 通过插件能力自抓取构建知识库等多种使用场景。 - -用户只需要整理好知识文档,即可用我们现有的能力构建大模型所需要的知识库能力。 +### Knowledge base capability -### 大模型管理能力 -在底层大模型接入中,设计了开放的接口,支持对接多种大模型。同时对于接入模型的效果,我们有非常严格的把控与评审机制。对大模型能力上与ChatGPT对比,在准确率上需要满足85%以上的能力对齐。我们用更高的标准筛选模型,是期望在用户使用过程中,可以省去前面繁琐的测试评估环节。 +As the knowledge base is currently the most significant user demand scenario, we natively support the construction and processing of knowledge bases. At the same time, we also provide multiple knowledge base management strategies in this project, such as: +1. Default built-in knowledge base +2. Custom addition of knowledge bases +3. Various usage scenarios such as constructing knowledge bases through plugin capabilities and web crawling. Users only need to organize the knowledge documents, and they can use our existing capabilities to build the knowledge base required for the large model. -### 统一的数据向量化存储与索引 -为了方便对知识向量化之后的管理,我们内置了多种向量存储引擎,从基于内存的Chroma到分布式的Milvus, 可以根据自己的场景需求,选择不同的存储引擎,整个知识向量存储是AI能力增强的基石,向量作为人与大语言模型交互的中间语言,在本项目中的作用非常重要。 +### LLMs Management -### 连接模块 -为了能够更方便的与用户的私有环境进行交互,项目设计了连接模块,连接模块可以支持连接到数据库、Excel、知识库等等多种环境当中,实现信息与数据交互。 +In the underlying large model integration, we have designed an open interface that supports integration with various large models. At the same time, we have a very strict control and evaluation mechanism for the effectiveness of the integrated models. In terms of accuracy, the integrated models need to align with the capability of ChatGPT at a level of 85% or higher. We use higher standards to select models, hoping to save users the cumbersome testing and evaluation process in the process of use. -### Agent与插件 -Agent与插件能力是大模型能否自动化的核心,在本的项目中,原生支持插件模式,大模型可以自动化完成目标。 同时为了充分发挥社区的优势,本项目中所用的插件原生支持Auto-GPT插件生态,即Auto-GPT的插件可以直接在我们的项目中运行。 +### Vector storage and indexing -### Prompt自动生成与优化 -Prompt是与大模型交互过程中非常重要的部分,一定程度上Prompt决定了大模型生成答案的质量与准确性,在本的项目中,我们会根据用户输入与使用场景,自动优化对应的Prompt,让用户使用大语言模型变得更简单、更高效。 +In order to facilitate the management of knowledge after vectorization, we have built-in multiple vector storage engines, from memory-based Chroma to distributed Milvus. Users can choose different storage engines according to their own scenario needs. The storage of knowledge vectors is the cornerstone of AI capability enhancement. As the intermediate language for interaction between humans and large language models, vectors play a very important role in this project. -### 多端产品界面 -TODO: 在终端展示上,我们将提供多端产品界面。包括PC、手机、命令行、Slack等多种模式。 +### Connections +In order to interact more conveniently with users' private environments, the project has designed a connection module, which can support connection to databases, Excel, knowledge bases, and other environments to achieve information and data exchange. -## 安装教程 -### 1.硬件说明 -因为我们的项目在效果上具备ChatGPT 85%以上的能力,因此对硬件有一定的要求。 但总体来说,我们在消费级的显卡上即可完成项目的部署使用,具体部署的硬件说明如下: -| GPU型号 | 显存大小 | 性能 | -| ------- | -------- | ------------------------------------------ | -| RTX4090 | 24G | 可以流畅的进行对话推理,无卡顿 | -| RTX3090 | 24G | 可以流畅进行对话推理,有卡顿感,但好于V100 | -| V100 | 16G | 可以进行对话推理,有明显卡顿 | -### 2.DB-GPT安装 +### Agent and Plugin -本项目依赖一个本地的 MySQL 数据库服务,你需要本地安装,推荐直接使用 Docker 安装。 +The ability of Agent and Plugin is the core of whether large models can be automated. In this project, we natively support the plugin mode, and large models can automatically achieve their goals. At the same time, in order to give full play to the advantages of the community, the plugins used in this project natively support the Auto-GPT plugin ecology, that is, Auto-GPT plugins can directly run in our project. + +### Prompt Automatic Generation and Optimization + +Prompt is a very important part of the interaction between the large model and the user, and to a certain extent, it determines the quality and accuracy of the answer generated by the large model. In this project, we will automatically optimize the corresponding prompt according to user input and usage scenarios, making it easier and more efficient for users to use large language models. + +### Multi-Platform Product Interface + +TODO: In terms of terminal display, we will provide a multi-platform product interface, including PC, mobile phone, command line, Slack and other platforms. + +## Deployment + +### 1. Hardware Requirements +As our project has the ability to achieve ChatGPT performance of over 85%, there are certain hardware requirements. However, overall, the project can be deployed and used on consumer-grade graphics cards. The specific hardware requirements for deployment are as follows: + +| GPU | VRAM Size | Performance | +| --------- | --------- | ------------------------------------------- | +| RTX 4090 | 24 GB | Smooth conversation inference | +| RTX 3090 | 24 GB | Smooth conversation inference, better than V100 | +| V100 | 16 GB | Conversation inference possible, noticeable stutter | + +### 2. Install + +This project relies on a local MySQL database service, which you need to install locally. We recommend using Docker for installation. + +```bash +$ docker run --name=mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=aa12345678 -dit mysql:latest ``` -docker run --name=mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=aa12345678 -dit mysql:latest -``` -向量数据库我们默认使用的是Chroma内存数据库,所以无需特殊安装,如果有需要连接其他的同学,可以按照我们的教程进行安装配置。整个DB-GPT的安装过程,我们使用的是miniconda3的虚拟环境。创建虚拟环境,并安装python依赖包 - +We use [Chroma embedding database](https://github.com/chroma-core/chroma) as the default for our vector database, so there is no need for special installation. If you choose to connect to other databases, you can follow our tutorial for installation and configuration. +For the entire installation process of DB-GPT, we use the miniconda3 virtual environment. Create a virtual environment and install the Python dependencies. ``` python>=3.10 conda create -n dbgpt_env python=3.10 conda activate dbgpt_env pip install -r requirements.txt - ``` -或者也可以使用命令: +Alternatively, you can use the following command: ``` cd DB-GPT conda env create -f environment.yml ``` -另外需要设置一下python包路径, 避免出现运行时找不到包 +It is recommended to set the Python package path to avoid runtime errors due to package not found. ``` echo "/root/workspace/DB-GPT" > /root/miniconda3/env/dbgpt_env/lib/python3.10/site-packages/dbgpt.pth ``` +Notice: You need replace the path to your owner. -### 3. 运行大模型 +### 3. Run +You can refer to this document to obtain the Vicuna weights: [Vicuna](https://github.com/lm-sys/FastChat/blob/main/README.md#model-weights) . -关于基础模型, 可以根据[Vicuna](https://github.com/lm-sys/FastChat/blob/main/README.md#model-weights)合成教程进行合成。 -如果此步有困难的同学,也可以直接使用[此链接](https://huggingface.co/Tribbiani/vicuna-7b)上的模型进行替代。 +If you have difficulty with this step, you can also directly use the model from [this link](https://huggingface.co/Tribbiani/vicuna-7b) as a replacement. - 运行模型服务 -``` -cd pilot/server -python llmserver.py +1. Run server +```bash +$ python pilot/server/llmserver.py ``` -运行 gradio webui +Run gradio webui ```bash -$ python webserver.py +$ python pilot/server/webserver.py ``` -注意: 在启动Webserver之前, 需要修改pilot/configs/model_config.py 文件中的VICUNA_MODEL_SERVER = "http://127.0.0.1:8000", 将地址设置为你的服务器地址。 +Notice: the webserver need to connect llmserver, so you need change the pilot/configs/model_config.py file. change the VICUNA_MODEL_SERVER = "http://127.0.0.1:8000" to your address. It's very important. -## 使用说明 +## Usage Instructions +We provide a user interface for Gradio, which allows you to use DB-GPT through our user interface. Additionally, we have prepared several reference articles (written in Chinese) that introduce the code and principles related to our project. +- [LLM Practical In Action Series (1) — Combined Langchain-Vicuna Application Practical](https://medium.com/@cfqcsunny/llm-practical-in-action-series-1-combined-langchain-vicuna-application-practical-701cd0413c9f) -我们提供了Gradio的用户界面,可以通过我们的用户界面使用DB-GPT, 同时关于我们项目相关的一些代码跟原理介绍,我们也准备了以下几篇参考文章。 -1. [大模型实战系列(1) —— 强强联合Langchain-Vicuna应用实战](https://zhuanlan.zhihu.com/p/628750042) -2. [大模型实战系列(2) —— DB-GPT 阿里云部署指南](https://zhuanlan.zhihu.com/p/629467580) -3. [大模型实战系列(3) —— DB-GPT插件模型原理与使用](https://zhuanlan.zhihu.com/p/629623125) +## Acknowledgement -## 感谢 - -项目取得的成果,需要感谢技术社区,尤其以下项目。 - -- [FastChat](https://github.com/lm-sys/FastChat) 提供 chat 服务 -- [vicuna-13b](https://huggingface.co/Tribbiani/vicuna-13b) 作为基础模型 -- [langchain](https://github.com/hwchase17/langchain) 工具链 -- [Auto-GPT](https://github.com/Significant-Gravitas/Auto-GPT) 通用的插件模版 -- [Hugging Face](https://huggingface.co/) 大模型管理 -- [Chroma](https://github.com/chroma-core/chroma) 向量存储 -- [Milvus](https://milvus.io/) 分布式向量存储 -- [ChatGLM](https://github.com/THUDM/ChatGLM-6B) 基础模型 -- [llama-index](https://github.com/jerryjliu/llama_index) 基于现有知识库进行[In-Context Learning](https://arxiv.org/abs/2301.00234)来对其进行数据库相关知识的增强。 +The achievements of this project are thanks to the technical community, especially the following projects: +- [FastChat](https://github.com/lm-sys/FastChat) for providing chat services +- [vicuna-13b](https://lmsys.org/blog/2023-03-30-vicuna/) as the base model +- [langchain](https://langchain.readthedocs.io/) tool chain +- [Auto-GPT](https://github.com/Significant-Gravitas/Auto-GPT) universal plugin template +- [Hugging Face](https://huggingface.co/) for big model management +- [Chroma](https://github.com/chroma-core/chroma) for vector storage +- [Milvus](https://milvus.io/) for distributed vector storage +- [ChatGLM](https://github.com/THUDM/ChatGLM-6B) as the base model +- [llama_index](https://github.com/jerryjliu/llama_index) for enhancing database-related knowledge using [in-context learning](https://arxiv.org/abs/2301.00234) based on existing knowledge bases. @@ -213,12 +210,10 @@ This project follows the git-contributor [spec](https://github.com/xudafeng/git- -这是一个用于数据库的复杂且创新的工具, 我们的项目也在紧急的开发当中, 会陆续发布一些新的feature。如在使用当中有任何具体问题, 优先在项目下提issue, 如有需要, 请联系如下微信,我会尽力提供帮助,同时也非常欢迎大家参与到项目建设中。 - -

- -

- ## Licence The MIT License (MIT) + +## Contact Information +We are working on building a community, if you have any ideas about building the community, feel free to contact us. +[Discord](https://discord.com/invite/twmZk3vv) diff --git a/README.zh.md b/README.zh.md new file mode 100644 index 000000000..77d26facf --- /dev/null +++ b/README.zh.md @@ -0,0 +1,224 @@ +# DB-GPT ![GitHub Repo stars](https://img.shields.io/github/stars/csunny/db-gpt?style=social) + +[English Edition](README.zh.md) + +[![Star History Chart](https://api.star-history.com/svg?repos=csunny/DB-GPT)](https://star-history.com/#csunny/DB-GPT) + +## DB-GPT 是什么? +随着大模型的发布迭代,大模型变得越来越智能,在使用大模型的过程当中,遇到极大的数据安全与隐私挑战。在利用大模型能力的过程中我们的私密数据跟环境需要掌握自己的手里,完全可控,避免任何的数据隐私泄露以及安全风险。基于此,我们发起了DB-GPT项目,为所有以数据库为基础的场景,构建一套完整的私有大模型解决方案。 此方案因为支持本地部署,所以不仅仅可以应用于独立私有环境,而且还可以根据业务模块独立部署隔离,让大模型的能力绝对私有、安全、可控。 + +DB-GPT 是一个开源的以数据库为基础的GPT实验项目,使用本地化的GPT大模型与您的数据和环境进行交互,无数据泄露风险,100% 私密,100% 安全。 + + +## 特性一览 + +目前我们已经发布了多种关键的特性,这里一一列举展示一下当前发布的能力。 +- SQL 语言能力 + - SQL生成 + - SQL诊断 +- 私域问答与数据处理 + - 数据库知识问答 + - 数据处理 +- 插件模型 + - 支持自定义插件执行任务,原生支持Auto-GPT插件。如: + - SQL自动执行,获取查询结果 + - 自动爬取学习知识 +- 知识库统一向量存储/索引 + - 非结构化数据支持包括PDF、MarkDown、CSV、WebURL + +## 效果演示 + +示例通过 RTX 4090 GPU 演示,[YouTube 地址](https://www.youtube.com/watch?v=1PWI6F89LPo) +### 运行环境演示 + +

+ +

+ +

+ +

+ +### SQL 生成 + +1. 生成建表语句 + +

+ +

+ +2. 生成可运行SQL +首先选择对应的数据库, 然后模型即可根据对应的数据库 Schema 信息生成 SQL, 运行成功的效果如下面的演示: + +

+ +

+ +3. 自动分析执行SQL输出运行结果 + +

+ +

+ +### 数据库问答 + +

+ +

+ + +1. 基于默认内置知识库问答 + +

+ +

+ +2. 自己新增知识库 + +

+ +

+ +3. 从网络自己爬取数据学习 +- TODO + +## 架构方案 +DB-GPT基于 [FastChat](https://github.com/lm-sys/FastChat) 构建大模型运行环境,并提供 vicuna 作为基础的大语言模型。此外,我们通过LangChain提供私域知识库问答能力。同时我们支持插件模式, 在设计上原生支持Auto-GPT插件。 + +整个DB-GPT的架构,如下图所示 + +

+ +

+ +核心能力主要有以下几个部分。 +1. 知识库能力:支持私域知识库问答能力 +2. 大模型管理能力:基于FastChat提供一个大模型的运营环境。 +3. 统一的数据向量化存储与索引:提供一种统一的方式来存储和索引各种数据类型。 +4. 连接模块:用于连接不同的模块和数据源,实现数据的流转和交互。 +5. Agent与插件:提供Agent和插件机制,使得用户可以自定义并增强系统的行为。 +6. Prompt自动生成与优化:自动化生成高质量的Prompt,并进行优化,提高系统的响应效率。 +7. 多端产品界面:支持多种不同的客户端产品,例如Web、移动应用和桌面应用等。 + +下面对每个模块也做一些简要的介绍: + +### 知识库能力 +知识库作为当前用户需求最大的场景,我们原生支持知识库的构建与处理。同时在本项目当中,也提供了多种知识库的管理策略。 如: +1. 默认内置知识库 +2. 自定义新增知识库 +3. 通过插件能力自抓取构建知识库等多种使用场景。 + +用户只需要整理好知识文档,即可用我们现有的能力构建大模型所需要的知识库能力。 + +### 大模型管理能力 +在底层大模型接入中,设计了开放的接口,支持对接多种大模型。同时对于接入模型的效果,我们有非常严格的把控与评审机制。对大模型能力上与ChatGPT对比,在准确率上需要满足85%以上的能力对齐。我们用更高的标准筛选模型,是期望在用户使用过程中,可以省去前面繁琐的测试评估环节。 + +### 统一的数据向量化存储与索引 +为了方便对知识向量化之后的管理,我们内置了多种向量存储引擎,从基于内存的Chroma到分布式的Milvus, 可以根据自己的场景需求,选择不同的存储引擎,整个知识向量存储是AI能力增强的基石,向量作为人与大语言模型交互的中间语言,在本项目中的作用非常重要。 + +### 连接模块 +为了能够更方便的与用户的私有环境进行交互,项目设计了连接模块,连接模块可以支持连接到数据库、Excel、知识库等等多种环境当中,实现信息与数据交互。 + +### Agent与插件 +Agent与插件能力是大模型能否自动化的核心,在本的项目中,原生支持插件模式,大模型可以自动化完成目标。 同时为了充分发挥社区的优势,本项目中所用的插件原生支持Auto-GPT插件生态,即Auto-GPT的插件可以直接在我们的项目中运行。 + +### Prompt自动生成与优化 +Prompt是与大模型交互过程中非常重要的部分,一定程度上Prompt决定了大模型生成答案的质量与准确性,在本的项目中,我们会根据用户输入与使用场景,自动优化对应的Prompt,让用户使用大语言模型变得更简单、更高效。 + +### 多端产品界面 +TODO: 在终端展示上,我们将提供多端产品界面。包括PC、手机、命令行、Slack等多种模式。 + + +## 安装教程 +### 1.硬件说明 +因为我们的项目在效果上具备ChatGPT 85%以上的能力,因此对硬件有一定的要求。 但总体来说,我们在消费级的显卡上即可完成项目的部署使用,具体部署的硬件说明如下: +| GPU型号 | 显存大小 | 性能 | +| ------- | -------- | ------------------------------------------ | +| RTX4090 | 24G | 可以流畅的进行对话推理,无卡顿 | +| RTX3090 | 24G | 可以流畅进行对话推理,有卡顿感,但好于V100 | +| V100 | 16G | 可以进行对话推理,有明显卡顿 | +### 2.DB-GPT安装 + +本项目依赖一个本地的 MySQL 数据库服务,你需要本地安装,推荐直接使用 Docker 安装。 +``` +docker run --name=mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=aa12345678 -dit mysql:latest +``` +向量数据库我们默认使用的是Chroma内存数据库,所以无需特殊安装,如果有需要连接其他的同学,可以按照我们的教程进行安装配置。整个DB-GPT的安装过程,我们使用的是miniconda3的虚拟环境。创建虚拟环境,并安装python依赖包 + +``` +python>=3.10 +conda create -n dbgpt_env python=3.10 +conda activate dbgpt_env +pip install -r requirements.txt + +``` +或者也可以使用命令: +``` +cd DB-GPT +conda env create -f environment.yml +``` +另外需要设置一下python包路径, 避免出现运行时找不到包 +``` +echo "/root/workspace/DB-GPT" > /root/miniconda3/env/dbgpt_env/lib/python3.10/site-packages/dbgpt.pth +``` + +### 3. 运行大模型 + +关于基础模型, 可以根据[Vicuna](https://github.com/lm-sys/FastChat/blob/main/README.md#model-weights)合成教程进行合成。 +如果此步有困难的同学,也可以直接使用[此链接](https://huggingface.co/Tribbiani/vicuna-7b)上的模型进行替代。 + + 运行模型服务 +``` +cd pilot/server +python llmserver.py +``` + +运行 gradio webui + +```bash +$ python webserver.py +``` +注意: 在启动Webserver之前, 需要修改pilot/configs/model_config.py 文件中的VICUNA_MODEL_SERVER = "http://127.0.0.1:8000", 将地址设置为你的服务器地址。 + +## 使用说明 + +我们提供了Gradio的用户界面,可以通过我们的用户界面使用DB-GPT, 同时关于我们项目相关的一些代码跟原理介绍,我们也准备了以下几篇参考文章。 +1. [大模型实战系列(1) —— 强强联合Langchain-Vicuna应用实战](https://zhuanlan.zhihu.com/p/628750042) +2. [大模型实战系列(2) —— DB-GPT 阿里云部署指南](https://zhuanlan.zhihu.com/p/629467580) +3. [大模型实战系列(3) —— DB-GPT插件模型原理与使用](https://zhuanlan.zhihu.com/p/629623125) + +## 感谢 + +项目取得的成果,需要感谢技术社区,尤其以下项目。 + +- [FastChat](https://github.com/lm-sys/FastChat) 提供 chat 服务 +- [vicuna-13b](https://huggingface.co/Tribbiani/vicuna-13b) 作为基础模型 +- [langchain](https://github.com/hwchase17/langchain) 工具链 +- [Auto-GPT](https://github.com/Significant-Gravitas/Auto-GPT) 通用的插件模版 +- [Hugging Face](https://huggingface.co/) 大模型管理 +- [Chroma](https://github.com/chroma-core/chroma) 向量存储 +- [Milvus](https://milvus.io/) 分布式向量存储 +- [ChatGLM](https://github.com/THUDM/ChatGLM-6B) 基础模型 +- [llama-index](https://github.com/jerryjliu/llama_index) 基于现有知识库进行[In-Context Learning](https://arxiv.org/abs/2301.00234)来对其进行数据库相关知识的增强。 + + + +## Contributors + +|[
csunny](https://github.com/csunny)
|[
xudafeng](https://github.com/xudafeng)
|[
明天](https://github.com/yhjun1026)
| [
Aries-ckt](https://github.com/Aries-ckt)
|[
thebigbone](https://github.com/thebigbone)
| +| :---: | :---: | :---: | :---: |:---: | + + +This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sun May 14 2023 23:02:43 GMT+0800`. + + + +这是一个用于数据库的复杂且创新的工具, 我们的项目也在紧急的开发当中, 会陆续发布一些新的feature。如在使用当中有任何具体问题, 优先在项目下提issue, 如有需要, 请联系如下微信,我会尽力提供帮助,同时也非常欢迎大家参与到项目建设中。 + +

+ +

+ +## Licence + +The MIT License (MIT) diff --git a/pilot/conversation.py b/pilot/conversation.py index 073f25f24..296a47f09 100644 --- a/pilot/conversation.py +++ b/pilot/conversation.py @@ -99,7 +99,7 @@ def gen_sqlgen_conversation(dbname): schemas = mo.get_schema(dbname) for s in schemas: message += s["schema_info"] + ";" - return f"数据库{dbname}的Schema信息如下: {message}\n" + return f"Database {dbname} Schema information as follows: {message}\n" conv_one_shot = Conversation( @@ -162,7 +162,7 @@ auto_dbgpt_one_shot = Conversation( Schema: - 数据库gpt-user的Schema信息如下: users(city,create_time,email,last_login_time,phone,user_name); + Database gpt-user Schema information as follows: users(city,create_time,email,last_login_time,phone,user_name); Commands: diff --git a/pilot/plugins.py b/pilot/plugins.py index 196a68b22..28f33a5a4 100644 --- a/pilot/plugins.py +++ b/pilot/plugins.py @@ -17,7 +17,7 @@ from pilot.logs import logger def inspect_zip_for_modules(zip_path: str, debug: bool = False) -> list[str]: """ - 加载zip文件的插件,完全兼容Auto_gpt_plugin + Loader zip plugin file. Native support Auto_gpt_plugin Args: zip_path (str): Path to the zipfile. diff --git a/pilot/vector_store/extract_tovec.py b/pilot/vector_store/extract_tovec.py index 8badf6fed..c6b83d467 100644 --- a/pilot/vector_store/extract_tovec.py +++ b/pilot/vector_store/extract_tovec.py @@ -40,8 +40,8 @@ def knownledge_tovec_st(filename): def load_knownledge_from_doc(): - """从数据集当中加载知识 - # TODO 如果向量存储已经存在, 则无需初始化 + """Loader Knownledge from current datasets + # TODO if the vector store is exists, just use it. """ if not os.path.exists(DATASETS_DIR): diff --git a/pilot/vector_store/file_loader.py b/pilot/vector_store/file_loader.py index 296232f21..8f668f60e 100644 --- a/pilot/vector_store/file_loader.py +++ b/pilot/vector_store/file_loader.py @@ -40,15 +40,15 @@ class KnownLedge2Vector: def init_vector_store(self): persist_dir = os.path.join(VECTORE_PATH, ".vectordb") - print("向量数据库持久化地址: ", persist_dir) + print("Vector store Persist address is: ", persist_dir) if os.path.exists(persist_dir): - # 从本地持久化文件中Load - print("从本地向量加载数据...") + # Loader from local file. + print("Loader data from local persist vector file...") vector_store = Chroma(persist_directory=persist_dir, embedding_function=self.embeddings) # vector_store.add_documents(documents=documents) else: documents = self.load_knownlege() - # 重新初始化 + # reinit vector_store = Chroma.from_documents(documents=documents, embedding=self.embeddings, persist_directory=persist_dir) @@ -61,17 +61,17 @@ class KnownLedge2Vector: for file in files: filename = os.path.join(root, file) docs = self._load_file(filename) - # 更新metadata数据 + # update metadata. new_docs = [] for doc in docs: doc.metadata = {"source": doc.metadata["source"].replace(DATASETS_DIR, "")} - print("文档2向量初始化中, 请稍等...", doc.metadata) + print("Documents to vector running, please wait...", doc.metadata) new_docs.append(doc) docments += new_docs return docments def _load_file(self, filename): - # 加载文件 + # Loader file if filename.lower().endswith(".pdf"): loader = UnstructuredFileLoader(filename) text_splitor = CharacterTextSplitter() From f3116c597b070118f20c54eed5a6ad68cf98560c Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 18 May 2023 16:22:52 +0800 Subject: [PATCH 04/22] docs: update --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index f5d991208..e4ae5c1c5 100644 --- a/README.md +++ b/README.md @@ -215,5 +215,4 @@ This project follows the git-contributor [spec](https://github.com/xudafeng/git- The MIT License (MIT) ## Contact Information -We are working on building a community, if you have any ideas about building the community, feel free to contact us. -[Discord](https://discord.com/invite/twmZk3vv) +We are working on building a community, if you have any ideas about building the community, feel free to contact us. [Discord](https://discord.com/invite/twmZk3vv) From ba7e23d37f07381bebc3bcbbb1cde8e7796dcc22 Mon Sep 17 00:00:00 2001 From: yhjun1026 <460342015@qq.com> Date: Thu, 18 May 2023 16:30:57 +0800 Subject: [PATCH 05/22] Unified configuration --- .env.template | 12 ++++++---- .gitignore | 1 + README.en.md | 2 +- README.md | 2 +- examples/embdserver.py | 9 ++++--- pilot/configs/config.py | 42 +++++++++++++++++++++++---------- pilot/configs/model_config.py | 23 +++++++----------- pilot/conversation.py | 12 ++++++++-- pilot/model/vicuna_llm.py | 7 +++--- pilot/pturning/lora/finetune.py | 7 ++++-- pilot/server/llmserver.py | 9 ++++--- pilot/server/webserver.py | 21 +++++++++++------ requirements.txt | 3 +++ 13 files changed, 97 insertions(+), 53 deletions(-) diff --git a/.env.template b/.env.template index 5bf746eaa..3d2240bff 100644 --- a/.env.template +++ b/.env.template @@ -17,6 +17,10 @@ #*******************************************************************# #** LLM MODELS **# #*******************************************************************# +LLM_MODEL=vicuna-13b +MODEL_SERVER=http://your_model_server_url +LIMIT_MODEL_CONCURRENCY=5 +MAX_POSITION_EMBEDDINGS=4096 ## SMART_LLM_MODEL - Smart language model (Default: vicuna-13b) ## FAST_LLM_MODEL - Fast language model (Default: chatglm-6b) @@ -36,10 +40,10 @@ #*******************************************************************# #** DATABASE SETTINGS **# #*******************************************************************# -DB_SETTINGS_MYSQL_USER=root -DB_SETTINGS_MYSQL_PASSWORD=password -DB_SETTINGS_MYSQL_HOST=localhost -DB_SETTINGS_MYSQL_PORT=3306 +LOCAL_DB_USER=root +LOCAL_DB_PASSWORD=password +LOCAL_DB_HOST=localhost +LOCAL_DB_PORT=3306 ### MILVUS diff --git a/.gitignore b/.gitignore index c4c4a344e..cb21ee557 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ __pycache__/ # C extensions *.so +.env .idea .vscode .idea diff --git a/README.en.md b/README.en.md index 7435d29d2..03c3cbb3c 100644 --- a/README.en.md +++ b/README.en.md @@ -179,7 +179,7 @@ Run gradio webui ```bash $ python pilot/server/webserver.py ``` -Notice: the webserver need to connect llmserver, so you need change the pilot/configs/model_config.py file. change the VICUNA_MODEL_SERVER = "http://127.0.0.1:8000" to your address. It's very important. +Notice: the webserver need to connect llmserver, so you need change the .env file. change the MODEL_SERVER = "http://127.0.0.1:8000" to your address. It's very important. ## Usage Instructions We provide a user interface for Gradio, which allows you to use DB-GPT through our user interface. Additionally, we have prepared several reference articles (written in Chinese) that introduce the code and principles related to our project. diff --git a/README.md b/README.md index 3ef04884b..e0994acc9 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ python llmserver.py ```bash $ python webserver.py ``` -注意: 在启动Webserver之前, 需要修改pilot/configs/model_config.py 文件中的VICUNA_MODEL_SERVER = "http://127.0.0.1:8000", 将地址设置为你的服务器地址。 +注意: 在启动Webserver之前, 需要修改配置文件 .env文件中的MODEL_SERVER = "http://127.0.0.1:8000", 将地址设置为你的服务器地址。 ## 使用说明 diff --git a/examples/embdserver.py b/examples/embdserver.py index 6599a18ad..79140ba66 100644 --- a/examples/embdserver.py +++ b/examples/embdserver.py @@ -7,12 +7,15 @@ import time import uuid from urllib.parse import urljoin import gradio as gr -from pilot.configs.model_config import * +from pilot.configs.config import Config from pilot.conversation import conv_qa_prompt_template, conv_templates from langchain.prompts import PromptTemplate + vicuna_stream_path = "generate_stream" +CFG = Config() + def generate(query): template_name = "conv_one_shot" @@ -41,7 +44,7 @@ def generate(query): } response = requests.post( - url=urljoin(VICUNA_MODEL_SERVER, vicuna_stream_path), data=json.dumps(params) + url=urljoin(CFG.MODEL_SERVER, vicuna_stream_path), data=json.dumps(params) ) skip_echo_len = len(params["prompt"]) + 1 - params["prompt"].count("") * 3 @@ -54,7 +57,7 @@ def generate(query): yield(output) if __name__ == "__main__": - print(LLM_MODEL) + print(CFG.LLM_MODEL) with gr.Blocks() as demo: gr.Markdown("数据库SQL生成助手") with gr.Tab("SQL生成"): diff --git a/pilot/configs/config.py b/pilot/configs/config.py index 5749a752d..9023bc061 100644 --- a/pilot/configs/config.py +++ b/pilot/configs/config.py @@ -2,24 +2,23 @@ # -*- coding: utf-8 -*- import os +import nltk from typing import List from auto_gpt_plugin_template import AutoGPTPluginTemplate from pilot.singleton import Singleton + class Config(metaclass=Singleton): """Configuration class to store the state of bools for different scripts access""" def __init__(self) -> None: """Initialize the Config class""" - # TODO change model_config there - self.debug_mode = False self.skip_reprompt = False - self.temperature = float(os.getenv("TEMPERATURE", 0.7)) - # TODO change model_config there + self.execute_local_commands = ( os.getenv("EXECUTE_LOCAL_COMMANDS", "False") == "True" ) @@ -46,17 +45,12 @@ class Config(metaclass=Singleton): self.milvus_collection = os.getenv("MILVUS_COLLECTION", "dbgpt") self.milvus_secure = os.getenv("MILVUS_SECURE") == "True" + self.authorise_key = os.getenv("AUTHORISE_COMMAND_KEY", "y") self.exit_key = os.getenv("EXIT_KEY", "n") - self.image_provider = bool(os.getenv("IMAGE_PROVIDER", True)) + self.image_provider = os.getenv("IMAGE_PROVIDER", True) self.image_size = int(os.getenv("IMAGE_SIZE", 256)) - self.plugins_dir = os.getenv("PLUGINS_DIR", "../../plugins") - self.plugins: List[AutoGPTPluginTemplate] = [] - self.plugins_openai = [] - - self.command_registry = [] - self.huggingface_api_token = os.getenv("HUGGINGFACE_API_TOKEN") self.image_provider = os.getenv("IMAGE_PROVIDER") self.image_size = int(os.getenv("IMAGE_SIZE", 256)) @@ -68,6 +62,10 @@ class Config(metaclass=Singleton): ) self.speak_mode = False + + ### Related configuration of built-in commands + self.command_registry = [] + disabled_command_categories = os.getenv("DISABLED_COMMAND_CATEGORIES") if disabled_command_categories: self.disabled_command_categories = disabled_command_categories.split(",") @@ -78,6 +76,12 @@ class Config(metaclass=Singleton): os.getenv("EXECUTE_LOCAL_COMMANDS", "False") == "True" ) + + ### The associated configuration parameters of the plug-in control the loading and use of the plug-in + self.plugins_dir = os.getenv("PLUGINS_DIR", "../../plugins") + self.plugins: List[AutoGPTPluginTemplate] = [] + self.plugins_openai = [] + plugins_allowlist = os.getenv("ALLOWLISTED_PLUGINS") if plugins_allowlist: self.plugins_allowlist = plugins_allowlist.split(",") @@ -89,7 +93,21 @@ class Config(metaclass=Singleton): self.plugins_denylist = plugins_denylist.split(",") else: self.plugins_denylist = [] - + + + ### Local database connection configuration + self.LOCAL_DB_HOST = os.getenv("LOCAL_DB_HOST", "127.0.0.1") + self.LOCAL_DB_PORT = int(os.getenv("LOCAL_DB_PORT", 3306)) + self.LOCAL_DB_USER = os.getenv("LOCAL_DB_USER", "root") + self.LOCAL_DB_PASSWORD = os.getenv("LOCAL_DB_PASSWORD", "aa123456") + + ### LLM Model Service Configuration + self.LLM_MODEL = os.getenv("LLM_MODEL", "vicuna-13b") + self.LIMIT_MODEL_CONCURRENCY = int(os.getenv("LIMIT_MODEL_CONCURRENCY", 5)) + self.MAX_POSITION_EMBEDDINGS = int(os.getenv("MAX_POSITION_EMBEDDINGS", 4096)) + self.MODEL_SERVER = os.getenv("MODEL_SERVER", "http://121.41.167.183:8000") + self.ISLOAD_8BIT = os.getenv("ISLOAD_8BIT", "True") == "True" + def set_debug_mode(self, value: bool) -> None: """Set the debug mode value""" self.debug_mode = value diff --git a/pilot/configs/model_config.py b/pilot/configs/model_config.py index 12c7e33da..af6c138b5 100644 --- a/pilot/configs/model_config.py +++ b/pilot/configs/model_config.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python3 # -*- coding:utf-8 -*- import torch @@ -22,25 +22,18 @@ LLM_MODEL_CONFIG = { "vicuna-13b": os.path.join(MODEL_PATH, "vicuna-13b"), "sentence-transforms": os.path.join(MODEL_PATH, "all-MiniLM-L6-v2") } - - -VECTOR_SEARCH_TOP_K = 3 -LLM_MODEL = "vicuna-13b" -LIMIT_MODEL_CONCURRENCY = 5 -MAX_POSITION_EMBEDDINGS = 4096 -VICUNA_MODEL_SERVER = "http://121.41.167.183:8000" - # Load model config ISLOAD_8BIT = True ISDEBUG = False -DB_SETTINGS = { - "user": "root", - "password": "aa123456", - "host": "127.0.0.1", - "port": 3306 -} +VECTOR_SEARCH_TOP_K = 3 +# LLM_MODEL = "vicuna-13b" +# LIMIT_MODEL_CONCURRENCY = 5 +# MAX_POSITION_EMBEDDINGS = 4096 +# VICUNA_MODEL_SERVER = "http://121.41.167.183:8000" + + VS_ROOT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "vs_store") KNOWLEDGE_UPLOAD_ROOT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "knowledge") \ No newline at end of file diff --git a/pilot/conversation.py b/pilot/conversation.py index 073f25f24..47414ec8a 100644 --- a/pilot/conversation.py +++ b/pilot/conversation.py @@ -4,8 +4,16 @@ import dataclasses from enum import auto, Enum from typing import List, Any -from pilot.configs.model_config import DB_SETTINGS +from pilot.configs.config import Config +CFG = Config() + +DB_SETTINGS = { + "user": CFG.LOCAL_DB_USER, + "password": CFG.LOCAL_DB_PASSWORD, + "host": CFG.LOCAL_DB_HOST, + "port": CFG.LOCAL_DB_PORT +} class SeparatorStyle(Enum): SINGLE = auto() @@ -91,7 +99,7 @@ class Conversation: def gen_sqlgen_conversation(dbname): from pilot.connections.mysql import MySQLOperator mo = MySQLOperator( - **DB_SETTINGS + **(DB_SETTINGS) ) message = "" diff --git a/pilot/model/vicuna_llm.py b/pilot/model/vicuna_llm.py index 2337a3bbf..63788a619 100644 --- a/pilot/model/vicuna_llm.py +++ b/pilot/model/vicuna_llm.py @@ -8,8 +8,9 @@ from langchain.embeddings.base import Embeddings from pydantic import BaseModel from typing import Any, Mapping, Optional, List from langchain.llms.base import LLM -from pilot.configs.model_config import * +from pilot.configs.config import Config +CFG = Config() class VicunaLLM(LLM): vicuna_generate_path = "generate_stream" @@ -22,7 +23,7 @@ class VicunaLLM(LLM): "stop": stop } response = requests.post( - url=urljoin(VICUNA_MODEL_SERVER, self.vicuna_generate_path), + url=urljoin(CFG.MODEL_SERVER, self.vicuna_generate_path), data=json.dumps(params), ) @@ -51,7 +52,7 @@ class VicunaEmbeddingLLM(BaseModel, Embeddings): print("Sending prompt ", p) response = requests.post( - url=urljoin(VICUNA_MODEL_SERVER, self.vicuna_embedding_path), + url=urljoin(CFG.MODEL_SERVER, self.vicuna_embedding_path), json={ "prompt": p } diff --git a/pilot/pturning/lora/finetune.py b/pilot/pturning/lora/finetune.py index 6cd9935ed..91ec07d0a 100644 --- a/pilot/pturning/lora/finetune.py +++ b/pilot/pturning/lora/finetune.py @@ -17,14 +17,17 @@ from peft import ( import torch from datasets import load_dataset import pandas as pd +from pilot.configs.config import Config -from pilot.configs.model_config import DATA_DIR, LLM_MODEL, LLM_MODEL_CONFIG +from pilot.configs.model_config import DATA_DIR, LLM_MODEL_CONFIG device = "cuda" if torch.cuda.is_available() else "cpu" CUTOFF_LEN = 50 df = pd.read_csv(os.path.join(DATA_DIR, "BTC_Tweets_Updated.csv")) +CFG = Config() + def sentiment_score_to_name(score: float): if score > 0: return "Positive" @@ -49,7 +52,7 @@ with open(os.path.join(DATA_DIR, "alpaca-bitcoin-sentiment-dataset.json"), "w") data = load_dataset("json", data_files=os.path.join(DATA_DIR, "alpaca-bitcoin-sentiment-dataset.json")) print(data["train"]) -BASE_MODEL = LLM_MODEL_CONFIG[LLM_MODEL] +BASE_MODEL = LLM_MODEL_CONFIG[CFG.LLM_MODEL] model = LlamaForCausalLM.from_pretrained( BASE_MODEL, torch_dtype=torch.float16, diff --git a/pilot/server/llmserver.py b/pilot/server/llmserver.py index 2860c3b77..2b29949a3 100644 --- a/pilot/server/llmserver.py +++ b/pilot/server/llmserver.py @@ -13,8 +13,11 @@ from pilot.model.inference import generate_output, get_embeddings from pilot.model.loader import ModelLoader from pilot.configs.model_config import * +from pilot.configs.config import Config -model_path = LLM_MODEL_CONFIG[LLM_MODEL] + +CFG = Config() +model_path = LLM_MODEL_CONFIG[CFG.LLM_MODEL] global_counter = 0 @@ -60,7 +63,7 @@ def generate_stream_gate(params): tokenizer, params, DEVICE, - MAX_POSITION_EMBEDDINGS, + CFG.MAX_POSITION_EMBEDDINGS, ): print("output: ", output) ret = { @@ -84,7 +87,7 @@ async def api_generate_stream(request: Request): print(model, tokenizer, params, DEVICE) if model_semaphore is None: - model_semaphore = asyncio.Semaphore(LIMIT_MODEL_CONCURRENCY) + model_semaphore = asyncio.Semaphore(CFG.LIMIT_MODEL_CONCURRENCY) await model_semaphore.acquire() generator = generate_stream_gate(params) diff --git a/pilot/server/webserver.py b/pilot/server/webserver.py index 139caab4d..caacfdf61 100644 --- a/pilot/server/webserver.py +++ b/pilot/server/webserver.py @@ -14,13 +14,13 @@ from urllib.parse import urljoin from langchain import PromptTemplate -from pilot.configs.model_config import DB_SETTINGS, KNOWLEDGE_UPLOAD_ROOT_PATH, LLM_MODEL_CONFIG +from pilot.configs.model_config import KNOWLEDGE_UPLOAD_ROOT_PATH, LLM_MODEL_CONFIG from pilot.server.vectordb_qa import KnownLedgeBaseQA from pilot.connections.mysql import MySQLOperator from pilot.source_embedding.knowledge_embedding import KnowledgeEmbedding from pilot.vector_store.extract_tovec import get_vector_storelist, load_knownledge_from_doc, knownledge_tovec_st -from pilot.configs.model_config import LOGDIR, VICUNA_MODEL_SERVER, LLM_MODEL, DATASETS_DIR +from pilot.configs.model_config import LOGDIR, DATASETS_DIR from pilot.plugins import scan_plugins from pilot.configs.config import Config @@ -67,7 +67,15 @@ priority = { "vicuna-13b": "aaa" } +# 加载插件 +CFG= Config() +DB_SETTINGS = { + "user": CFG.LOCAL_DB_USER, + "password": CFG.LOCAL_DB_PASSWORD, + "host": CFG.LOCAL_DB_HOST, + "port": CFG.LOCAL_DB_PORT +} def get_simlar(q): docsearch = knownledge_tovec_st(os.path.join(DATASETS_DIR, "plan.md")) docs = docsearch.similarity_search_with_score(q, k=1) @@ -178,7 +186,7 @@ def http_bot(state, mode, sql_mode, db_selector, temperature, max_new_tokens, re print("是否是AUTO-GPT模式.", autogpt) start_tstamp = time.time() - model_name = LLM_MODEL + model_name = CFG.LLM_MODEL dbname = db_selector # TODO 这里的请求需要拼接现有知识库, 使得其根据现有知识库作答, 所以prompt需要继续优化 @@ -268,7 +276,7 @@ def http_bot(state, mode, sql_mode, db_selector, temperature, max_new_tokens, re logger.info(f"Requert: \n{payload}") if sql_mode == conversation_sql_mode["auto_execute_ai_response"]: - response = requests.post(urljoin(VICUNA_MODEL_SERVER, "generate"), + response = requests.post(urljoin(CFG.MODEL_SERVER, "generate"), headers=headers, json=payload, timeout=120) print(response.json()) @@ -316,7 +324,7 @@ def http_bot(state, mode, sql_mode, db_selector, temperature, max_new_tokens, re try: # Stream output - response = requests.post(urljoin(VICUNA_MODEL_SERVER, "generate_stream"), + response = requests.post(urljoin(CFG.MODEL_SERVER, "generate_stream"), headers=headers, json=payload, stream=True, timeout=20) for chunk in response.iter_lines(decode_unicode=False, delimiter=b"\0"): if chunk: @@ -595,9 +603,8 @@ if __name__ == "__main__": # dbs = get_database_list() - # 加载插件 + # 配置初始化 cfg = Config() - cfg.set_plugins(scan_plugins(cfg, cfg.debug_mode)) # 加载插件可执行命令 diff --git a/requirements.txt b/requirements.txt index 5654dba6f..5bbc34f4c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -57,6 +57,9 @@ pymdown-extensions mkdocs requests gTTS==2.3.1 +langchain +nltk +python-dotenv==1.0.0 # Testing dependencies pytest From f7edd6dc93a70174b982eda01e34ba7ba2563a64 Mon Sep 17 00:00:00 2001 From: yhjun1026 <460342015@qq.com> Date: Thu, 18 May 2023 16:47:06 +0800 Subject: [PATCH 06/22] Unified configuration --- .env.template | 11 +++++++++-- pilot/server/webserver.py | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.env.template b/.env.template index 3d2240bff..d809a362b 100644 --- a/.env.template +++ b/.env.template @@ -41,8 +41,8 @@ MAX_POSITION_EMBEDDINGS=4096 #** DATABASE SETTINGS **# #*******************************************************************# LOCAL_DB_USER=root -LOCAL_DB_PASSWORD=password -LOCAL_DB_HOST=localhost +LOCAL_DB_PASSWORD=aa12345678 +LOCAL_DB_HOST=127.0.0.1 LOCAL_DB_PORT=3306 @@ -59,6 +59,13 @@ LOCAL_DB_PORT=3306 # MILVUS_SECURE= # MILVUS_COLLECTION=dbgpt +#*******************************************************************# +#** COMMANDS **# +#*******************************************************************# +EXECUTE_LOCAL_COMMANDS=False + + + #*******************************************************************# #** ALLOWLISTED PLUGINS **# #*******************************************************************# diff --git a/pilot/server/webserver.py b/pilot/server/webserver.py index caacfdf61..0f19bc354 100644 --- a/pilot/server/webserver.py +++ b/pilot/server/webserver.py @@ -600,11 +600,11 @@ if __name__ == "__main__": args = parser.parse_args() logger.info(f"args: {args}") - - # dbs = get_database_list() - # 配置初始化 cfg = Config() + + dbs = get_database_list() + cfg.set_plugins(scan_plugins(cfg, cfg.debug_mode)) # 加载插件可执行命令 From a3a7cefc6801140e66a0385f93a245c515d9e721 Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 18 May 2023 16:49:30 +0800 Subject: [PATCH 07/22] docs: update --- README.md | 2 +- README.zh.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e4ae5c1c5..cffb479ed 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ --- -[中文版](README.zh.md) +[简体中文](README.zh.md) [![Star History Chart](https://api.star-history.com/svg?repos=csunny/DB-GPT)](https://star-history.com/#csunny/DB-GPT) diff --git a/README.zh.md b/README.zh.md index 77d26facf..b7ff30a2e 100644 --- a/README.zh.md +++ b/README.zh.md @@ -1,6 +1,6 @@ # DB-GPT ![GitHub Repo stars](https://img.shields.io/github/stars/csunny/db-gpt?style=social) -[English Edition](README.zh.md) +[English](README.zh.md) [![Star History Chart](https://api.star-history.com/svg?repos=csunny/DB-GPT)](https://star-history.com/#csunny/DB-GPT) From dc55230c37293ebc5b62c2208a409f2ff93a05e9 Mon Sep 17 00:00:00 2001 From: yhjun1026 <460342015@qq.com> Date: Thu, 18 May 2023 16:50:15 +0800 Subject: [PATCH 08/22] Unified configuration --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e4ae5c1c5..124e633d2 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,7 @@ Run gradio webui ```bash $ python pilot/server/webserver.py ``` -Notice: the webserver need to connect llmserver, so you need change the pilot/configs/model_config.py file. change the VICUNA_MODEL_SERVER = "http://127.0.0.1:8000" to your address. It's very important. +Notice: the webserver need to connect llmserver, so you need change the .env file. change the MODEL_SERVER = "http://127.0.0.1:8000" to your address. It's very important. ## Usage Instructions We provide a user interface for Gradio, which allows you to use DB-GPT through our user interface. Additionally, we have prepared several reference articles (written in Chinese) that introduce the code and principles related to our project. From 0836b5eea6372390ccda0ffd9d16cc35bdd47a4d Mon Sep 17 00:00:00 2001 From: yhjun1026 <460342015@qq.com> Date: Thu, 18 May 2023 16:52:08 +0800 Subject: [PATCH 09/22] Unified configuration --- README.zh.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.zh.md b/README.zh.md index b7ff30a2e..976db50e0 100644 --- a/README.zh.md +++ b/README.zh.md @@ -178,7 +178,7 @@ python llmserver.py ```bash $ python webserver.py ``` -注意: 在启动Webserver之前, 需要修改pilot/configs/model_config.py 文件中的VICUNA_MODEL_SERVER = "http://127.0.0.1:8000", 将地址设置为你的服务器地址。 +注意: 在启动Webserver之前, 需要修改.env 文件中的MODEL_SERVER = "http://127.0.0.1:8000", 将地址设置为你的服务器地址。 ## 使用说明 From b5139ea6433d7c30fde9a541bc5c5820861607dc Mon Sep 17 00:00:00 2001 From: yhjun1026 <460342015@qq.com> Date: Thu, 18 May 2023 16:56:02 +0800 Subject: [PATCH 10/22] EN Note --- pilot/prompts/auto_mode_prompt.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pilot/prompts/auto_mode_prompt.py b/pilot/prompts/auto_mode_prompt.py index ec5918582..86f707783 100644 --- a/pilot/prompts/auto_mode_prompt.py +++ b/pilot/prompts/auto_mode_prompt.py @@ -42,7 +42,7 @@ class AutoModePrompt: prompt_generator: Optional[PromptGenerator] = None )-> str: """ - 基于用户输入的后续对话信息构建完整的prompt信息 + Build complete prompt information based on subsequent dialogue information entered by the user Args: self: prompt_generator: @@ -69,7 +69,7 @@ class AutoModePrompt: if not self.ai_goals : self.ai_goals = user_input for i, goal in enumerate(self.ai_goals): - full_prompt += f"{i+1}.根据提供的Schema信息, {goal}\n" + full_prompt += f"{i+1}.According to the provided Schema information, {goal}\n" # if last_auto_return == None: # full_prompt += f"{cfg.last_plugin_return}\n\n" # else: @@ -88,7 +88,7 @@ class AutoModePrompt: prompt_generator: Optional[PromptGenerator] = None ) -> str: """ - 基于用户输入的初始对话信息构建完整的prompt信息 + Build complete prompt information based on the initial dialogue information entered by the user Args: self: prompt_generator: @@ -128,7 +128,7 @@ class AutoModePrompt: if not self.ai_goals : self.ai_goals = fisrt_message for i, goal in enumerate(self.ai_goals): - full_prompt += f"{i+1}.根据提供的Schema信息,{goal}\n" + full_prompt += f"{i+1}.According to the provided Schema information,{goal}\n" if db_schemes: full_prompt += f"\nSchema:\n\n" full_prompt += f"{db_schemes}" From 9ddd0893813f2c3ae2320c8bf41fe663b6c9063f Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 18 May 2023 17:28:06 +0800 Subject: [PATCH 11/22] fix run path --- pilot/__init__.py | 7 ++++++- pilot/model/adapter.py | 2 +- pilot/server/llmserver.py | 15 ++++++++++----- pilot/server/webserver.py | 7 +++++++ 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/pilot/__init__.py b/pilot/__init__.py index a1531040e..b6865c44c 100644 --- a/pilot/__init__.py +++ b/pilot/__init__.py @@ -1,7 +1,12 @@ from pilot.source_embedding import (SourceEmbedding, register) +import os +import sys + +ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +sys.path.append(ROOT_PATH) __all__ = [ "SourceEmbedding", "register" -] \ No newline at end of file +] diff --git a/pilot/model/adapter.py b/pilot/model/adapter.py index fa5803d3a..9afd2c01f 100644 --- a/pilot/model/adapter.py +++ b/pilot/model/adapter.py @@ -24,7 +24,7 @@ class BaseLLMAdaper: return model, tokenizer -llm_model_adapters = List[BaseLLMAdaper] = [] +llm_model_adapters: List[BaseLLMAdaper] = [] # Register llm models to adapters, by this we can use multi models. def register_llm_model_adapters(cls): diff --git a/pilot/server/llmserver.py b/pilot/server/llmserver.py index 2b29949a3..e341cc457 100644 --- a/pilot/server/llmserver.py +++ b/pilot/server/llmserver.py @@ -1,14 +1,23 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +import os import uvicorn import asyncio import json +import sys from typing import Optional, List from fastapi import FastAPI, Request, BackgroundTasks from fastapi.responses import StreamingResponse -from pilot.model.inference import generate_stream from pydantic import BaseModel + +global_counter = 0 +model_semaphore = None + +ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +sys.path.append(ROOT_PATH) + +from pilot.model.inference import generate_stream from pilot.model.inference import generate_output, get_embeddings from pilot.model.loader import ModelLoader @@ -19,10 +28,6 @@ from pilot.configs.config import Config CFG = Config() model_path = LLM_MODEL_CONFIG[CFG.LLM_MODEL] - -global_counter = 0 -model_semaphore = None - ml = ModelLoader(model_path=model_path) model, tokenizer = ml.loader(num_gpus=1, load_8bit=ISLOAD_8BIT, debug=ISDEBUG) #model, tokenizer = load_model(model_path=model_path, device=DEVICE, num_gpus=1, load_8bit=True, debug=False) diff --git a/pilot/server/webserver.py b/pilot/server/webserver.py index 0f19bc354..3ed989b07 100644 --- a/pilot/server/webserver.py +++ b/pilot/server/webserver.py @@ -13,6 +13,11 @@ import requests from urllib.parse import urljoin from langchain import PromptTemplate +import os +import sys + +ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +sys.path.append(ROOT_PATH) from pilot.configs.model_config import KNOWLEDGE_UPLOAD_ROOT_PATH, LLM_MODEL_CONFIG from pilot.server.vectordb_qa import KnownLedgeBaseQA @@ -30,6 +35,8 @@ from pilot.prompts.generator import PromptGenerator from pilot.commands.exception_not_commands import NotCommands + + from pilot.conversation import ( default_conversation, conv_templates, From 0d370a1a64d868ab34f98599f55de29c04c89464 Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 18 May 2023 17:32:53 +0800 Subject: [PATCH 12/22] cfg: update --- pilot/__init__.py | 6 ------ pilot/configs/model_config.py | 7 ------- pilot/server/webserver.py | 4 ++-- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/pilot/__init__.py b/pilot/__init__.py index b6865c44c..b1d1cd3d2 100644 --- a/pilot/__init__.py +++ b/pilot/__init__.py @@ -1,11 +1,5 @@ from pilot.source_embedding import (SourceEmbedding, register) -import os -import sys - -ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -sys.path.append(ROOT_PATH) - __all__ = [ "SourceEmbedding", "register" diff --git a/pilot/configs/model_config.py b/pilot/configs/model_config.py index af6c138b5..ad81a6e79 100644 --- a/pilot/configs/model_config.py +++ b/pilot/configs/model_config.py @@ -28,12 +28,5 @@ ISDEBUG = False VECTOR_SEARCH_TOP_K = 3 -# LLM_MODEL = "vicuna-13b" -# LIMIT_MODEL_CONCURRENCY = 5 -# MAX_POSITION_EMBEDDINGS = 4096 -# VICUNA_MODEL_SERVER = "http://121.41.167.183:8000" - - - VS_ROOT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "vs_store") KNOWLEDGE_UPLOAD_ROOT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "knowledge") \ No newline at end of file diff --git a/pilot/server/webserver.py b/pilot/server/webserver.py index 3ed989b07..233655381 100644 --- a/pilot/server/webserver.py +++ b/pilot/server/webserver.py @@ -6,6 +6,7 @@ import os import shutil import uuid import json +import sys import time import gradio as gr import datetime @@ -13,8 +14,7 @@ import requests from urllib.parse import urljoin from langchain import PromptTemplate -import os -import sys + ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(ROOT_PATH) From eb24aef9f118d0b3010635dd3fc8a88da4bbf193 Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 18 May 2023 17:36:59 +0800 Subject: [PATCH 13/22] fix: python path --- README.md | 5 +---- README.zh.md | 4 ---- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/README.md b/README.md index 311fb1f54..c74a120ec 100644 --- a/README.md +++ b/README.md @@ -158,10 +158,7 @@ Alternatively, you can use the following command: cd DB-GPT conda env create -f environment.yml ``` -It is recommended to set the Python package path to avoid runtime errors due to package not found. -``` -echo "/root/workspace/DB-GPT" > /root/miniconda3/env/dbgpt_env/lib/python3.10/site-packages/dbgpt.pth -``` + Notice: You need replace the path to your owner. ### 3. Run diff --git a/README.zh.md b/README.zh.md index 976db50e0..c786cfe35 100644 --- a/README.zh.md +++ b/README.zh.md @@ -157,10 +157,6 @@ pip install -r requirements.txt cd DB-GPT conda env create -f environment.yml ``` -另外需要设置一下python包路径, 避免出现运行时找不到包 -``` -echo "/root/workspace/DB-GPT" > /root/miniconda3/env/dbgpt_env/lib/python3.10/site-packages/dbgpt.pth -``` ### 3. 运行大模型 From 51dd31aa0eda7208de14872b246e7cab65b3b33c Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 18 May 2023 17:45:36 +0800 Subject: [PATCH 14/22] docs: readme update --- README.md | 7 ----- README.zh.md | 5 ---- environment.yml | 68 ------------------------------------------------- 3 files changed, 80 deletions(-) delete mode 100644 environment.yml diff --git a/README.md b/README.md index c74a120ec..54a8d0de7 100644 --- a/README.md +++ b/README.md @@ -153,13 +153,6 @@ conda create -n dbgpt_env python=3.10 conda activate dbgpt_env pip install -r requirements.txt ``` -Alternatively, you can use the following command: -``` -cd DB-GPT -conda env create -f environment.yml -``` - -Notice: You need replace the path to your owner. ### 3. Run You can refer to this document to obtain the Vicuna weights: [Vicuna](https://github.com/lm-sys/FastChat/blob/main/README.md#model-weights) . diff --git a/README.zh.md b/README.zh.md index c786cfe35..7063dddb3 100644 --- a/README.zh.md +++ b/README.zh.md @@ -151,11 +151,6 @@ conda create -n dbgpt_env python=3.10 conda activate dbgpt_env pip install -r requirements.txt -``` -或者也可以使用命令: -``` -cd DB-GPT -conda env create -f environment.yml ``` ### 3. 运行大模型 diff --git a/environment.yml b/environment.yml deleted file mode 100644 index 99959ec5f..000000000 --- a/environment.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: db_pgt -channels: - - pytorch - - defaults - - anaconda -dependencies: - - python=3.10 - - cudatoolkit - - pip - - pytorch-mutex=1.0=cuda - - pip: - - pytorch - - accelerate==0.16.0 - - aiohttp==3.8.4 - - aiosignal==1.3.1 - - async-timeout==4.0.2 - - attrs==22.2.0 - - bitsandbytes==0.37.0 - - cchardet==2.1.7 - - chardet==5.1.0 - - contourpy==1.0.7 - - cycler==0.11.0 - - filelock==3.9.0 - - fonttools==4.38.0 - - frozenlist==1.3.3 - - huggingface-hub==0.13.4 - - importlib-resources==5.12.0 - - kiwisolver==1.4.4 - - matplotlib==3.7.0 - - multidict==6.0.4 - - packaging==23.0 - - psutil==5.9.4 - - pycocotools==2.0.6 - - pyparsing==3.0.9 - - python-dateutil==2.8.2 - - pyyaml==6.0 - - regex==2022.10.31 - - tokenizers==0.13.2 - - tqdm==4.64.1 - - transformers==4.28.0 - - timm==0.6.13 - - spacy==3.5.1 - - webdataset==0.2.48 - - scikit-learn==1.2.2 - - scipy==1.10.1 - - yarl==1.8.2 - - zipp==3.14.0 - - omegaconf==2.3.0 - - opencv-python==4.7.0.72 - - iopath==0.1.10 - - tenacity==8.2.2 - - peft - - pycocoevalcap - - sentence-transformers - - umap-learn - - notebook - - gradio==3.23 - - gradio-client==0.0.8 - - wandb - - llama-index==0.5.27 - - pymysql - - unstructured==0.6.3 - - pytesseract==0.3.10 - - markdown2 - - chromadb - - colorama - - playsound - - distro \ No newline at end of file From 3625d76c619f20e6b11d9b61ab608f1a42a5f606 Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 18 May 2023 20:27:10 +0800 Subject: [PATCH 15/22] fix: config --- pilot/server/webserver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pilot/server/webserver.py b/pilot/server/webserver.py index bdfa60f34..c0ebd968a 100644 --- a/pilot/server/webserver.py +++ b/pilot/server/webserver.py @@ -19,7 +19,7 @@ from langchain import PromptTemplate ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(ROOT_PATH) -from pilot.configs.model_config import DB_SETTINGS, KNOWLEDGE_UPLOAD_ROOT_PATH, LLM_MODEL_CONFIG, VECTOR_SEARCH_TOP_K +from pilot.configs.model_config import KNOWLEDGE_UPLOAD_ROOT_PATH, LLM_MODEL_CONFIG, VECTOR_SEARCH_TOP_K from pilot.server.vectordb_qa import KnownLedgeBaseQA from pilot.connections.mysql import MySQLOperator from pilot.source_embedding.knowledge_embedding import KnowledgeEmbedding From caf4705f3baaa964b9c406d49dcdd057b695730d Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 18 May 2023 20:29:30 +0800 Subject: [PATCH 16/22] fix: update --- pilot/vector_store/file_loader.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pilot/vector_store/file_loader.py b/pilot/vector_store/file_loader.py index b94b45ba2..279d5343c 100644 --- a/pilot/vector_store/file_loader.py +++ b/pilot/vector_store/file_loader.py @@ -48,11 +48,7 @@ class KnownLedge2Vector: # vector_store.add_documents(documents=documents) else: documents = self.load_knownlege() -<<<<<<< HEAD # reinit -======= - # reinit ->>>>>>> 31797ecdb53eff76cceb52454888c91c97572851 vector_store = Chroma.from_documents(documents=documents, embedding=self.embeddings, persist_directory=persist_dir) @@ -65,11 +61,7 @@ class KnownLedge2Vector: for file in files: filename = os.path.join(root, file) docs = self._load_file(filename) -<<<<<<< HEAD - # update metadata. -======= # update metadata. ->>>>>>> 31797ecdb53eff76cceb52454888c91c97572851 new_docs = [] for doc in docs: doc.metadata = {"source": doc.metadata["source"].replace(DATASETS_DIR, "")} From 09a26cb1497c018a99d426ac9a02a65f03cd48d3 Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 18 May 2023 21:19:28 +0800 Subject: [PATCH 17/22] Repo: requirements --- requirements.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/requirements.txt b/requirements.txt index eac927c3d..410d3129c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -60,6 +60,13 @@ gTTS==2.3.1 langchain nltk python-dotenv==1.0.0 +vcrpy +chromadb +markdown2 +colorama +playsound +distro +pypdf # Testing dependencies pytest @@ -69,11 +76,4 @@ pytest-benchmark pytest-cov pytest-integration pytest-mock -vcrpy -pytest-recording -chromadb -markdown2 -colorama -playsound -distro -pypdf \ No newline at end of file +pytest-recording \ No newline at end of file From ae0a046b9857e3b309592e4723bf3487755c429d Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 18 May 2023 21:29:03 +0800 Subject: [PATCH 18/22] update --- pilot/server/webserver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pilot/server/webserver.py b/pilot/server/webserver.py index c0ebd968a..2c1ccace0 100644 --- a/pilot/server/webserver.py +++ b/pilot/server/webserver.py @@ -428,7 +428,7 @@ def build_single_model_ui(): notice_markdown = """ # DB-GPT - [DB-GPT](https://github.com/csunny/DB-GPT) 是一个实验性的开源应用程序,它基于[FastChat](https://github.com/lm-sys/FastChat),并使用vicuna-13b作为基础模型。此外,此程序结合了langchain和llama-index基于现有知识库进行In-Context Learning来对其进行数据库相关知识的增强。它可以进行SQL生成、SQL诊断、数据库知识问答等一系列的工作。 总的来说,它是一个用于数据库的复杂且创新的AI工具。如果您对如何在工作中使用或实施DB-GPT有任何具体问题,请联系我, 我会尽力提供帮助, 同时也欢迎大家参与到项目建设中, 做一些有趣的事情。 + [DB-GPT](https://github.com/csunny/DB-GPT) DB-GPT is an experimental open-source project that uses localized GPT large models to interact with your data and environment. With this solution, you can be assured that there is no risk of data leakage, and your data is 100% private and secure. """ learn_more_markdown = """ ### Licence From 7c68a4f44e4507b17546362a5fcb9c7316bff171 Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 18 May 2023 21:32:51 +0800 Subject: [PATCH 19/22] docs: update --- pilot/server/webserver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pilot/server/webserver.py b/pilot/server/webserver.py index 2c1ccace0..377fb1b91 100644 --- a/pilot/server/webserver.py +++ b/pilot/server/webserver.py @@ -428,7 +428,7 @@ def build_single_model_ui(): notice_markdown = """ # DB-GPT - [DB-GPT](https://github.com/csunny/DB-GPT) DB-GPT is an experimental open-source project that uses localized GPT large models to interact with your data and environment. With this solution, you can be assured that there is no risk of data leakage, and your data is 100% private and secure. + [DB-GPT](https://github.com/csunny/DB-GPT) 是一个开源的以数据库为基础的GPT实验项目,使用本地化的GPT大模型与您的数据和环境进行交互,无数据泄露风险,100% 私密,100% 安全。 """ learn_more_markdown = """ ### Licence From 9a1e54ebd4137c2857adf1818d37b5f9bae6fecd Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 18 May 2023 23:31:15 +0800 Subject: [PATCH 20/22] top_k update --- pilot/configs/model_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pilot/configs/model_config.py b/pilot/configs/model_config.py index 2a4f5eac4..5ab2e4fbe 100644 --- a/pilot/configs/model_config.py +++ b/pilot/configs/model_config.py @@ -29,6 +29,6 @@ ISLOAD_8BIT = True ISDEBUG = False -VECTOR_SEARCH_TOP_K = 3 +VECTOR_SEARCH_TOP_K = 10 VS_ROOT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "vs_store") KNOWLEDGE_UPLOAD_ROOT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data") \ No newline at end of file From 09b7f99abae333f2b3d1e49f4aa35d7a24803052 Mon Sep 17 00:00:00 2001 From: xudafeng Date: Fri, 19 May 2023 00:25:09 +0800 Subject: [PATCH 21/22] docs: update readme --- README.md | 2 +- README.zh.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 54a8d0de7..57ca42fbf 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,7 @@ The achievements of this project are thanks to the technical community, especial | :---: | :---: | :---: | :---: |:---: | -This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sun May 14 2023 23:02:43 GMT+0800`. +This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Fri May 19 2023 00:24:18 GMT+0800`. diff --git a/README.zh.md b/README.zh.md index 7063dddb3..ed7e3f03c 100644 --- a/README.zh.md +++ b/README.zh.md @@ -194,13 +194,13 @@ $ python webserver.py -## Contributors +## 贡献者 |[
csunny](https://github.com/csunny)
|[
xudafeng](https://github.com/xudafeng)
|[
明天](https://github.com/yhjun1026)
| [
Aries-ckt](https://github.com/Aries-ckt)
|[
thebigbone](https://github.com/thebigbone)
| | :---: | :---: | :---: | :---: |:---: | -This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sun May 14 2023 23:02:43 GMT+0800`. +[git-contributor 说明](https://github.com/xudafeng/git-contributor),自动生成时间:`Fri May 19 2023 00:24:18 GMT+0800`。 From 78158c6886a8290a40c84f9e3437c0897cff3bd9 Mon Sep 17 00:00:00 2001 From: "magic.chen" Date: Fri, 19 May 2023 09:23:00 +0800 Subject: [PATCH 22/22] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 38 +++++++++++++++++++ .../ISSUE_TEMPLATE/documentation-related.md | 10 +++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++ 3 files changed, 68 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/documentation-related.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..a2998b85e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[BUG]: " +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/documentation-related.md b/.github/ISSUE_TEMPLATE/documentation-related.md new file mode 100644 index 000000000..5506434f7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation-related.md @@ -0,0 +1,10 @@ +--- +name: Documentation Related +about: Describe this issue template's purpose here. +title: "[Doc]: " +labels: '' +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..0ccd363af --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "[Feature]:" +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here.