Heidelberg AICurriculum
Track 6 · Advanced
6.1.4

Dify

Open-source LLM app builder — upload papers, get a grounded chatbot

7 lessons 2026-08-06 AI-generated

1Overview

Built by LangGenius, open-sourced in 2023 — the pitch is one stack instead of stitching several tools together to get a chatbot talking to your own documents.

Dify is an open-source platform for building LLM-powered applications — chatbots, document Q&A, agent pipelines — through a visual interface. It handles the whole stack: prompt management, RAG with a built-in vector store, tool calling, conversation memory, and a publishable chat UI. Upload twenty PDFs, let Dify chunk and embed them, and ask a chatbot to synthesise findings across the corpus with citations. 50+ model providers (OpenAI, Anthropic, Groq, local Ollama) swap behind one UI. → Where n8n excels at API-level plumbing, Dify is LLM-first: the knowledge base is the product. Apache 2.0 and self-hostable; the cloud free tier is 200 messages a day.

Dify is the LLM-first member of the automation family: a visual builder for chatbots, document Q&A and agent pipelines, with RAG and a vector store built in. Below: what it is best at, what to watch for, and its full lesson set.

1.2After this chapter you can
Build a grounded Q&A chatbot over your own PDF, no code
Assemble a knowledge base from many documents and cite its answers
Swap the model provider without rebuilding the app
Chain a multi-step agent workflow on the visual canvas
1.3Best for

Standing up a document Q&A chatbot without picking a vector database or writing retrieval code yourself — the RAG pipeline is already wired in.

1.4Watch out

The cloud free tier (200 messages/day) is exhausted quickly in a classroom. Retrieval quality depends on the chunking strategy — defaults need tuning for dense scientific PDFs — and self-hosting needs Docker and ≥4 GB RAM. The course instance (dify.32dots.de) is currently paused.

1.5Free vs paid

Cloud free tier: 200 LLM messages/day, unlimited RAG queries. Professional $59/mo. Self-hosted: fully free under Apache 2.0.

2Lessons 7

2.1 Add a custom Azure AI Search tool to your Dify workspace

A custom tool that lets a Dify app call Azure Cognitive Search via its REST API.

You will be able to invoke Azure AI Search from a Dify workflow and see search results returned as tool output.

  1. Open your Dify workspace and navigate to Integrations > Tools.
  2. Click “Add tool” and choose the Custom Endpoint option.
  3. Paste the OpenAPI schema shown in the Microsoft AI Search guide (including title, version, server URL, path /indexes/wukong‑doc1/docs, query parameters api-version and search).
  4. Save the tool and give it a name like “AzureSearch”.
  5. Create a new workflow, add a User Input node followed by a Tool node that selects the AzureSearch tool you just created.
  6. Configure the Tool node to map the user’s input to the “search” query parameter and set a fixed api‑version value.
  • You'll see When you run the workflow with a search term, the tool node returns a JSON response containing an array of matching documents from Azure AI Search.
  • Takeaway Custom OpenAPI schemas let Dify extend LLM capabilities with any external service that provides a REST API.

2.2 Run Dify locally with Docker Compose

A self‑hosted instance of the open‑source Dify platform running in Docker containers.

You will have a running Dify service accessible at http://localhost:3000.

  1. Install Docker and Docker Compose on your machine if they are not already present
  2. Clone the Dify repository using git clone https://github.com/langgenius/dify.git into a folder of your choice
  3. Navigate to the cloned repository’s docker/ directory in a terminal and run docker compose up -d
  4. Open a web browser and go to http://localhost:3000 to verify the UI loads
  • You'll see The Dify login screen appears in your browser, confirming the server is up and running.
  • Takeaway Docker Compose lets you launch multi‑container applications with a single command, simplifying deployment of complex services
  • Check Which directory do you run docker compose up from, and what tells you the server is up?

2.3 Ask questions that are answered from your uploaded documents

