Dify Installation Guide and Usage Tutorial 243

小编 ·

Dify Installation Guide and Usage Tutorial

Dify is an open-source large language model (LLM) application development platform that combines the concepts of Backend as a Service (BaaS) and LLMOps. It provides end-to-end support from prototyping to production deployment, allowing developers to quickly build production-grade generative AI applications. Below is an introduction to Dify installation and how to use it.

Dify Installation Guide and Usage Tutorial

What is Dify?

Dify is an open-source large language model (LLM) application development platform that combines the concepts of Backend as a Service (BaaS) and LLMOps, providing end-to-end support from prototype design to production deployment, enabling developers to quickly build production-grade generative ai applications. Below is an introduction to the Dify installation guide and how to use it.

Dify Installation Guide and Tutorial.webp

Dify Installation Guide

I. Environment Preparation

  • Make sure your system meets the following requirements: at least 2 CPU cores, at least 4GB of RAM (8GB or more recommended), and at least 20GB of disk space. The operating system supports Windows, macOS, or Linux.

  • Install Docker and Docker Compose. Windows users are recommended to enable WSL2.

  • Install Git (optional).

II. Installing Dify

1. Download the code:

git clone https://github.com/langgenius/dify.git
cd dify/docker

2. Configure the environment:

cp .env.example .env

3. Start the service:

If using Docker Compose V2:

docker compose up -d

If using V1:

docker-compose up -d

4. Check service status:

docker compose ps

Make sure all containers show an "Up" status.

III. Configuring Dify

1. Basic configuration: Open the .env file and configure the following key parameters:

CONSOLE_URL=http://localhost
SERVICE_API_URL=http://localhost
UPLOAD_FILE_SIZE_LIMIT=50 # File upload limit, in MB
UPLOAD_FILE_MIME_TYPES=.pdf,.doc,.docx,.txt # Allowed file types for upload

2. Model configuration: Visit http://localhost, complete the registration and login, then go to Settings → Model Provider to add model configurations.

How to Use Dify

1. Create an application:

  • Click "Create Blank App", select the application type (such as Chat Assistant, Agent, etc.), and give it a name.

  • Once configured, you can interact in the chat box.

2. Create a knowledge base:

  • Go to "Dataset → Create New", upload document files in various formats. Importing from Notion or syncing from external sites is also supported.

  • Set the indexing parameters and retrieval rules. It is recommended to use nomic-embed-text:latest as the file embedding model.

3. Configure the workflow:

  • Create a new Workflow, choose an existing workflow or customize the prompt template settings.

4. Other operations

  • Stop Dify:

docker-compose down
  • Update Dify:

git pull origin main
docker-compose down
docker-compose up -d
  • Further configuration: You can configure SSL, adjust database settings, etc. as needed.

For more detailed tutorials, you can refer to Dify's official documentation.