Connect to models using the DMS AI plugin

Updated at:
Copy as MD

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

Note

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.

  1. Go to the Studio page of your Dify workspace. Click your account name, and then select Settings.

  2. 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

Note

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.

  1. Go to your workspace. In the navigation pane on the left, click the Difyimage icon, and then select Studio.

  2. On the Studio page, click your account name in the upper-right corner, and then select Settings.

  3. 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

  1. Go to the Dify Studio page. Click your account name in the upper-right corner, and then select Settings.

  2. 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, API Key, and Server URL parameters.

Step 2: Select the model on the knowledge base configuration page

  1. Go to the Dify Studio page.

  2. On the Knowledge Base tab, click Create Knowledge Base.

  3. 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

  1. Go to the Dify Studio page. Click your account name in the upper-right corner, and then select Settings.

  2. On the Model Providers page, add a Text Embedding or Rerank model, configure its parameters, and then click Save.

    Note

    In this example, set Model Name to m3e-base and Service Provider to AnalyticDB for PostgreSQL.

Step 2: Use the model on the knowledge base configuration page

  1. Go to the Dify Studio page.

  2. On the Knowledge Base tab, click Create Knowledge Base.

  3. On the knowledge base configuration page, select the model that you want to connect to.