A Dify Knowledge Base that stores uploaded PDFs and provides vector‑based retrieval for chat interactions.

You will receive natural‑language answers that cite specific sections of the PDFs you added

Dify's knowledge-creation wizard after embedding, with the retrieval setting shown.
  1. 1 Create knowledge button starts new knowledge base
  2. 2 Select data source choose document to ingest
  3. 3 Processing step selector configure how docs are parsed
  4. 4 Run indexing process starts embedding creation
  5. 5 API access link use knowledge via programmatic calls

Best viewed on desktop — tap Enlarge to read the numbered controls.

  1. Click Create Knowledge Base and enter a name for the new collection
  2. Select Upload Files, choose at least twenty PDF documents, and confirm the upload
  3. Press Enable RAG to trigger chunking of the PDFs and generation of embeddings
  4. Save the knowledge base and copy its ID for later use in a chatbot
  • You'll see A progress bar finishes chunking and embedding, and the knowledge base lists all uploaded files ready for retrieval
  • Takeaway RAG ties vector search to LLM output so responses are grounded in source material
  • Check What does Enable RAG start doing to the uploaded PDFs, and what tells you it has finished?

2.4 Enable citations for a chatbot built on a knowledge base

A feature that shows numbered source references for AI answers drawn from uploaded documents.

Your chatbot will display citation numbers linking back to the original PDF chunks after each response.

  1. Open an existing chatbot app or create a new one in Dify.
  2. In the builder, open the Features panel (available for Chatbots, Agents, and Text Generators).
  3. Toggle on the “Citations and Attributions” option.
  4. Ensure the app is connected to a Knowledge Base that contains uploaded PDFs.
  5. Save the app and enter Preview mode.
  6. Ask a question that requires information from the uploaded documents.
  • You'll see The AI response includes numbered citations (e.g., [1], [2]) that you can click to view the source document and chunk.
  • Takeaway Citations turn LLM answers into traceable, verifiable outputs by linking back to the underlying knowledge base.

2.5 Create and share a chatbot that answers with citations

A Dify Chatflow linked to the knowledge base, exposed via a shareable URL for anyone to use.

You will have a live web link where users can ask questions and receive cited answers drawn from your PDFs

  1. Create a new Chatflow, select your knowledge base, and set a system prompt describing the bot’s tone
  2. Add a RAG Retrieval node to the flow so each turn queries the knowledge base
  3. Click Publish, copy the generated public URL, and open it in an incognito browser window
  4. Enter a question that refers to one of the uploaded documents and observe the answer with its citation link
  • You'll see The chatbot returns a concise answer followed by a reference such as ‘(Document X, page Y)’ confirming the source
  • Takeaway Publishing a Dify Chatflow creates an instantly accessible AI assistant that leverages RAG to provide trustworthy, source‑backed information
  • Check Which node makes each turn query the knowledge base, and what does the published bot put after its answer?

2.6 Add a conversation opener with suggested questions

An opening message that greets users and offers clickable suggestions to start the chat.

Your chatbot will greet users with a custom welcome text and display suggested prompts they can click.

  1. Open your chatbot app in Dify’s builder.
  2. In the Features panel, locate “Conversation Opener”.
  3. Enter a greeting message (e.g., “Welcome! How can I help you today?”).
  4. Add up to three suggested questions using the {{variable_name}} syntax if desired.
  5. Save the changes and publish or preview the app.
  6. Open the chatbot UI as an end user.
  • You'll see The chat window shows the welcome message with clickable suggestion chips that populate the input field when clicked.
  • Takeaway Conversation openers improve user onboarding by guiding interactions from the first moment.

2.7 Allow users to upload files during a chat session

A file‑upload feature that lets end users attach documents, images, or audio while chatting.

