dify.md 1.96 KB
Newer Older
1
# Dify
Reid's avatar
Reid committed
2
3
4
5
6
7
8
9
10

[Dify](https://github.com/langgenius/dify) is an open-source LLM app development platform. Its intuitive interface combines agentic AI workflow, RAG pipeline, agent capabilities, model management, observability features, and more, allowing you to quickly move from prototype to production.

It supports vLLM as a model provider to efficiently serve large language models.

This guide walks you through deploying Dify using a vLLM backend.

## Prerequisites

11
12
13
14
15
16
17
Set up the vLLM environment:

```bash
pip install vllm
```

And install [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/).
Reid's avatar
Reid committed
18
19
20

## Deploy

21
1. Start the vLLM server with the supported chat completion model, e.g.
Reid's avatar
Reid committed
22

23
24
25
    ```bash
    vllm serve Qwen/Qwen1.5-7B-Chat
    ```
Reid's avatar
Reid committed
26

27
1. Start the Dify server with docker compose ([details](https://github.com/langgenius/dify?tab=readme-ov-file#quick-start)):
Reid's avatar
Reid committed
28

29
30
31
32
33
34
35
36
37
    ```bash
    git clone https://github.com/langgenius/dify.git
    cd dify
    cd docker
    cp .env.example .env
    docker compose up -d
    ```

1. Open the browser to access `http://localhost/install`, config the basic login information and login.
Reid's avatar
Reid committed
38

39
1. In the top-right user menu (under the profile icon), go to Settings, then click `Model Provider`, and locate the `vLLM` provider to install it.
Reid's avatar
Reid committed
40

41
1. Fill in the model provider details as follows:
Reid's avatar
Reid committed
42

43
44
45
46
47
    - **Model Type**: `LLM`
    - **Model Name**: `Qwen/Qwen1.5-7B-Chat`
    - **API Endpoint URL**: `http://{vllm_server_host}:{vllm_server_port}/v1`
    - **Model Name for API Endpoint**: `Qwen/Qwen1.5-7B-Chat`
    - **Completion Mode**: `Completion`
Reid's avatar
Reid committed
48

49
    ![](../../assets/deployment/dify-settings.png)
Reid's avatar
Reid committed
50

51
1. To create a test chatbot, go to `Studio → Chatbot → Create from Blank`, then select Chatbot as the type:
Reid's avatar
Reid committed
52

53
    ![](../../assets/deployment/dify-create-chatbot.png)
Reid's avatar
Reid committed
54

55
1. Click the chatbot you just created to open the chat interface and start interacting with the model:
Reid's avatar
Reid committed
56

57
    ![](../../assets/deployment/dify-chat.png)