mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-30 07:11:56 +00:00
docs: readme file update
This commit is contained in:
parent
9fc54c6c5e
commit
b834bed65b
101
README.md
101
README.md
@ -91,111 +91,23 @@ The core capabilities mainly consist of the following parts:
|
||||
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=aa123456 -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
|
||||
```
|
||||
|
||||
### 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 .env file. change the MODEL_SERVER = "http://127.0.0.1:8000" to your address. It's very important.
|
||||
## Install
|
||||
[Quickstart](https://db-gpt.readthedocs.io/en/latest/getting_started/getting_started.html)
|
||||
|
||||
## 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)
|
||||
|
||||
### Multi LLMs Usage
|
||||
|
||||
To use multiple models, modify the LLM_MODEL parameter in the .env configuration file to switch between the models.
|
||||
|
||||
### Multi Language Usage
|
||||
To use multiple language model, modify the LLM_MODEL parameter in the .env configuration file to switch between the models.
|
||||
|
||||
In the .env configuration file, modify the LANGUAGE parameter to switch between different languages, the default is English (Chinese zh, English en, other languages to be added)
|
||||
|
||||
### Create your own knowledge repository:
|
||||
|
||||
1.Place personal knowledge files or folders in the pilot/datasets directory.
|
||||
- [Multi LLMs Usage](https://db-gpt.readthedocs.io/en/latest/modules/llms.html)
|
||||
- [Create your own knowledge repository](https://db-gpt.readthedocs.io/en/latest/modules/knowledge.html)
|
||||
|
||||
We currently support many document formats: txt, pdf, md, html, doc, ppt, and url.
|
||||
|
||||
before execution:
|
||||
|
||||
```
|
||||
python -m spacy download zh_core_web_sm
|
||||
|
||||
```
|
||||
|
||||
2.set .env configuration set your vector store type, eg:VECTOR_STORE_TYPE=Chroma, now we support Chroma and Milvus(version > 2.1)
|
||||
|
||||
3.Run the knowledge repository script in the tools directory.
|
||||
@ -205,13 +117,8 @@ python -m spacy download zh_core_web_sm
|
||||
|
||||
--vector_name : your vector store name default_value:default
|
||||
--append: append mode, True:append, False: not append default_value:False
|
||||
|
||||
```
|
||||
|
||||
4.Add the knowledge repository in the interface by entering the name of your knowledge repository (if not specified, enter "default") so you can use it for Q&A based on your knowledge base.
|
||||
|
||||
Note that the default vector model used is text2vec-large-chinese (which is a large model, so if your personal computer configuration is not enough, it is recommended to use text2vec-base-chinese). Therefore, ensure that you download the model and place it in the models directory.
|
||||
|
||||
If nltk-related errors occur during the use of the knowledge base, you need to install the nltk toolkit. For more details, please refer to: [nltk documents](https://www.nltk.org/data.html)
|
||||
Run the Python interpreter and type the commands:
|
||||
|
||||
|
102
README.zh.md
102
README.zh.md
@ -93,93 +93,19 @@ DB-GPT基于 [FastChat](https://github.com/lm-sys/FastChat) 构建大模型运
|
||||
6. Prompt自动生成与优化:自动化生成高质量的Prompt,并进行优化,提高系统的响应效率。
|
||||
7. 多端产品界面:支持多种不同的客户端产品,例如Web、移动应用和桌面应用等。
|
||||
|
||||
下面对每个模块也做一些简要的介绍:
|
||||
## 安装
|
||||
[快速开始](https://db-gpt.readthedocs.io/projects/db-gpt-docs-zh-cn/zh_CN/latest/getting_started/getting_started.html)
|
||||
|
||||
### 知识库能力
|
||||
知识库作为当前用户需求最大的场景,我们原生支持知识库的构建与处理。同时在本项目当中,也提供了多种知识库的管理策略。 如:
|
||||
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=aa123456 -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
|
||||
|
||||
```
|
||||
|
||||
### 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之前, 需要修改.env 文件中的MODEL_SERVER = "http://127.0.0.1:8000", 将地址设置为你的服务器地址。
|
||||
### 多语言切换
|
||||
在.env 配置文件当中,修改LANGUAGE参数来切换使用不同的语言,默认是英文(中文zh, 英文en, 其他语言待补充)
|
||||
|
||||
## 使用说明
|
||||
|
||||
我们提供了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)
|
||||
|
||||
|
||||
### 多模型使用
|
||||
在.env 配置文件当中, 修改LLM_MODEL参数来切换使用的模型。
|
||||
[使用指南](https://db-gpt.readthedocs.io/projects/db-gpt-docs-zh-cn/zh_CN/latest/modules/llms.html)
|
||||
|
||||
### 多语言用户界面模式
|
||||
在.env 配置文件当中,修改LANGUAGE参数来切换使用不同的语言,默认是英文(中文zh, 英文en, 其他语言待补充)
|
||||
|
||||
### 打造属于你的知识库:
|
||||
### 打造属于你的知识库
|
||||
- [参考手册](https://db-gpt.readthedocs.io/projects/db-gpt-docs-zh-cn/zh_CN/latest/modules/knowledge.html)
|
||||
|
||||
1.将个人知识文件或者文件夹放入pilot/datasets目录中
|
||||
|
||||
@ -194,15 +120,12 @@ python -m spacy download zh_core_web_sm
|
||||
|
||||
2.在.env文件指定你的向量数据库类型,VECTOR_STORE_TYPE(默认Chroma),目前支持Chroma,Milvus(需要设置MILVUS_URL和MILVUS_PORT)
|
||||
|
||||
注意Milvus版本需要>2.1
|
||||
**注意Milvus版本需要>2.1**
|
||||
|
||||
3.在tools目录执行知识入库脚本()
|
||||
|
||||
如果是选择默认知识库,不需要指定 --vector_name, 默认default
|
||||
3.在tools目录执行知识入库脚本, 如果是选择默认知识库,不需要指定 --vector_name, 默认default
|
||||
|
||||
```
|
||||
python tools/knowledge_init.py
|
||||
|
||||
```
|
||||
|
||||
如果选择新增知识库,在界面上新增知识库输入你的知识库名,
|
||||
@ -211,7 +134,6 @@ python tools/knowledge_init.py
|
||||
python tools/knowledge_init.py --vector_name = yourname
|
||||
|
||||
--vector_name: vector_name default_value:default
|
||||
|
||||
```
|
||||
就可以根据你的知识库进行问答
|
||||
|
||||
@ -224,6 +146,12 @@ Run the Python interpreter and type the commands:
|
||||
>>> nltk.download()
|
||||
```
|
||||
|
||||
我们提供了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)
|
||||
|
||||
|
||||
## 感谢
|
||||
|
||||
项目取得的成果,需要感谢技术社区,尤其以下项目。
|
||||
|
Loading…
Reference in New Issue
Block a user