Your chatbot will accept user uploads and make the file content available to the LLM for processing.

  1. Open your chatbot app in Dify’s builder.
  2. In the Features panel, enable “File Upload”.
  3. Configure accepted file types (e.g., Documents) and set the maximum size limit if needed.
  4. Save the app and go to Preview mode.
  5. Click the upload button in the chat UI and select a PDF or image file.
  6. Send a message referencing the uploaded file (e.g., “Summarize this document”).
  • You'll see The uploaded file appears as an attachment in the conversation, and the AI response includes information extracted from the file.
  • Takeaway File upload expands interaction modalities, allowing LLMs to reason over user‑provided content on the fly.

3You’ll know it worked 11 checkable outcomes in this chapter

  • A new member asks a question and receives an answer with citations from the PDF
  • Support tickets for routine questions are answered within seconds without human intervention
  • Researchers ask a question and receive an answer citing the correct paper title and page number
  • Writer receives a JSON brief with angle, audience, key points, and headline options after entering a keyword
  • Employees receive cited policy sections in response to a Slack query
  • Employees receive the correct leave-request link after asking a policy question
  • Agents receive answers within the ticket sidebar without leaving Zendesk
  • Tier-1 support tickets drop while users receive instant answers

11 outcomes in all — one per recipe below.

4FAQ, Tips & How-to 38

one problem, one solution, one action

Knowledge & docs3

How-to Dify Scientist

New lab members can’t locate SOPs quickly

New lab members find protocol answers in seconds instead of hunting through shared drives or asking a senior colleague.

~18 min · low code AI-generated
How-to Dify Finance +1

Employees stuck waiting for policy answers by email

Finance handles fewer one-off policy queries by email; employees get instant, policy-grounded answers any time of day.

~18 min · low code AI-generated
How-to Dify Sales

Need instant competitive talking points on a call

Reps handle competitive objections confidently without putting prospects on hold to find the right slide deck.

~18 min · low code AI-generated

Customer & client portals3

How-to Dify Founder +1

Routine FAQ traffic is deflected automatically, cutting first-response time from hours to seconds.

~18 min · low code AI-generated
How-to Dify Support

Agents stuck searching docs while handling tickets

Average handle time drops because agents find answers in seconds rather than searching the knowledge base or pinging a colleague.

~18 min · low code AI-generated
How-to Dify Support +2

Users ask routine support questions

Routine tier-1 questions are deflected without a human agent, reducing ticket volume while still capturing contacts who need real help.

~18 min · low code AI-generated

Research & data tools1

How-to Dify Scientist

Summarizing research papers in a spreadsheet takes days

Early-stage literature synthesis that takes days in a spreadsheet is turned into an interactive Q&A session.

~18 min · low code AI-generated

Internal tools & ops2

How-to Dify HR / People

Employees waiting on policy answers

HR ticket volume for common policy questions drops, and answers are traceable to the exact policy clause.

~18 min · low code AI-generated
How-to Dify HR / People

Can't find the right leave form after asking HR

HR is freed from repeat policy queries by email; employees get instant answers at any hour and are guided to the right form for transactional requests.

~18 min · low code AI-generated

Content & marketing1

How-to Dify Creator +1

Blank page for a new piece

Writers start every piece with a consistent, on-brand brief instead of a blank page, cutting brief-writing time by around 80%.

~18 min · low code AI-generated
How-to Dify Everyone

Need to create an app fast without coding

You can access Dify's drag-and-drop interface to start building apps

A Dify Chatbot with a knowledge base attached as **Context**; the **Retrieval Setting** controls how many chunks are fetched (**Top K**) and how they are matched (semantic vs keyword) before the model answers — the retrieval step that grounds the reply. Credit: docs.dify.ai ↗
Lesson → AI-generated
How-to Dify Everyone

Need a brand‑new chatbot project

Creates a fresh app of type Chatbot that you can configure and publish

Lesson → AI-generated
How-to Dify Everyone

Make your chatbot reachable online

