Commit 396700dd authored by chenzk's avatar chenzk
Browse files

v1.0

parents
Pipeline #2603 failed with stages
in 0 seconds
# Source Code Deployment
## Environmental requirements
| Startup Mode | CPU * MEM | GPU | Remark |
|:--------------------:|:------------:|:--------------:|:---------------:|
| Proxy model | 4C * 8G | None | Proxy model does not rely on GPU |
| Local model | 8C * 32G | 24G | It is best to start locally with a GPU of 24G or above |
## Environment Preparation
### Download Source Code
:::tip
Download DB-GPT
:::
```bash
git clone https://github.com/eosphoros-ai/DB-GPT.git
```
:::info note
There are some ways to install uv:
:::
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<Tabs
defaultValue="uv_sh"
values={[
{label: 'Command (macOS And Linux)', value: 'uv_sh'},
{label: 'PyPI', value: 'uv_pypi'},
{label: 'Other', value: 'uv_other'},
]}>
<TabItem value="uv_sh" label="Command">
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```
</TabItem>
<TabItem value="uv_pypi" label="Pypi">
Install uv using pipx.
```bash
python -m pip install --upgrade pip
python -m pip install --upgrade pipx
python -m pipx ensurepath
pipx install uv --global
```
</TabItem>
<TabItem value="uv_other" label="Other">
You can see more installation methods on the [uv installation](https://docs.astral.sh/uv/getting-started/installation/)
</TabItem>
</Tabs>
Then, you can run `uv --version` to check if uv is installed successfully.
```bash
uv --version
```
## Deploy DB-GPT
### Install Dependencies
<Tabs
defaultValue="openai"
values={[
{label: 'OpenAI (proxy)', value: 'openai'},
{label: 'DeepSeek (proxy)', value: 'deepseek'},
{label: 'GLM4 (local)', value: 'glm-4'},
]}>
<TabItem value="openai" label="OpenAI(proxy)">
```bash
# Use uv to install dependencies needed for OpenAI proxy
uv sync --all-packages \
--extra "base" \
--extra "proxy_openai" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "dbgpts"
```
### Run Webserver
To run DB-GPT with OpenAI proxy, you must provide the OpenAI API key in the `configs/dbgpt-proxy-openai.toml` configuration file or privide it in the environment variable with key `OPENAI_API_KEY`.
```toml
# Model Configurations
[models]
[[models.llms]]
...
api_key = "your-openai-api-key"
[[models.embeddings]]
...
api_key = "your-openai-api-key"
```
Then run the following command to start the webserver:
```bash
uv run dbgpt start webserver --config configs/dbgpt-proxy-openai.toml
```
In the above command, `--config` specifies the configuration file, and `configs/dbgpt-proxy-openai.toml` is the configuration file for the OpenAI proxy model, you can also use other configuration files or create your own configuration file according to your needs.
Optionally, you can also use the following command to start the webserver:
```bash
uv run python packages/dbgpt-app/src/dbgpt_app/dbgpt_server.py --config configs/dbgpt-proxy-openai.toml
```
</TabItem>
<TabItem value="deepseek" label="DeepSeek(proxy)">
```bash
# Use uv to install dependencies needed for OpenAI proxy
uv sync --all-packages \
--extra "base" \
--extra "proxy_openai" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "dbgpts"
```
### Run Webserver
To run DB-GPT with DeepSeek proxy, you must provide the DeepSeek API key in the `configs/dbgpt-proxy-deepseek.toml`.
And you can specify your embedding model in the `configs/dbgpt-proxy-deepseek.toml` configuration file, the default embedding model is `BAAI/bge-large-zh-v1.5`. If you want to use other embedding models, you can modify the `configs/dbgpt-proxy-deepseek.toml` configuration file and specify the `name` and `provider` of the embedding model in the `[[models.embeddings]]` section. The provider can be `hf`.
```toml
# Model Configurations
[models]
[[models.llms]]
# name = "deepseek-chat"
name = "deepseek-reasoner"
provider = "proxy/deepseek"
api_key = "your-deepseek-api-key"
[[models.embeddings]]
name = "BAAI/bge-large-zh-v1.5"
provider = "hf"
# If not provided, the model will be downloaded from the Hugging Face model hub
# uncomment the following line to specify the model path in the local file system
# path = "the-model-path-in-the-local-file-system"
path = "/data/models/bge-large-zh-v1.5"
```
Then run the following command to start the webserver:
```bash
uv run dbgpt start webserver --config configs/dbgpt-proxy-deepseek.toml
```
In the above command, `--config` specifies the configuration file, and `configs/dbgpt-proxy-deepseek.toml` is the configuration file for the DeepSeek proxy model, you can also use other configuration files or create your own configuration file according to your needs.
Optionally, you can also use the following command to start the webserver:
```bash
uv run python packages/dbgpt-app/src/dbgpt_app/dbgpt_server.py --config configs/dbgpt-proxy-deepseek.toml
```
</TabItem>
<TabItem value="glm-4" label="GLM4(local)">
```bash
# Use uv to install dependencies needed for GLM4
# Install core dependencies and select desired extensions
uv sync --all-packages \
--extra "base" \
--extra "cuda121" \
--extra "hf" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "quant_bnb" \
--extra "dbgpts"
```
### Run Webserver
To run DB-GPT with the local model. You can modify the `configs/dbgpt-local-glm.toml` configuration file to specify the model path and other parameters.
```toml
# Model Configurations
[models]
[[models.llms]]
name = "THUDM/glm-4-9b-chat-hf"
provider = "hf"
# If not provided, the model will be downloaded from the Hugging Face model hub
# uncomment the following line to specify the model path in the local file system
# path = "the-model-path-in-the-local-file-system"
[[models.embeddings]]
name = "BAAI/bge-large-zh-v1.5"
provider = "hf"
# If not provided, the model will be downloaded from the Hugging Face model hub
# uncomment the following line to specify the model path in the local file system
# path = "the-model-path-in-the-local-file-system"
```
In the above configuration file, `[[models.llms]]` specifies the LLM model, and `[[models.embeddings]]` specifies the embedding model. If you not provide the `path` parameter, the model will be downloaded from the Hugging Face model hub according to the `name` parameter.
Then run the following command to start the webserver:
```bash
uv run dbgpt start webserver --config configs/dbgpt-local-glm.toml
```
</TabItem>
</Tabs>
## Visit Website
Open your browser and visit [`http://localhost:5670`](http://localhost:5670)
### (Optional) Run Web Front-end Separately
You can also run the web front-end separately:
```bash
cd web && npm install
cp .env.template .env
// Set API_BASE_URL to your DB-GPT server address, usually http://localhost:5670
npm run dev
```
Open your browser and visit [`http://localhost:3000`](http://localhost:3000)
## Install DB-GPT Application Database
<Tabs
defaultValue="sqlite"
values={[
{label: 'SQLite', value: 'sqlite'},
{label: 'MySQL', value: 'mysql'},
]}>
<TabItem value="sqlite" label="sqlite">
:::tip NOTE
You do not need to separately create the database tables related to the DB-GPT application in SQLite;
they will be created automatically for you by default.
:::
Modify your toml configuration file to use SQLite as the database(Is the default setting).
```toml
[service.web.database]
type = "sqlite"
path = "pilot/meta_data/dbgpt.db"
```
</TabItem>
<TabItem value="mysql" label="MySQL">
:::warning NOTE
After version 0.4.7, we removed the automatic generation of MySQL database Schema for safety.
:::
1. Frist, execute MySQL script to create database and tables.
```bash
$ mysql -h127.0.0.1 -uroot -p{your_password} < ./assets/schema/dbgpt.sql
```
2. Second, modify your toml configuration file to use MySQL as the database.
```toml
[service.web.database]
type = "mysql"
host = "127.0.0.1"
port = 3306
user = "root"
database = "dbgpt"
password = "aa123456"
```
Please replace the `host`, `port`, `user`, `database`, and `password` with your own MySQL database settings.
</TabItem>
</Tabs>
## Test data (optional)
The DB-GPT project has a part of test data built-in by default, which can be loaded into the local database for testing through the following command
- **Linux**
```bash
bash ./scripts/examples/load_examples.sh
```
- **Windows**
```bash
.\scripts\examples\load_examples.bat
```
:::
## Visit website
Open the browser and visit [`http://localhost:5670`](http://localhost:5670)
\ No newline at end of file
# DD-Agents
Data Driven Multi-Agents(DD-Agents)
\ No newline at end of file
# Connections
The connections module supports connecting to various structured, semi-structured, and unstructured data storage engines. Bring multi-dimensional data into the framework and realize the interaction between natural language and multi-dimensional data
The list of data sources we currently support is as follows.
| DataSource | support | Notes |
| ------------------------------------------------------------------------------ |---------| ------------------------------------------- |
| [MySQL](https://www.mysql.com/) | Yes | MySQL is the world's most popular open source database. |
| [PostgresSQL](https://www.postgresql.org/) | Yes | The World's Most Advanced Open Source Relational Database |
| [Vertica](https://www.vertica.com/) | Yes | Vertica is a strongly consistent, ACID-compliant, SQL data warehouse, built for the scale and complexity of today’s data-driven world. |
| [Spark](https://github.com/apache/spark) | Yes | Unified Engine for large-scale data analytics |
| [DuckDB](https://github.com/duckdb/duckdb) | Yes | DuckDB is an in-process SQL OLAP database management system |
| [Sqlite](https://github.com/sqlite/sqlite) | Yes | |
| [MSSQL](https://github.com/microsoft/mssql-jdbc) | Yes | |
| [ClickHouse](https://github.com/ClickHouse/ClickHouse) | Yes | ClickHouse is the fastest and most resource efficient open-source database for real-time apps and analytics. |
| [Oracle](https://github.com/oracle) | No | TODO |
| [Redis](https://github.com/redis/redis) | No | The Multi-model NoSQL Database |
| [MongoDB](https://github.com/mongodb/mongo) | No | MongoDB is a source-available cross-platform document-oriented database program |
| [HBase](https://github.com/apache/hbase) | No | Open-source, distributed, versioned, column-oriented store modeled |
| [Doris](https://github.com/apache/doris) | Yes | Apache Doris is an easy-to-use, high performance and unified analytics database. |
| [DB2](https://github.com/IBM/Db2) | No | TODO |
| [Couchbase](https://github.com/couchbase) | No | TODO |
| [Elasticsearch](https://github.com/elastic/elasticsearch) | No | Free and Open, Distributed, RESTful Search Engine |
| [OceanBase](https://github.com/OceanBase) | No | OceanBase is a distributed relational database. |
| [TiDB](https://github.com/pingcap/tidb) | No | TODO |
| [StarRocks](https://github.com/StarRocks/starrocks) | Yes | StarRocks is a next-gen, high-performance analytical data warehouse |
# Evaluation
Model effect and framework performance evaluation.
\ No newline at end of file
# Fine-Tuning
Text2SQL and Text2API(DSL) fine-tune to enhance model performance.
\ No newline at end of file
# MS-RAG
Multi-Source Enhanced Retrieval-Augmented Generation Framework(MS-RAG)
\ No newline at end of file
# SMMF
Service-oriented Multi-model Management Framework(SMMF)
# Introduction
In AIGC application exploration and production landing, it is difficult to avoid directly interfacing with modeling services, but at present there is no de facto standard for the deployment of inference of large models, new models are constantly released and new training methods are constantly proposed, and we need to spend a lot of time adapting to the changing underlying modeling environments, which to a certain extent restricts the exploration and landing of AIGC applications
# System Design
In order to simplify the model adaptation process and improve model deployment efficiency and performance, we proposed a service-oriented Multi-Model Management Framework (SMMF).
<p align="center">
<img src={'/img/module/smmf_layer.png'} width="360px" />
</p>
SMMF consists of two parts: model inference layer and model deployment layer. The model inference layer corresponds to the model inference framework vLLM, TGI and TensorRT, etc. The model deployment layer connects downward to the inference layer and provides model service capabilities upward. The model deployment framework is based on the inference framework and provides capabilities such as multiple model instances, multiple inference frameworks, multi-cloud, automatic expansion and contraction<sup>[1]</sup> , and observability<sup>[2]</sup>
<p align="center">
<img src={'/img/module/smmf.png'} width="600px" />
</p>
In DB-GPT, SMMF is specifically shown in the figure above: the top layer corresponds to the service and application layer (such as DB-GPT WebServer, Agents system, applications, etc.). The next layer is the model deployment framework layer, which includes the API Server and Model Handle that provide model services to the application layer, the Metadata Management and Control Center Model Controller of the entire deployment framework, and the Model Worker that directly interfaces with the inference framework and the underlying environment. The next layer is the inference framework layer, which includes vLLM, llama.cpp and FastChat (since DB-GPT directly uses the inference interface of FastChat, here we also classify FastChat as an inference framework), large language models (Vicuna, Llama, Baichuan, ChatGLM), etc. are deployed in the inference framework. The bottom layer is the actual deployment environment, including Kubernetes, Ray, AWS, Alibaba Cloud, private cloud, etc
## SMMF features
- Supports multiple models and multiple inference frameworks
- Scalability and stability
- High framework performance
- Manageable and monitorable
- Lightweight
### Multiple models and multiple inference frameworks
The current development in the field of large models is changing with each passing day. New models are constantly being released, and new methods are constantly being proposed in terms of model training and inference. We judge that this situation will continue for some time.
For most users exploring and implementing AIGC application scenarios, this situation has both advantages and disadvantages. A typical drawback is to be "led by the nose" by the model, and it is necessary to constantly try and explore new models and new reasoning frameworks.
In DB-GPT, seamless support for FastChat, vLLM and llama.cpp is directly provided. In theory, DB-GPT supports all the models they support. If you have needs for reasoning speed and tactical capabilities, you can directly use vLLM , if you want the CPU or Mac's M1/M2 chip to also get good inference performance, you can use llama.cpp. In addition, DB-GPT also supports proxy models, such as: OpenAI, Azure, Google Bard, Tongyi, Baichuan, Xun Feixinghuo, Baidu Wenxin, Zhipu AI, etc
### Support LLMs
#### Open-source Models
- [Vicuna](https://huggingface.co/Tribbiani/vicuna-13b)
- [vicuna-13b-v1.5](https://huggingface.co/lmsys/vicuna-13b-v1.5)
- [LLama2](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf)
- [baichuan2-13b](https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat)
- [baichuan2-7b](https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat)
- [chatglm-6b](https://huggingface.co/THUDM/chatglm-6b)
- [chatglm2-6b](https://huggingface.co/THUDM/chatglm2-6b)
- [chatglm3-6b](https://huggingface.co/THUDM/chatglm3-6b)
- [falcon-40b](https://huggingface.co/tiiuae/falcon-40b)
- [internlm-chat-7b](https://huggingface.co/internlm/internlm-chat-7b)
- [internlm-chat-20b](https://huggingface.co/internlm/internlm-chat-20b)
- [qwen-7b-chat](https://huggingface.co/Qwen/Qwen-7B-Chat)
- [qwen-14b-chat](https://huggingface.co/Qwen/Qwen-14B-Chat)
- [wizardlm-13b](https://huggingface.co/WizardLM/WizardLM-13B-V1.2)
- [orca-2-7b](https://huggingface.co/microsoft/Orca-2-7b)
- [orca-2-13b](https://huggingface.co/microsoft/Orca-2-13b)
- [openchat_3.5](https://huggingface.co/openchat/openchat_3.5)
- [zephyr-7b-alpha](https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha)
- [mistral-7b-instruct-v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1)
- [Yi-34B-Chat](https://huggingface.co/01-ai/Yi-34B-Chat)
#### Proxy Models
- [OpenAI·ChatGPT](https://api.openai.com/)
- [百川·Baichuan](https://platform.baichuan-ai.com/)
- [Alibaba·通义](https://www.aliyun.com/product/dashscope)
- [Google·Bard](https://bard.google.com/)
- [Baidu·文心](https://cloud.baidu.com/product/wenxinworkshop?track=dingbutonglan)
- [智谱·ChatGLM](http://open.bigmodel.cn/)
- [讯飞·星火](https://xinghuo.xfyun.cn/)
:::info
More LLMs, please refer to the [source code](https://github.com/eosphoros-ai/DB-GPT/blob/main/pilot/configs/model_config.py)
:::
### Scalability and stability
The cloud native field solves the core pain points of management, control, scheduling, and utilization of massive computing resources. Let the value of computing be fully released, making large-scale computing a ubiquitous technology.
In the field of large models, we are also concerned about the explosive demand for computing resources during model inference. Therefore, multi-model management with scheduling supercomputing capabilities is what we focus on during production implementation. In view of the outstanding achievements of computing scheduling layers such as Kubernetes and Istio in the past few years, we fully draw on relevant design concepts in multi-model management and control.
A relatively complete model deployment framework requires multiple parts, including a Model Worker that directly interfaces with the underlying reasoning framework, a Model Controller that manages and maintains multiple model components, and a Model API that provides external model service capabilities. The Model Worker must be scalable. It can be a Model Worker that specifically deploys large language models, or a Model Worker that is used to deploy Embedding models. Of course, it can also be based on the deployment environment, such as physical machine environment, kubernetes environment, and some specific clouds. Choose different Model Workers based on the cloud environment provided by the service provider.
The Model Controller used to manage metadata also needs to be extensible, and different Model Controllers must be selected for different deployment environments and different model management and control requirements. In addition, from a technical point of view, model services have a lot in common with traditional microservices. In microservices, a certain service in the microservice can have multiple service instances, and all service instances are uniformly registered to the registration center. The service caller pulls the service list corresponding to the service name from the registration center based on the service name, and then selects a specific service instance to call according to a certain load balancing policy.
In model deployment, a similar architecture can also be considered. A certain model can have multiple model instances. All model instances are uniformly registered to the model registration center, and then the model service caller goes to the registration center to pull the model instance based on the model name. list, and then call a specific model instance according to the load balancing policy of the model.
Here we introduce the model registration center, which is responsible for storing model instance metadata in the Model Controller. It can directly use the registration center in existing microservices as an implementation (such as nacos, eureka, etcd and console, etc.), so that the entire deployment system is Can achieve high availability.
### High framework performance
The framework layer should not be the bottleneck of model inference performance. In most cases, the hardware and inference framework determines the capability of the model service, and the deployment and optimization of model inference is a complex project, and inappropriate framework design may increase this complexity. In our opinion, there are two main concerns in deploying the framework in order to "not drag the feet" on performance: ● The framework should not be the bottleneck of model inference performance.
Avoid excessive encapsulation: the more encapsulation and the longer the links, the harder it is to troubleshoot performance issues.
High-performance communication design: There are many points in high-performance communication design, so I won't go into them here. Since Python is currently taking the lead in AIGC applications, in Python, asynchronous interfaces are critical to the performance of the service. Therefore, the model service layer only provides asynchronous interfaces to make compatibility with the model reasoning framework docking layer, and directly dock if the model reasoning framework provides asynchronous interfaces. Otherwise use synchronous to asynchronous task support.
### Manageable and monitorable
In AIGC application exploration or AIGC application production and implementation, we need the model deployment system to have certain management capabilities, and to perform certain management and control on model instances deployed through API or command line (such as: online, offline, restart, debug, etc.)
Observability is a very important capability of production systems. We believe that observability is crucial in AIGC applications. Because the user experience and the interaction between the user and the system are more complex, in addition to traditional observation indicators, we are also more concerned about the user's input information and the contextual information of the corresponding scene. Which model instance and model parameters were called, the output content and response time of the model, user feedback, etc.
We can find some performance bottlenecks of model services and some user experience data from this information.
What about response latency?
Does it solve user problems and extract user satisfaction, etc. from user content?
These are the basis for further optimization of the entire application.
### Lightweight
Considering the numerous supported models and inference frameworks, we need to work hard to avoid unnecessary dependencies and ensure that users can install them as needed.
In DB-GPT, users can install their own dependencies on demand. Some of the main optional dependencies are as follows:
- Install the most basic dependencies `pip install -e .` or `pip install -e ".[core]"`
- Install the dependencies of the basic framework `pip install -e ".[framework]"`
- Install the dependencies of the openai proxy model `pip install -e ".[openai]"`
- Install default dependencies `pip install -e ".[default]"`
- Install dependencies of vLLM inference framework `pip install -e ".[vllm]"`
- Install dependencies for model quantization deployment `pip install -e ".[quantization]"`
- Install knowledge base related dependencies `pip install -e ".[knowledge]"`
- Install pytorch dependencies `pip install -e ".[torch]"`
- Install the dependencies of llama.cpp `pip install -e ".[llama_cpp]"`
- Install vectorized database dependencies `pip install -e ".[vstore]"`
- Install data source dependencies `pip install -e ".[datasource]"`
## Implementation
For multi-model related implementation, please refer to the [source code](https://github.com/eosphoros-ai/DB-GPT/tree/main/pilot/model)
# Appendix
`[1]` `[2]` Capabilities such as automatic scaling and observability are still in incubation and have not yet been implemented.
\ No newline at end of file
# Visualization
DB-GPT provides rich visualization capabilities, which are developed independently as reusable modules in the [GPT-Vis](https://github.com/eosphoros-ai/GPT-Vis) project
\ No newline at end of file
---
sidebar_position: 0
---
# Overview
🤖 **DB-GPT is an open source AI native data app development framework with AWEL(Agentic Workflow Expression Language) and agents**.
The purpose is to build infrastructure in the field of large models, through the development of multiple technical capabilities such as multi-model management (SMMF), Text2SQL effect optimization, RAG framework and optimization, Multi-Agents framework collaboration, AWEL (agent workflow orchestration), etc. Which makes large model applications with data simpler and more convenient.
🚀 **In the Data 3.0 era, based on models and databases, enterprises and developers can build their own bespoke applications with less code.**
<p align="left">
<img src={'/img/dbgpt.png'} width="680px" />
</p>
## Features
##### Private Domain Q&A & Data Processing & RAG
- Supports custom construction of knowledge bases through methods such as built-in, multi-file format uploads, and plugin-based web scraping. Enables unified vector storage and retrieval of massive structured and unstructured data.
##### Multi-Data Source & GBI(Generative Business Intelligence)
- Supports interaction between natural language and various data sources such as Excel, databases, and data warehouses. Also supports analysis reporting.
##### SMMF(Service-oriented Multi-model Management Framework)
- Supports a wide range of models, including dozens of large language models such as open-source models and API proxies. Examples include LLaMA/LLaMA2, Baichuan, ChatGLM, ERNIE Bot, Qwen, Spark, etc.
##### Automated Fine-tuning
- Supports Text2SQL fine-tuning. Provides a lightweight automatic fine-tuning framework around the fields of LLM and Text2SQL, supporting methods such as LoRA/QLoRA/P-turning, making Text2SQL fine-tuning as convenient as a production line.
##### Data-Driven Multi-Agents & Plugins
- Supports executing tasks through custom plugins and natively supports the Auto-GPT plugin model. [Agents protocol](https://agentprotocol.ai/) follows the Agent Protocol standard.
##### Privacy and Security
- Supports data privacy protection. Ensures data privacy and security through techniques such as privatizing large language models and proxy de-identification.
## Getting Started
- [Quickstart](./quickstart.md)
- [Installation](./installation)
## Terminology
| terminology | Description |
|----------------------|---------------------------------------------------------------|
| <center> `DB-GPT` </center>| DataBase Generative Pre-trained Transformer, an open source framework around databases and large language models |
|<center> `Data App` </center> | an intelligent Data application built on DB-GPT. |
| <center> `Text2SQL/NL2SQL` </center> | Text to SQL uses large language model capabilities to generate SQL statements based on natural language, or provide explanations based on SQL statements |
| <center>`KBQA` </center> | Knowledge-Based Q&A system |
| <center>`GBI` </center> | Generative Business Intelligence, based on large language models and data analysis, provides business intelligence analysis and decision-making through dialogue |
| <center>`LLMOps` </center> | A large language model operation framework that provides a standard end-to-end workflow for training, tuning, deploying, and monitoring LLM to accelerate application deployment of generated AI models |
|<center> `Embedding` </center> | Methods to convert text, audio, video and other materials into vectors |
|<center> `RAG` </center>| Retrieval Augmented Generation |
|<center> `AWEL` </center> | Agentic Workflow Expression Language, intelligent Workflow Expression Language
|<center> `AWEL Flow` </center> | workflow orchestration using the intelligent workflow Expression Language
|<center> `SMMF` </center> | a service-oriented multi-model management framework.
## Use Cases
- [Use Cases](./use_cases.md)
## Modules
#### [SMMF](./modules/smmf.md)
Service-oriented Multi-model Management Framework
#### [Retrieval](./modules/rag.md)
Multi-Knowledge Enhanced Retrieval-Augmented Generation Framework
#### [Agents](./modules/agent.md)
Data Driven Multi-Agents
#### [Fine-tuning](./modules/fine_tuning.md)
Fine-tuning module for Text2SQL/Text2DSL
## More
- [Connections](./modules/connections.md)
Connect various data sources
- [Obvervablity](./application/advanced_tutorial/observability.md)
Observing & monitoring
- [Evaluation](./modules/eval.md)
Evaluate framework performance and accuracy
## Community
If you encounter any problems during the process, you can submit an [issue](https://github.com/eosphoros-ai/DB-GPT/issues) and communicate with us.
We welcome [discussions](https://github.com/orgs/eosphoros-ai/discussions) in the community
---
sidebar_position: 0
---
# Quickstart
DB-GPT supports the installation and use of various open-source and closed-source models. Different models have different requirements for environment and resources. If local model deployment is required, GPU resources are necessary. The API proxy model requires relatively few resources and can be deployed and started on a CPU machine.
:::info note
- Detailed installation and deployment tutorials can be found in [Installation](./installation).
- This page only introduces deployment based on ChatGPT proxy and local GLM model.
:::
## Environment Preparation
### Download Source Code
:::tip
Download DB-GPT
:::
```bash
git clone https://github.com/eosphoros-ai/DB-GPT.git
```
### Environment Setup
- The default database uses SQLite, so there is no need to install a database in the
default startup mode. If you need to use other databases, please refer to the [advanced tutorials](./application/advanced_tutorial/rag.md) below.
Starting from version 0.7.0, DB-GPT uses uv for environment and package management, providing faster and more stable dependency management.
:::info note
There are some ways to install uv:
:::
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<Tabs
defaultValue="uv_sh"
values={[
{label: 'Command (macOS And Linux)', value: 'uv_sh'},
{label: 'PyPI', value: 'uv_pypi'},
{label: 'Other', value: 'uv_other'},
]}>
<TabItem value="uv_sh" label="Command">
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```
</TabItem>
<TabItem value="uv_pypi" label="Pypi">
Install uv using pipx.
```bash
python -m pip install --upgrade pip
python -m pip install --upgrade pipx
python -m pipx ensurepath
pipx install uv --global
```
</TabItem>
<TabItem value="uv_other" label="Other">
You can see more installation methods on the [uv installation](https://docs.astral.sh/uv/getting-started/installation/)
</TabItem>
</Tabs>
Then, you can run `uv --version` to check if uv is installed successfully.
```bash
uv --version
```
## Deploy DB-GPT
:::tip
If you are in the China region, you can add --index-url=https://pypi.tuna.tsinghua.edu.cn/simple at the end of the command.Like this:
```bash
uv sync --all-packages \
--extra "base" \
--extra "proxy_openai" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "dbgpts" \
--index-url=https://pypi.tuna.tsinghua.edu.cn/simple
```
This tutorial assumes that you can establish network communication with the dependency download sources.
:::
### Install Dependencies
<Tabs
defaultValue="openai"
values={[
{label: 'OpenAI (proxy)', value: 'openai'},
{label: 'DeepSeek (proxy)', value: 'deepseek'},
{label: 'GLM4 (local)', value: 'glm-4'},
{label: 'VLLM (local)', value: 'vllm'},
{label: 'LLAMA_CPP (local)', value: 'llama_cpp'},
{label: 'Ollama (proxy)', value: 'ollama'},
]}>
<TabItem value="openai" label="OpenAI(proxy)">
```bash
# Use uv to install dependencies needed for OpenAI proxy
uv sync --all-packages \
--extra "base" \
--extra "proxy_openai" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "dbgpts"
```
### Run Webserver
To run DB-GPT with OpenAI proxy, you must provide the OpenAI API key in the `configs/dbgpt-proxy-openai.toml` configuration file or privide it in the environment variable with key `OPENAI_API_KEY`.
```toml
# Model Configurations
[models]
[[models.llms]]
...
api_key = "your-openai-api-key"
[[models.embeddings]]
...
api_key = "your-openai-api-key"
```
Then run the following command to start the webserver:
```bash
uv run dbgpt start webserver --config configs/dbgpt-proxy-openai.toml
```
In the above command, `--config` specifies the configuration file, and `configs/dbgpt-proxy-openai.toml` is the configuration file for the OpenAI proxy model, you can also use other configuration files or create your own configuration file according to your needs.
Optionally, you can also use the following command to start the webserver:
```bash
uv run python packages/dbgpt-app/src/dbgpt_app/dbgpt_server.py --config configs/dbgpt-proxy-openai.toml
```
</TabItem>
<TabItem value="deepseek" label="DeepSeek(proxy)">
```bash
# Use uv to install dependencies needed for OpenAI proxy
uv sync --all-packages \
--extra "base" \
--extra "proxy_openai" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "dbgpts"
```
### Run Webserver
To run DB-GPT with DeepSeek proxy, you must provide the DeepSeek API key in the `configs/dbgpt-proxy-deepseek.toml`.
And you can specify your embedding model in the `configs/dbgpt-proxy-deepseek.toml` configuration file, the default embedding model is `BAAI/bge-large-zh-v1.5`. If you want to use other embedding models, you can modify the `configs/dbgpt-proxy-deepseek.toml` configuration file and specify the `name` and `provider` of the embedding model in the `[[models.embeddings]]` section. The provider can be `hf`.Finally, you need to append `--extra "hf"` at the end of the dependency installation command. Here's the updated command:
```bash
uv sync --all-packages \
--extra "base" \
--extra "proxy_openai" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "dbgpts" \
--extra "hf" \
--extra "cpu"
```
**Model Configurations**:
```toml
# Model Configurations
[models]
[[models.llms]]
# name = "deepseek-chat"
name = "deepseek-reasoner"
provider = "proxy/deepseek"
api_key = "your-deepseek-api-key"
[[models.embeddings]]
name = "BAAI/bge-large-zh-v1.5"
provider = "hf"
# If not provided, the model will be downloaded from the Hugging Face model hub
# uncomment the following line to specify the model path in the local file system
# path = "the-model-path-in-the-local-file-system"
path = "/data/models/bge-large-zh-v1.5"
```
Then run the following command to start the webserver:
```bash
uv run dbgpt start webserver --config configs/dbgpt-proxy-deepseek.toml
```
In the above command, `--config` specifies the configuration file, and `configs/dbgpt-proxy-deepseek.toml` is the configuration file for the DeepSeek proxy model, you can also use other configuration files or create your own configuration file according to your needs.
Optionally, you can also use the following command to start the webserver:
```bash
uv run python packages/dbgpt-app/src/dbgpt_app/dbgpt_server.py --config configs/dbgpt-proxy-deepseek.toml
```
</TabItem>
<TabItem value="glm-4" label="GLM4(local)">
```bash
# Use uv to install dependencies needed for GLM4
# Install core dependencies and select desired extensions
uv sync --all-packages \
--extra "base" \
--extra "cuda121" \
--extra "hf" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "quant_bnb" \
--extra "dbgpts"
```
### Run Webserver
To run DB-GPT with the local model. You can modify the `configs/dbgpt-local-glm.toml` configuration file to specify the model path and other parameters.
```toml
# Model Configurations
[models]
[[models.llms]]
name = "THUDM/glm-4-9b-chat-hf"
provider = "hf"
# If not provided, the model will be downloaded from the Hugging Face model hub
# uncomment the following line to specify the model path in the local file system
# path = "the-model-path-in-the-local-file-system"
[[models.embeddings]]
name = "BAAI/bge-large-zh-v1.5"
provider = "hf"
# If not provided, the model will be downloaded from the Hugging Face model hub
# uncomment the following line to specify the model path in the local file system
# path = "the-model-path-in-the-local-file-system"
```
In the above configuration file, `[[models.llms]]` specifies the LLM model, and `[[models.embeddings]]` specifies the embedding model. If you not provide the `path` parameter, the model will be downloaded from the Hugging Face model hub according to the `name` parameter.
Then run the following command to start the webserver:
```bash
uv run dbgpt start webserver --config configs/dbgpt-local-glm.toml
```
</TabItem>
<TabItem value="vllm" label="VLLM(local)">
```bash
# Use uv to install dependencies needed for vllm
# Install core dependencies and select desired extensions
uv sync --all-packages \
--extra "base" \
--extra "hf" \
--extra "cuda121" \
--extra "vllm" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "quant_bnb" \
--extra "dbgpts"
```
### Run Webserver
To run DB-GPT with the local model. You can modify the `configs/dbgpt-local-vllm.toml` configuration file to specify the model path and other parameters.
```toml
# Model Configurations
[models]
[[models.llms]]
name = "THUDM/glm-4-9b-chat-hf"
provider = "vllm"
# If not provided, the model will be downloaded from the Hugging Face model hub
# uncomment the following line to specify the model path in the local file system
# path = "the-model-path-in-the-local-file-system"
[[models.embeddings]]
name = "BAAI/bge-large-zh-v1.5"
provider = "hf"
# If not provided, the model will be downloaded from the Hugging Face model hub
# uncomment the following line to specify the model path in the local file system
# path = "the-model-path-in-the-local-file-system"
```
In the above configuration file, `[[models.llms]]` specifies the LLM model, and `[[models.embeddings]]` specifies the embedding model. If you not provide the `path` parameter, the model will be downloaded from the Hugging Face model hub according to the `name` parameter.
Then run the following command to start the webserver:
```bash
uv run dbgpt start webserver --config configs/dbgpt-local-vllm.toml
```
</TabItem>
<TabItem value="llama_cpp" label="LLAMA_CPP(local)">
If you has a Nvidia GPU, you can enable the CUDA support by setting the environment variable `CMAKE_ARGS="-DGGML_CUDA=ON"`.
```bash
# Use uv to install dependencies needed for llama-cpp
# Install core dependencies and select desired extensions
CMAKE_ARGS="-DGGML_CUDA=ON" uv sync --all-packages \
--extra "base" \
--extra "hf" \
--extra "cuda121" \
--extra "llama_cpp" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "quant_bnb" \
--extra "dbgpts"
```
Otherwise, run the following command to install dependencies without CUDA support.
```bash
# Use uv to install dependencies needed for llama-cpp
# Install core dependencies and select desired extensions
uv sync --all-packages \
--extra "base" \
--extra "hf" \
--extra "llama_cpp" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "quant_bnb" \
--extra "dbgpts"
```
### Run Webserver
To run DB-GPT with the local model. You can modify the `configs/dbgpt-local-llama-cpp.toml` configuration file to specify the model path and other parameters.
```toml
# Model Configurations
[models]
[[models.llms]]
name = "DeepSeek-R1-Distill-Qwen-1.5B"
provider = "llama.cpp"
# If not provided, the model will be downloaded from the Hugging Face model hub
# uncomment the following line to specify the model path in the local file system
# path = "the-model-path-in-the-local-file-system"
[[models.embeddings]]
name = "BAAI/bge-large-zh-v1.5"
provider = "hf"
# If not provided, the model will be downloaded from the Hugging Face model hub
# uncomment the following line to specify the model path in the local file system
# path = "the-model-path-in-the-local-file-system"
```
In the above configuration file, `[[models.llms]]` specifies the LLM model, and `[[models.embeddings]]` specifies the embedding model. If you not provide the `path` parameter, the model will be downloaded from the Hugging Face model hub according to the `name` parameter.
Then run the following command to start the webserver:
```bash
uv run dbgpt start webserver --config configs/dbgpt-local-llama-cpp.toml
```
</TabItem>
<TabItem value="ollama" label="Ollama(proxy)">
```bash
# Use uv to install dependencies needed for Ollama proxy
uv sync --all-packages \
--extra "base" \
--extra "proxy_ollama" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "dbgpts"
```
### Run Webserver
To run DB-GPT with Ollama proxy, you must provide the Ollama API base in the `configs/dbgpt-proxy-ollama.toml` configuration file.
```toml
# Model Configurations
[models]
[[models.llms]]
...
api_base = "your-ollama-api-base"
[[models.embeddings]]
...
api_base = "your-ollama-api-base"
```
Then run the following command to start the webserver:
```bash
uv run dbgpt start webserver --config configs/dbgpt-proxy-ollama.toml
```
In the above command, `--config` specifies the configuration file, and `configs/dbgpt-proxy-ollama.toml` is the configuration file for the Ollama proxy model, you can also use other configuration files or create your own configuration file according to your needs.
Optionally, you can also use the following command to start the webserver:
```bash
uv run python packages/dbgpt-app/src/dbgpt_app/dbgpt_server.py --config configs/dbgpt-proxy-ollama.toml
```
</TabItem>
</Tabs>
## (Optional) More Configuration
You can view the configuration in [Configuration](./config/config-reference) to learn more about
the configuration options.
For example, if you want to configure the LLM model, you can see all available options in the [LLM Configuration](./config-reference/llm/).
And another example, if you want to how to configure the vllm model, you can see all available options in the [VLLM Configuration](./config-reference/llm/vllm_adapter_vllmdeploymodelparameters_1d4a24.mdx).
## DB-GPT Install Help Tool
If you need help with the installation, you can use the `uv` script to get help.
```bash
uv run install_help.py --help
```
## Generate Install Command
You can use the `uv` script to generate the install command in the interactive mode.
```bash
uv run install_help.py install-cmd --interactive
```
And you can generate an install command with all the dependencies needed for the OpenAI proxy model.
```bash
uv run install_help.py install-cmd --all
```
You can found all the dependencies and extras.
```bash
uv run install_help.py list
```
## Visit Website
Open your browser and visit [`http://localhost:5670`](http://localhost:5670)
### (Optional) Run Web Front-end Separately
You can also run the web front-end separately:
```bash
cd web && npm install
cp .env.template .env
// Set API_BASE_URL to your DB-GPT server address, usually http://localhost:5670
npm run dev
```
Open your browser and visit [`http://localhost:3000`](http://localhost:3000)
\ No newline at end of file
# Tutorial for DB-GPT
Some video tutorials for the DB-GPT project, through these tutorials, you can understand the DB-GPT project better.
## DB-GPT introduction
On this page, we will give you some introduction about DB-GPT that can help you learn about it.
<iframe width="800" height="480" src="https://player.bilibili.com/player.html?bvid=BV1bp2GYzEpi" frameborder="0" allow="encrypted-media" allowfullscreen></iframe>
<!-- <iframe width="800" height="480" src="https://www.youtube.com/embed/f5_g0OObZBQ" frameborder="0" allow="encrypted-media" allowfullscreen></iframe> -->
\ No newline at end of file
# Upgrade To v0.5.0
## Overview
This guide is for upgrading from v0.4.6 and v0.4.7 to v0.5.0. If you use SQLite,
you not need to upgrade the database. If you use MySQL, you need to upgrade the database.
## Prepare
### Backup Your Database
To prevent data loss, it is recommended to back up your database before upgrading.
The backup way according to your database type.
## Upgrade
### Stop DB-GPT Service
Stop the DB-GPT service according to your start way.
### Upgrade Database
Execute the following SQL to upgrade the database.
**New Tables**
```sql
-- dbgpt.dbgpt_serve_flow definition
CREATE TABLE `dbgpt_serve_flow` (
`id` int NOT NULL AUTO_INCREMENT COMMENT 'Auto increment id',
`uid` varchar(128) NOT NULL COMMENT 'Unique id',
`dag_id` varchar(128) DEFAULT NULL COMMENT 'DAG id',
`name` varchar(128) DEFAULT NULL COMMENT 'Flow name',
`flow_data` text COMMENT 'Flow data, JSON format',
`user_name` varchar(128) DEFAULT NULL COMMENT 'User name',
`sys_code` varchar(128) DEFAULT NULL COMMENT 'System code',
`gmt_created` datetime DEFAULT NULL COMMENT 'Record creation time',
`gmt_modified` datetime DEFAULT NULL COMMENT 'Record update time',
`flow_category` varchar(64) DEFAULT NULL COMMENT 'Flow category',
`description` varchar(512) DEFAULT NULL COMMENT 'Flow description',
`state` varchar(32) DEFAULT NULL COMMENT 'Flow state',
`source` varchar(64) DEFAULT NULL COMMENT 'Flow source',
`source_url` varchar(512) DEFAULT NULL COMMENT 'Flow source url',
`version` varchar(32) DEFAULT NULL COMMENT 'Flow version',
`label` varchar(128) DEFAULT NULL COMMENT 'Flow label',
`editable` int DEFAULT NULL COMMENT 'Editable, 0: editable, 1: not editable',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_uid` (`uid`),
KEY `ix_dbgpt_serve_flow_sys_code` (`sys_code`),
KEY `ix_dbgpt_serve_flow_uid` (`uid`),
KEY `ix_dbgpt_serve_flow_dag_id` (`dag_id`),
KEY `ix_dbgpt_serve_flow_user_name` (`user_name`),
KEY `ix_dbgpt_serve_flow_name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- dbgpt.gpts_app definition
CREATE TABLE `gpts_app` (
`id` int NOT NULL AUTO_INCREMENT COMMENT 'autoincrement id',
`app_code` varchar(255) NOT NULL COMMENT 'Current AI assistant code',
`app_name` varchar(255) NOT NULL COMMENT 'Current AI assistant name',
`app_describe` varchar(2255) NOT NULL COMMENT 'Current AI assistant describe',
`language` varchar(100) NOT NULL COMMENT 'gpts language',
`team_mode` varchar(255) NOT NULL COMMENT 'Team work mode',
`team_context` text COMMENT 'The execution logic and team member content that teams with different working modes rely on',
`user_code` varchar(255) DEFAULT NULL COMMENT 'user code',
`sys_code` varchar(255) DEFAULT NULL COMMENT 'system app code',
`created_at` datetime DEFAULT NULL COMMENT 'create time',
`updated_at` datetime DEFAULT NULL COMMENT 'last update time',
`icon` varchar(1024) DEFAULT NULL COMMENT 'app icon, url',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_gpts_app` (`app_name`)
) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `gpts_app_collection` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'autoincrement id',
`app_code` varchar(255) NOT NULL COMMENT 'Current AI assistant code',
`user_code` int(11) NOT NULL COMMENT 'user code',
`sys_code` varchar(255) NOT NULL COMMENT 'system app code',
`created_at` datetime DEFAULT NULL COMMENT 'create time',
`updated_at` datetime DEFAULT NULL COMMENT 'last update time',
PRIMARY KEY (`id`),
KEY `idx_app_code` (`app_code`),
KEY `idx_user_code` (`user_code`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT="gpt collections";
-- dbgpt.gpts_app_detail definition
CREATE TABLE `gpts_app_detail` (
`id` int NOT NULL AUTO_INCREMENT COMMENT 'autoincrement id',
`app_code` varchar(255) NOT NULL COMMENT 'Current AI assistant code',
`app_name` varchar(255) NOT NULL COMMENT 'Current AI assistant name',
`agent_name` varchar(255) NOT NULL COMMENT ' Agent name',
`node_id` varchar(255) NOT NULL COMMENT 'Current AI assistant Agent Node id',
`resources` text COMMENT 'Agent bind resource',
`prompt_template` text COMMENT 'Agent bind template',
`llm_strategy` varchar(25) DEFAULT NULL COMMENT 'Agent use llm strategy',
`llm_strategy_value` text COMMENT 'Agent use llm strategy value',
`created_at` datetime DEFAULT NULL COMMENT 'create time',
`updated_at` datetime DEFAULT NULL COMMENT 'last update time',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_gpts_app_agent_node` (`app_name`,`agent_name`,`node_id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
```
**Add Columns**
```sql
ALTER TABLE `gpts_conversations`
ADD COLUMN `team_mode` varchar(255) NULL COMMENT 'agent team work mode';
ALTER TABLE `gpts_conversations`
ADD COLUMN `current_goal` text COMMENT 'The target corresponding to the current message';
```
### Install Dependencies
Install dependencies according to your installation way, if your installation from
source code and use the default way, you can run the following command:
```bash
pip install -e ".[default]"
```
### Start DB-GPT Service
Start your DB-GPT service according to your start way.
\ No newline at end of file
# Upgrade To v0.5.1
## Overview
This guide is for upgrading from v0.5.0 to v0.5.1. If you use SQLite,
you not need to upgrade the database. If you use MySQL, you need to upgrade the database.
## Prepare
### Backup Your Database
To prevent data loss, it is recommended to back up your database before upgrading.
The backup way according to your database type.
## Upgrade
### Stop DB-GPT Service
Stop the DB-GPT service according to your start way.
### Upgrade Database
Execute the following SQL to upgrade the database.
**Add Columns**
```sql
USE dbgpt;
ALTER TABLE dbgpt_serve_flow
ADD COLUMN `error_message` varchar(512) null comment 'Error message' after `state`;
```
# Upgrade To v0.6.0
## Overview
This guide is for upgrading from v0.5.10 to v0.6.0. If you use SQLite, you not need to upgrade the database. If you use MySQL, you need to upgrade the database.
## Prepare
### Backup Your Database
To prevent data loss, it is recommended to back up your database before upgrading. The backup way according to your database type.
## Upgrade
### Stop DB-GPT Service
Stop the DB-GPT service according to your start way.
### Upgrade database
Execute the following SQL to upgrade the database.
:::tip
The asset files required for the version upgrade are placed [here](https://github.com/eosphoros-ai/DB-GPT/tree/main/assets/schema/upgrade).
:::
```sql
USE dbgpt;
-- chat_history
ALTER TABLE chat_history ADD COLUMN `app_code` varchar(255) DEFAULT NULL COMMENT 'App unique code' after `message_ids`;
-- gpts_app
ALTER TABLE gpts_app ADD COLUMN `published` varchar(64) DEFAULT 'false' COMMENT 'Has it been published?';
ALTER TABLE gpts_app ADD COLUMN `param_need` text DEFAULT NULL COMMENT 'Parameter information supported by the application';
ALTER TABLE gpts_app ADD COLUMN `admins` text DEFAULT NULL COMMENT 'administrator';
-- connect_config
ALTER TABLE connect_config ADD COLUMN `user_name` varchar(255) DEFAULT NULL COMMENT 'user name';
ALTER TABLE connect_config ADD COLUMN `user_id` varchar(255) DEFAULT NULL COMMENT 'user id';
-- document_chunk
ALTER TABLE document_chunk ADD COLUMN `questions` text DEFAULT NULL COMMENT 'chunk related questions';
-- knowledge_document
ALTER TABLE knowledge_document ADD COLUMN `doc_token` varchar(100) DEFAULT NULL COMMENT 'doc token';
ALTER TABLE knowledge_document ADD COLUMN `questions` text DEFAULT NULL COMMENT 'document related questions';
-- gpts_messages
ALTER TABLE gpts_messages ADD COLUMN `is_success` int(4) NULL DEFAULT 0 COMMENT 'agent message is success';
ALTER TABLE gpts_messages ADD COLUMN `app_code` varchar(255) NOT NULL COMMENT 'Current AI assistant code';
ALTER TABLE gpts_messages ADD COLUMN `app_name` varchar(255) NOT NULL COMMENT 'Current AI assistant name';
ALTER TABLE gpts_messages ADD COLUMN `resource_info` text DEFAULT NULL COMMENT 'Current conversation resource info';
-- prompt_manage
ALTER TABLE prompt_manage ADD COLUMN `prompt_code` varchar(255) NULL COMMENT 'Prompt code';
ALTER TABLE prompt_manage ADD COLUMN `response_schema` text NULL COMMENT 'Prompt response schema';
ALTER TABLE prompt_manage ADD COLUMN `user_code` varchar(128) NULL COMMENT 'User code';
-- chat_feed_back
ALTER TABLE chat_feed_back ADD COLUMN `message_id` varchar(255) NULL COMMENT 'Message id';
ALTER TABLE chat_feed_back ADD COLUMN `feedback_type` varchar(50) NULL COMMENT 'Feedback type like or unlike';
ALTER TABLE chat_feed_back ADD COLUMN `reason_types` varchar(255) NULL COMMENT 'Feedback reason categories';
ALTER TABLE chat_feed_back ADD COLUMN `user_code` varchar(128) NULL COMMENT 'User code';
ALTER TABLE chat_feed_back ADD COLUMN `remark` text NULL COMMENT 'Feedback remark';
-- dbgpt_serve_flow
ALTER TABLE dbgpt_serve_flow ADD COLUMN `variables` text DEFAULT NULL COMMENT 'Flow variables, JSON format';
-- dbgpt.recommend_question definition
CREATE TABLE `recommend_question` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'autoincrement id',
`gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create time',
`gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'last update time',
`app_code` varchar(255) DEFAULT NULL COMMENT 'Current AI assistant code',
`question` text DEFAULT NULL COMMENT 'question',
`user_code` int(11) DEFAULT NULL COMMENT 'user code',
`sys_code` varchar(255) DEFAULT NULL COMMENT 'system app code',
`valid` varchar(10) DEFAULT 'true' COMMENT 'is it effective,true/false',
`chat_mode` varchar(255) DEFAULT NULL COMMENT 'Conversation scene mode,chat_knowledge...',
`params` text DEFAULT NULL COMMENT 'question param',
`is_hot_question` varchar(10) DEFAULT 'false' COMMENT 'Is it a popular recommendation question?',
PRIMARY KEY (`id`),
KEY `idx_rec_q_app_code` (`app_code`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT="AI application related recommendation issues";
-- dbgpt.user_recent_apps definition
CREATE TABLE `user_recent_apps` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'autoincrement id',
`gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create time',
`gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'last update time',
`app_code` varchar(255) DEFAULT NULL COMMENT 'AI assistant code',
`last_accessed` timestamp NULL DEFAULT NULL COMMENT 'User recent usage time',
`user_code` varchar(255) DEFAULT NULL COMMENT 'user code',
`sys_code` varchar(255) DEFAULT NULL COMMENT 'system app code',
PRIMARY KEY (`id`),
KEY `idx_user_r_app_code` (`app_code`),
KEY `idx_last_accessed` (`last_accessed`),
KEY `idx_user_code` (`user_code`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='User recently used apps';
-- dbgpt.dbgpt_serve_file definition
CREATE TABLE `dbgpt_serve_file` (
`id` int NOT NULL AUTO_INCREMENT COMMENT 'Auto increment id',
`bucket` varchar(255) NOT NULL COMMENT 'Bucket name',
`file_id` varchar(255) NOT NULL COMMENT 'File id',
`file_name` varchar(256) NOT NULL COMMENT 'File name',
`file_size` int DEFAULT NULL COMMENT 'File size',
`storage_type` varchar(32) NOT NULL COMMENT 'Storage type',
`storage_path` varchar(512) NOT NULL COMMENT 'Storage path',
`uri` varchar(512) NOT NULL COMMENT 'File URI',
`custom_metadata` text DEFAULT NULL COMMENT 'Custom metadata, JSON format',
`file_hash` varchar(128) DEFAULT NULL COMMENT 'File hash',
`user_name` varchar(128) DEFAULT NULL COMMENT 'User name',
`sys_code` varchar(128) DEFAULT NULL COMMENT 'System code',
`gmt_created` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'Record creation time',
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Record update time',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_bucket_file_id` (`bucket`, `file_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- dbgpt.dbgpt_serve_variables definition
CREATE TABLE `dbgpt_serve_variables` (
`id` int NOT NULL AUTO_INCREMENT COMMENT 'Auto increment id',
`key` varchar(128) NOT NULL COMMENT 'Variable key',
`name` varchar(128) DEFAULT NULL COMMENT 'Variable name',
`label` varchar(128) DEFAULT NULL COMMENT 'Variable label',
`value` text DEFAULT NULL COMMENT 'Variable value, JSON format',
`value_type` varchar(32) DEFAULT NULL COMMENT 'Variable value type(string, int, float, bool)',
`category` varchar(32) DEFAULT 'common' COMMENT 'Variable category(common or secret)',
`encryption_method` varchar(32) DEFAULT NULL COMMENT 'Variable encryption method(fernet, simple, rsa, aes)',
`salt` varchar(128) DEFAULT NULL COMMENT 'Variable salt',
`scope` varchar(32) DEFAULT 'global' COMMENT 'Variable scope(global,flow,app,agent,datasource,flow_priv,agent_priv, ""etc)',
`scope_key` varchar(256) DEFAULT NULL COMMENT 'Variable scope key, default is empty, for scope is "flow_priv", the scope_key is dag id of flow',
`enabled` int DEFAULT 1 COMMENT 'Variable enabled, 0: disabled, 1: enabled',
`description` text DEFAULT NULL COMMENT 'Variable description',
`user_name` varchar(128) DEFAULT NULL COMMENT 'User name',
`sys_code` varchar(128) DEFAULT NULL COMMENT 'System code',
`gmt_created` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'Record creation time',
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Record update time',
PRIMARY KEY (`id`),
KEY `ix_your_table_name_key` (`key`),
KEY `ix_your_table_name_name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- dbgpt.dbgpt_serve_dbgpts_my definition
CREATE TABLE `dbgpt_serve_dbgpts_my` (
`id` int NOT NULL AUTO_INCREMENT COMMENT 'autoincrement id',
`name` varchar(255) NOT NULL COMMENT 'plugin name',
`user_name` varchar(255) DEFAULT NULL COMMENT 'user name',
`file_name` varchar(255) NOT NULL COMMENT 'plugin package file name',
`type` varchar(255) DEFAULT NULL COMMENT 'plugin type',
`version` varchar(255) DEFAULT NULL COMMENT 'plugin version',
`use_count` int DEFAULT NULL COMMENT 'plugin total use count',
`succ_count` int DEFAULT NULL COMMENT 'plugin total success count',
`sys_code` varchar(128) DEFAULT NULL COMMENT 'System code',
`gmt_created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'plugin install time',
`gmt_modified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`, `user_name`),
KEY `ix_my_plugin_sys_code` (`sys_code`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- dbgpt.dbgpt_serve_dbgpts_hub definition
CREATE TABLE `dbgpt_serve_dbgpts_hub` (
`id` int NOT NULL AUTO_INCREMENT COMMENT 'autoincrement id',
`name` varchar(255) NOT NULL COMMENT 'plugin name',
`description` varchar(255) NULL COMMENT 'plugin description',
`author` varchar(255) DEFAULT NULL COMMENT 'plugin author',
`email` varchar(255) DEFAULT NULL COMMENT 'plugin author email',
`type` varchar(255) DEFAULT NULL COMMENT 'plugin type',
`version` varchar(255) DEFAULT NULL COMMENT 'plugin version',
`storage_channel` varchar(255) DEFAULT NULL COMMENT 'plugin storage channel',
`storage_url` varchar(255) DEFAULT NULL COMMENT 'plugin download url',
`download_param` varchar(255) DEFAULT NULL COMMENT 'plugin download param',
`gmt_created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'plugin upload time',
`gmt_modified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
`installed` int DEFAULT NULL COMMENT 'plugin already installed count',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
```
# Use Cases
\ No newline at end of file
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const { ProvidePlugin } = require("webpack");
const path = require("path");
// const lightCodeTheme = require('prism-react-renderer/themes/github');
// const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const {themes} = require('prism-react-renderer');
const lightCodeTheme = themes.github;
const darkCodeTheme = themes.dracula;
const isDev = process.env.NODE_ENV === "development";
const isBuildFast = !!process.env.BUILD_FAST;
const isVersioningDisabled = !!process.env.DISABLE_VERSIONING;
const versions = require("./versions.json");
console.log("versions", versions)
function isPrerelease(version) {
return (
version.includes('-') ||
version.includes('alpha') ||
version.includes('beta') ||
version.includes('rc')
);
}
function getLastStableVersion() {
const lastStableVersion = versions.find((version) => !isPrerelease(version));
if (!lastStableVersion) {
throw new Error('unexpected, no stable Docusaurus version?');
}
return lastStableVersion;
}
function getNextVersionName() {
return 'dev';
}
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'DB-GPT',
tagline: 'Revolutionizing Database Interactions with Private LLM Technology',
favicon: 'img/eosphoros.jpeg',
// Set the production url of your site here
url: 'http://docs.dbgpt.cn',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'eosphoros-ai', // Usually your GitHub org/user name.
projectName: 'DB-GPT', // Usually your repo name.
onBrokenLinks: isDev ? 'throw' : 'warn',
onBrokenMarkdownLinks: isDev ? 'throw' : 'warn',
// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en', 'zh-CN'],
},
scripts: [
{
src: '/redirect.js',
async: true,
},
],
markdown: {
mermaid: true,
},
themes: [
'@docusaurus/theme-mermaid',
'@easyops-cn/docusaurus-search-local',
],
plugins: [
() => ({
name: "custom-webpack-config",
configureWebpack: () => ({
plugins: [
new ProvidePlugin({
process: require.resolve("process/browser"),
}),
],
resolve: {
fallback: {
path: false,
url: false,
},
},
module: {
rules: [
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
},
{
test: /\.py$/,
loader: "raw-loader",
resolve: {
fullySpecified: false,
},
},
{
test: /\.ipynb$/,
loader: "raw-loader",
resolve: {
fullySpecified: false,
},
},
],
},
}),
}),
],
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
includeCurrentVersion: true,
// lastVersion: "current",
lastVersion: isDev || isBuildFast || isVersioningDisabled ? "current" : getLastStableVersion(),
onlyIncludeVersions: (() => {
if (isBuildFast) {
return ['current'];
} else if (!isVersioningDisabled && (isDev)) {
return ['current', ...versions.slice(0, 2)];
}
return undefined;
})(),
versions: {
current: {
label: `${getNextVersionName()}`,
},
},
remarkPlugins: [
[require("@docusaurus/remark-plugin-npm2yarn"), { sync: true }],
],
async sidebarItemsGenerator({
defaultSidebarItemsGenerator,
...args
}){
const sidebarItems = await defaultSidebarItemsGenerator(args);
sidebarItems.forEach((subItem) => {
// This allows breaking long sidebar labels into multiple lines
// by inserting a zero-width space after each slash.
if (
"label" in subItem &&
subItem.label &&
subItem.label.includes("/")
){
subItem.label = subItem.label.replace("/\//g", "\u200B");
}
});
return sidebarItems;
}
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
},
pages: {
remarkPlugins: [require("@docusaurus/remark-plugin-npm2yarn")],
},
blog: {
showReadingTime: true,
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
defaultClassicDocs: '/docs/get_started',
// Replace with your project's social card
navbar: {
hideOnScroll: true,
logo: {
alt: 'DB-GPT Logo',
src: 'img/dbgpt_logo.svg',
srcDark: 'img/DB-GPT_LOGO_White.svg',
href: "/docs/overview"
},
items: [
{
type: 'docSidebar',
sidebarId: 'tutorialSidebar',
position: 'left',
label: 'Docs',
to: "/docs/overview",
},
{
type: 'docSidebar',
sidebarId: "tutorials",
to: '/turtorials',
label: 'Turtorial',
position: 'left'
},
{
href: 'https://github.com/eosphoros-ai/community',
position: 'left',
label: "Community",
className: 'header-community-link',
},
{
type: "docsVersionDropdown",
position: "right",
dropdownItemsAfter: [{to: '/versions', label: 'All versions'}],
dropdownActiveClassDisabled: true,
},
{
href: 'https://github.com/eosphoros-ai/DB-GPT',
position: 'right',
className: 'header-github-link',
},
{
href: 'https://huggingface.co/eosphoros',
position: 'right',
label: "HuggingFace",
className: 'header-huggingface-link',
},
{
href: 'https://www.yuque.com/eosphoros/dbgpt-docs/bex30nsv60ru0fmx',
position: 'left',
label: "中文文档",
},
{to: '/blog', label: 'Blog', position: 'left'},
],
},
footer: {
style: 'light',
links: [
{
title: 'Community',
items: [
{
label: 'Discord',
href: 'https://discord.gg/erwfqcMP',
},
{
label: "Dockerhub",
href: "https://hub.docker.com/u/eosphorosai",
},
],
},
{
title: "Github",
items: [
{
label: 'Github',
href: 'https://github.com/eosphoros-ai/DB-GPT',
},
{
label: "HuggingFace",
href: "https://huggingface.co/eosphoros"
}
]
},
{
title: 'More',
items: [
{
label: 'Hacker News',
href: 'https://news.ycombinator.com/item?id=36038815',
},
{
label: 'Twitter',
href: 'https://twitter.com/DbGpt80100',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} DB-GPT`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
colorMode: {
defaultMode: 'light',
disableSwitch: false,
respectPrefersColorScheme: false,
},
}),
};
module.exports = config;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name docs.dbgpt.site;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# Redirect all HTTP requests to HTTPS
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name docs.dbgpt.site;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log;
sendfile on;
keepalive_timeout 65;
server {
listen 8089;
server_name _;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "dbgpt-docs",
"version": "0.0.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "3.4.0",
"@docusaurus/preset-classic": "3.4.0",
"@docusaurus/remark-plugin-npm2yarn": "^3.4.0",
"@docusaurus/theme-mermaid": "^3.4.0",
"@easyops-cn/docusaurus-search-local": "^0.38.1",
"@mdx-js/react": "^3.0.0",
"clsx": "^1.2.1",
"flickity": "^2.2.1",
"prism-react-renderer": "^2.1.0",
"process": "^0.11.10",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-flickity-component": "^4.0.6",
"winston": "^3.13.1"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.4.0",
"@docusaurus/types": "3.4.0"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"engines": {
"node": ">=18.0"
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment