Connect to models using the DMS AI plugin
After you deploy Dify, you can use the DMS AI plugin on the model provider page to connect to deployed model services, such as Large Language Model (LLM), Embedding, and Rerank services. These models can be private or from Alibaba Cloud Model Studio.
Connect to an LLM service
Connect to a privately deployed LLM service
DeepSeek-R1-Distill-Qwen-1.5B, DeepSeek-R1-Distill-Qwen-7B, DeepSeek-R1-Distill-Qwen-14B, DeepSeek-R1-Distill-Qwen-32B, and DeepSeek-R1-Distill-Llama-70B.
-
Go to the Studio page of your Dify workspace. Click your account name, and then select Settings.
-
On the Model Providers page, enter the Model Name, API Key, Server URL, and other required information. Then, click Save.
The Server URL format is
http://172.17.XXX.XXX: XX/v1.
Connect to an LLM service from Alibaba Cloud Model Studio
Before using an LLM service from Alibaba Cloud Model Studio, you must enable public network access for the VPC that Dify uses. This section uses connecting to DeepSeek-R1 as an example.
-
Go to your workspace. In the navigation pane on the left, click the Dify
icon, and then select Studio. -
On the Studio page, click your account name in the upper-right corner, and then select Settings.
-
On the Model Providers page, set the model type to LLM. Enter the Model Name, API Key, and Server URL. Then, click Save.
-
Model Name: The name that identifies a model deployed in Alibaba Cloud Model Studio.
-
API Key: Obtain an API key.
-
Server URL: Enter the Alibaba Cloud Model Studio server address. The URL for the shared model service is
https://dashscope.aliyuncs.com/compatible-mode/v1.
-
Connect to an Embedding or Rerank model
Use a privately deployed Embedding or Rerank service
DMS AI supports the following Embedding and Rerank models:
|
Type |
Model Name |
Max Context Length |
|
Embedding |
bge-m3 |
8192 |
|
bge-large-zh-v1.5 |
512 |
|
|
Rerank |
bge-reranker-v2-m3 |
8192 |
Step 1: Register the model information in the DMS AI plugin
-
Go to the Dify Studio page. Click your account name in the upper-right corner, and then select Settings.
-
On the Model Providers page, add a Text Embedding or Rerank model, configure its parameters, and then click Save.
NoteYou only need to configure the Model Name, Service Provider, API Key, and Server URL parameters.
Step 2: Select the model on the knowledge base configuration page
-
Go to the Dify Studio page.
-
On the Knowledge Base tab, click Create Knowledge Base.
-
On the knowledge base configuration page, select the model that you want to connect to.
Use an Embedding or Rerank service from AnalyticDB for PostgreSQL
Step 1: Register the model information in the DMS AI plugin
-
Go to the Dify Studio page. Click your account name in the upper-right corner, and then select Settings.
-
On the Model Providers page, add a Text Embedding or Rerank model, configure its parameters, and then click Save.
Note-
You only need to configure the Model Name, Service Provider, Access Key, Secret Key, Instance ID, Region ID, and Context Length parameters. For more information, see View an Access Key and Secret Key, Text Embedding parameter instructions, and Rerank parameter instructions.
-
The value of Context Length cannot exceed 2048.
In this example, set Model Name to
m3e-baseand Service Provider to AnalyticDB for PostgreSQL. -
Step 2: Use the model on the knowledge base configuration page
-
Go to the Dify Studio page.
-
On the Knowledge Base tab, click Create Knowledge Base.
-
On the knowledge base configuration page, select the model that you want to connect to.