Makes the chatbot reachable via a URL or embeddable widget

Lesson → AI-generated
How-to Dify Everyone

Want the chatbot to sound different

Changing the chatbot's instruction text reshapes its output without affecting grounding

Lesson → AI-generated
How-to Dify Everyone

You can instantly see which LLM your app is using without opening any code

Publishing a Dify app — the same build ships as a public chat URL, an embeddable widget, and a Service API. Credit: docs.dify.ai ↗
Lesson → AI-generated
How-to Dify Everyone

Running the same query on two models lets you see concrete differences in output quality and style

Lesson → AI-generated
How-to Dify Everyone

Testing both models with identical input provides concrete data to decide which fits your constraints

Lesson → AI-generated
How-to Dify Everyone

Unsure which LLM to pick for new chats

Designating a winner makes future chats automatically use the chosen model without extra steps

Lesson → AI-generated
How-to Dify Everyone

Need a way to build multi‑step workflows

You can begin building multi-step workflows by creating a Workflow app in Dify's Studio

A Dify Workflow on the canvas — typed nodes wired in sequence, with the selected node's settings on the right. Credit: docs.dify.ai ↗
Lesson → AI-generated
How-to Dify Everyone

Can’t find the right info in your knowledge base

Linking a Knowledge Retrieval node lets the workflow pull relevant text from your knowledge base

Lesson → AI-generated
How-to Dify Everyone

Need separate paths for long and short questions

An If/Else node enables conditional routing so different question lengths follow separate paths

Lesson → AI-generated
How-to Dify Everyone

Factual and open‑ended questions

A classifier node can split incoming queries into categories so each follows a tailored processing path

Lesson → AI-generated
How-to Dify Everyone

Question types need separate workflow branches

Linking each classification outcome to a different node chain lets the workflow handle distinct question types appropriately

Lesson → AI-generated
How-to Dify Everyone

Running one example of each class proves the classifier and branching logic work as intended

Lesson → AI-generated
How-to Dify Everyone

My bot can’t see my files

Linking a knowledge base lets the agent retrieve information from your documents while reasoning

Dify's **Tools** catalog — built-in tools (Code Interpreter, web scraping, search, current time) plus Marketplace tools and Agent Strategies that an **Agent** can call to act beyond text. Credit: docs.dify.ai ↗
Lesson → AI-generated
How-to Dify Everyone

Enumerating the exact nodes or tools clarifies implementation requirements and avoids missing functionality

Lesson → AI-generated
How-to Dify Everyone

Stating whether the solution is a public chat URL, embedded widget, or Service API determines integration and access strategy

Lesson → AI-generated
FAQ Dify Everyone

What is Dify and what can I use it for?

Dify is an open-source platform for building AI-powered applications — like chatbots and question-answering assistants — without writing code. You design your app visually, connect an AI model (such as ChatGPT or Claude), and optionally upload documents for the AI to answer questions from. It is especially well-suited for non-technical users who want a working chatbot over their own documents in a short time.

Dify ↗ AI-generated
FAQ Dify Everyone

Should I use Dify Cloud or self-host Dify — what is the difference?

Dify Cloud means signing up at dify.ai and using it in your browser with no installation — the easiest option for beginners. Self-hosting means running Dify on your own computer or server with Docker, which gives full data privacy and no usage limits beyond your hardware. Cloud is best for building quickly; self-hosting makes sense if your data is sensitive (e.g. unpublished research) or you need more documents and storage than the free cloud tier provides.

architjn.com ↗ AI-generated
FAQ Dify Everyone

How does Dify compare to n8n — which should I use?

Dify is built specifically for AI chatbots and knowledge-base apps, with RAG, prompt engineering, and chat interfaces built in — you can have a working chatbot in under an hour with no coding. n8n is a general workflow-automation tool with hundreds of integrations that treats AI as one optional component; it has a steeper learning curve. For a chatbot over your papers, Dify is the right choice; n8n shines when you need to connect many external systems alongside AI.

