Data App Develop Guide
In this document, we will guide you through the process of developing a data analysis app using DB-GPT.
Target
In this case, our goal is to build a data assistant application that includes the following capabilities:
- Intelligent question and answer based on the documents.
- Conduct data dialogue based on database.
- Internet search based on tool usage.
These three capabilities can be utilized within a single conversation based on the intent recognition ability provided by DB-GPT. The data assistant will match appropriate sub-agent applications to answer questions in corresponding domains based on the user's inquiries.
Note: This case is mainly for demonstration purposes of application building, and actual applications in production environments still need further optimization.
Prepare
Before starting to build the application, you first need to complete the installation and deployment of the project. For relevant tutorials, please refer to the deployment documentation.
Sub-Data App Construction
First, we need to create three sub-intelligent applications separately, and then use the intent recognition capability provided by AppLink to integrate the intelligent applications into a unified intelligent entity and unify the dialogue interaction entrance.
1. Building a question answering assistant based on RAG
We use the agent module provided by DB-GPT to build a RAG-based question-answering assistant. DB-GPT has some built-in agents, such as
- Intent Recognition Expert Agent
- CodeEnginner Agent
- Report Generator Agent
- Data Scientist Agent
- Document Summarizer Agent
- ToolExpert Agent
- ...
In this case, intelligent question answering mainly relies on the domain knowledge base and document summarization agent (Summarizer), so we first need to build the domain knowledge base. The process is as follows:
- Domain Knowledge Cleaning and Organization
- Upload to DB-GPT Knowledge
- Create Knowledge-Based Data App
- Chat with KBQA
Domain Knowledge Cleaning and Organization
The organization and processing of domain knowledge is a very important task and has a very important impact on the final effect. You need to organize and clean up the files according to your actual application. In this example, we use the default PDF for uploading. We prepare the official DB-GPT document as demonstration material.
Create a knowledge base
On the product interface, select the knowledge base, click [Create Knowledge], and fill in the corresponding parameters. We provide multiple storage types. 1. Embedding vector 2. Knowledge graph 3. Full text. In this example, we use the Embedding solution for construction.
After filling in the corresponding parameters, click [Next] to select the document type and upload the document.
Select the appropriate slicing method and wait for the document to be uploaded. At this point, our knowledge base has been built and we can proceed with the subsequent intelligent question and answer application
Create a KBQA App
Select [Application Management] -> [Create Application], and select Single Agent Mode in the pop-up dialog box.
Click [OK], in the pop-up dialog box
- Select the Summarizer agent
- The prompt word is empty by default. If you need to modify it, you can customize the prompt first. For a tutorial on prompt definition, see the documentation.
- Model strategy: Supports multiple model strategies. If there are multiple models, they can be configured according to priority.
- Add resources: In this case, we rely on the previously created knowledge base, so select the resource type [knowledge] and the parameter is the name of the knowledge base just created.
- Add a recommended question, [Whether it takes effect] to control the effectiveness of the recommended question.
Click [Save] to complete the creation of the smart application.
Start Chat
Note: The agent application shown in this tutorial is built based on the Summarizer agent. The Summarizer agent is a built-in agent of DB-GPT. See the source code for the relevant code implementation. In actual use, the relevant code can be further modified according to specific scenarios. Customization and optimization. Or customize the agent based on this case
Data ChatBot Assistant
In the same way, a data dialogue assistant can be built based on similar ideas. The data dialogue assistant can conduct simple data dialogue based on a database and draw corresponding charts. It mainly includes the following steps:
- Data Preparation
- Create Datasource
- Create Data Chat App
- Chat