This topic guides you through the process of connecting a Data Transmission Service (DTS) RAGFlow knowledge base as an external knowledge base for DMS Dify to develop large language model (LLM) applications.
Prerequisites
Before you begin, ensure you have completed the following setup:
You have created a RAGFlow knowledge base and configured the IP whitelist and created and started Dify resources.
ImportantFor private network connection: Your Dify resource and DTS RAGFlow instance must be in the same VPC.
For public network connection: The VPC hosting your DTS RAGFlow instance must have a NAT Gateway configured to allow public access.
You have coconfigured an LLM provider on the RAGFlow page.
Procedure
Step 1: Create and populate your knowledge base
First, you need to create a knowledge base in RAGFlow and upload the documents that will serve as the foundation for your RAG application.
Create a knowledge base.
In the upper-right corner of the page, click Create Knowledge Base.
In the Create Knowledge Base dialog box, enter the Name of the knowledge base.
Click OK.
Configure the knowledge base based on your actual requirements, and then click Save.
Upload files to the knowledge base.
On the Dataset page of the knowledge base, select .
In the Upload File dialog box, select and upload the prepared local file.
Select Parse When Creating.
Click OK.
Step 2: Connect RAGFlow to DMS Dify
Now, you'll configure Dify to recognize your RAGFlow knowledge base as an external data source.
Go to the Knowledge Base page of DMS.
NoteFor access methods, contact the DMS help desk.
Add an external knowledge base API.
On the right side of the page, click External Knowledge Base API.
Click Add External Knowledge Base API.
Configure the external knowledge base API information.
Parameter
Description
Name
We recommend that you enter a business-meaningful name for easy identification later.
API Endpoint
The API address of the DTS RAGFlow knowledge base, in the format of
http://<IP>/api/v1/dify.Note<IP>needs to be replaced with the connection address of the DTS RAGFlow knowledge base.To use the Internal Knowledge Base Address, add the IPv4 CIDR block of the vSwitch where DMS Dify is located to the IP whitelist of the DTS RAGFlow knowledge base. To use the External Knowledge Base Address, add the Internet egress address of DMS Dify to the IP whitelist of the DTS RAGFlow knowledge base.
API Key
The API key of the RAGFlow knowledge base.
NoteFor information about how to obtain the API key, see Get the API key of the RAGFlow knowledge base.
Click Save.
Connect to the external knowledge base.
On the right side of the page, click
on the External Knowledge Base API panel.In the Create Knowledge Base card, click Connect External Knowledge Base.
Configure the external knowledge base information.
Parameter
Description
External Knowledge Base Name
We recommend that you enter a business-meaningful external knowledge base name for easy identification later.
Knowledge Base Description (optional)
Enter the description of the external knowledge base for easy identification later.
External Knowledge Base API
Select the external knowledge base API added in Step 2.
External Knowledge Base ID
Enter the ID of the external knowledge base.
NoteFor information about how to obtain the ID, see Get the ID of the RAGFlow knowledge base.
Retrieval Settings
Based on your actual requirements, set Top K and Score Threshold.
Click Connect.
A card with the name specified in External Knowledge Base Name appears on the Knowledge Base page of DMS.
Step 3: Build your AI applications
With the knowledge base connected, you can now use it to build an LLM-powered application, such as a chat assistant, in the DMS console.
For application development examples, see Create and use a chat assistant application.
For more information, see Dify official documentation.
Related steps
Get the connection address
Go to the RAGFlow knowledge base list page for the destination region.
Log on to the Data Transmission Service (DTS) console.
In the navigation pane on the left, click Data preparation.
In the upper-left corner of the page, select the region where your data preparation instance is located.
Click the RAGFlow Knowledge Base tab.
In the Actions column of the target RAGFlow knowledge base, click Manage.
In the Connection Address section, obtain the Internal Knowledge Base Address or External Knowledge Base Address.
Get the API key of the RAGFlow knowledge base
In the navigation pane on the left, click API.
On the right side of RAGFlow API, click API KEY.
In the API KEY dialog box, click Create New Key.
Click
to record the token.
Get the ID of the RAGFlow knowledge base
On the Knowledge Base page, click the target knowledge base.
In the URL of the current page, record the ID of the knowledge base.
NoteThe information after
id=is the ID of the knowledge base.
Create and use a chat assistant application
Create a chat assistant application.
On the Knowledge Base page of DMS, click the Studio tab.
Click Chat Assistant.
In the Create Application card, click Create Blank Application.
Configure the application information.
Parameter
Description
Select Application Type
Select Chat Assistant.
Application Name & Icon
Enter the name of the chat assistant application and set an icon.
Description (optional)
Enter the description of the chat assistant application for easy identification later.
Click Create.
Click the created chat assistant application.
Orchestrate the chat assistant application.
Based on your actual requirements, enter the Prompt.
In the Knowledge Base section, click Add.
Select the external knowledge base configured in Step 3, and click Add.
Based on your actual requirements, configure Retrieval Settings, and click Save.
In the upper-right corner of the page, select the model that the chat assistant application needs to use.
In the Chat With Robot text box, enter your question for testing.