Dify ↗ AI-generated
FAQ Dify Everyone

What is a Dify Knowledge Base and how does RAG work?

A Knowledge Base is a collection of your own documents (papers, notes, PDFs) that you upload into Dify. When someone asks a question, Dify first searches those documents for the most relevant passages, then sends those passages along with the question to the AI model — a technique called Retrieval-Augmented Generation (RAG). The result is an AI that answers based on your specific materials rather than just its general training, making it far more accurate for specialized topics.

Dify ↗ AI-generated
FAQ Dify Everyone

What file types can I upload to a Dify Knowledge Base?

Dify supports a wide range of formats: TXT, Markdown, PDF, HTML, Excel, Word, CSV, PowerPoint, and more, up to a per-file size limit. For most uploads of paper PDFs or Word notes, the standard mode works without extra setup; an alternative processing option unlocks the broader format list including presentations.

Dify ↗ AI-generated
FAQ Dify Everyone

How do I upload my papers and notes to a Dify Knowledge Base step by step?

Go to the Knowledge section, click Create Knowledge, and name it. Drag-and-drop or browse to select your files, then choose automatic text chunking (recommended for beginners) and a high-quality indexing mode for better accuracy. Click Save and Process — indexing may take a minute or two. Once complete, attach this Knowledge Base to your chatbot app, and the bot can answer questions based on its contents.

Dify ↗ AI-generated
FAQ Dify Everyone

What AI models does Dify support — can I use ChatGPT, Claude, Gemini, or local models?

All of them. Dify supports OpenAI (GPT), Anthropic (Claude), Google (Gemini), and many more cloud providers, and it also supports local models running on your own computer via Ollama — meaning you can run open-source models for free with no per-message cost, though that needs a capable machine. You add any provider under Settings → Model Providers by pasting in your API key.

Dify ↗ AI-generated
How-to Dify Everyone

Need others to try your bot without logging in

Anyone can access the bot without a Dify account via a shared URL

Dify docs — Embedding in websites ↗ AI-generated
How-to Dify Everyone

Need Notion pages in a knowledge base

Learn how to bring Notion content into a Dify Knowledge Base and keep it updated

Dify docs — Sync from Notion ↗ AI-generated

The same set on /recipes, filtered by tool and role.

5Videos 3

6FAQ 7

What is Dify and what can I use it for?

Dify is an open-source platform for building AI-powered applications — like chatbots and question-answering assistants — without writing code. You design your app visually, connect an AI model (such as ChatGPT or Claude), and optionally upload documents for the AI to answer questions from. It is especially well-suited for non-technical users who want a working chatbot over their own documents in a short time.

Should I use Dify Cloud or self-host Dify — what is the difference?

Dify Cloud means signing up at dify.ai and using it in your browser with no installation — the easiest option for beginners. Self-hosting means running Dify on your own computer or server with Docker, which gives full data privacy and no usage limits beyond your hardware. Cloud is best for building quickly; self-hosting makes sense if your data is sensitive (e.g. unpublished research) or you need more documents and storage than the free cloud tier provides.

How does Dify compare to n8n — which should I use?

Dify is built specifically for AI chatbots and knowledge-base apps, with RAG, prompt engineering, and chat interfaces built in — you can have a working chatbot in under an hour with no coding. n8n is a general workflow-automation tool with hundreds of integrations that treats AI as one optional component; it has a steeper learning curve. For a chatbot over your papers, Dify is the right choice; n8n shines when you need to connect many external systems alongside AI.

What is a Dify Knowledge Base and how does RAG work?

A Knowledge Base is a collection of your own documents (papers, notes, PDFs) that you upload into Dify. When someone asks a question, Dify first searches those documents for the most relevant passages, then sends those passages along with the question to the AI model — a technique called Retrieval-Augmented Generation (RAG). The result is an AI that answers based on your specific materials rather than just its general training, making it far more accurate for specialized topics.

What file types can I upload to a Dify Knowledge Base?

Dify supports a wide range of formats: TXT, Markdown, PDF, HTML, Excel, Word, CSV, PowerPoint, and more, up to a per-file size limit. For most uploads of paper PDFs or Word notes, the standard mode works without extra setup; an alternative processing option unlocks the broader format list including presentations.

How do I upload my papers and notes to a Dify Knowledge Base step by step?

Go to the Knowledge section, click Create Knowledge, and name it. Drag-and-drop or browse to select your files, then choose automatic text chunking (recommended for beginners) and a high-quality indexing mode for better accuracy. Click Save and Process — indexing may take a minute or two. Once complete, attach this Knowledge Base to your chatbot app, and the bot can answer questions based on its contents.

What AI models does Dify support — can I use ChatGPT, Claude, Gemini, or local models?

All of them. Dify supports OpenAI (GPT), Anthropic (Claude), Google (Gemini), and many more cloud providers, and it also supports local models running on your own computer via Ollama — meaning you can run open-source models for free with no per-message cost, though that needs a capable machine. You add any provider under Settings → Model Providers by pasting in your API key.

7Glossary 18 terms

Show the 18 terms
Dify
Chatbot
The simplest Dify application type — you give it a model and a prompt, and users interact with it through a back-and-forth chat interface without needing tool calls or a multi-step workflow.
Agent
A Dify application type where the AI can reason, decompose tasks, and call tools on its own without you having to pre-define every step.
Workflow
A Dify application type that chains multiple steps (nodes) together in a visual diagram; it runs once from start to finish, taking input and returning a result through a fixed, repeatable process.
Chatflow
A Dify application type that combines a workflow's structured steps with a conversational chat interface, so each user message triggers the full node chain before a response is returned.
Node
A single building block inside a Dify workflow — each node does one job (call an LLM, run code, retrieve from a knowledge base, etc.) and passes its result to the next node.
LLM Node
A workflow node that sends a prompt to a language model — supporting text, images, and documents — and returns the model's output as a variable the rest of the workflow can use.
Knowledge Base
A repository of documents you upload to Dify so the AI can search and retrieve relevant passages when answering questions, rather than relying only on its training data.
RAG
Retrieval-Augmented Generation — a technique where the AI looks up relevant passages from your knowledge base and uses them to write a more accurate, grounded answer.
Chunking
The process of splitting an uploaded document into smaller pieces so each piece can be independently searched and retrieved by the AI.
Embedding
A way of converting text into numbers (vectors) so the system can measure how similar two pieces of text are — used internally when searching a knowledge base.
Reranking
A second sorting pass that takes the initial search results from a knowledge base and re-orders them by relevance using a scoring model so the best chunks reach the AI first.
ReAct
An agent strategy available in Dify that guides the model through explicit Thought → Action → Observation cycles, useful for models that lack native function-calling support.
System Prompt
Hidden instructions you write once that shape how the AI behaves in every conversation — setting its persona, tone, and rules before any user message arrives.
Variable
A named placeholder in a Dify prompt or workflow that gets filled in at run-time — either from user input or from the output of an earlier node.
Annotation
A hand-curated question-and-answer pair you save in Dify so the app returns your exact pre-written response whenever a sufficiently similar question appears, bypassing the LLM entirely.
Plugin
A modular component you install in your Dify workspace to extend it with new model providers, tools, or external integrations — usable across all apps in that workspace.
Tool
A specific action an Agent or workflow node can call — such as searching the web, running a calculation, or querying an API — to get information or take action beyond text generation.
API Key
A secret credential you enter in Dify when connecting a model provider or external service — it authenticates your workspace so the service accepts requests from your application.

8See also

💬 Discuss this chapter

Ask, share, or report — over on the Heidelberg AI community forum.