Skip to main content
Imagine you get an email saying:
Hi! What exactly is Dify? Also, which models does it support? And do you have a free plan?
If we send this to our current AI assistant, it might only answer the first question or give a vague response to both. We need a way to identify every question first, and then loop through our Knowledge Base to answer them one by one.

Parameter Extractor

Parameter Extractor
You can take Parameter Extractor as a highly organized scout. It reads a paragraph of texts (like an email) and picks out the specific piece of information you asked for, putting them into a neat and organized list.

Hands-On 1: Add Parameter Extractor

Before we upgrade the email assistant, let’s remove these nodes: Knowledge Retrieval, If/Else, LLM, LLM 2, and Variable Aggregator.
1

Add the Node

Right after the Start node, add the Parameter Extractor node.
Add Parameter Extractor
2

Set the Input

Click Parameter Extractor, and in the Input Variable section on the right panel, choose email_content.
Set the Input
Since AI doesn’t automatically know which specific information we need from the email, we must tell it to collect all the questions.
3

Add Extract Parameter

Click the plus (+) icon next to Extract Parameters to start defining what the AI should look for. Let’s call it question_list.
Add Extract Parameter
Parameter TypesIf Parameter Extractor is a scout, then Type is the bucket they use to carry the info. You need the right bucket for the right information.Single Items (The Small Buckets)
  • String (Text): For a single piece of text, e.g. customer’s name
  • Number: For a single digit, e.g. order quantity
  • Boolean: A simple Yes or No (True/False), good for a judgement result or a decision
List Items (The Arrays)
  • Array[String]: Array means List, and String means Text. So, Array[String] means we are using a basket that can hold multiple pieces of text—like all the separate questions in an email
  • Array[Number]: A container that holds different numbers, e.g. a list of prices or commodities
  • Array[Boolean]: Used to store multiple Yes/No judgment results. For example, checking a list containing multiple to-do items and returning whether each item is completed, such as [Yes, No, Yes]
  • Array[Object]: An advanced folder that holds sets of data (like a contact list where each entry has a Name and a Phone Number)
4

Finish Adding Extract Parameter

  1. Based on our needs, choose Array[String] for the email content.
  2. Add description for providing additional context. You can write: All the questions raised by the user in the email. After that, click Add.
Finish Adding Extract Parameter
5

Add Instructions

In the Instructions box below the extracted parameters, type a clear command to tell the AI how to act.For example: Extract all questions from the email, and make each question as a single item on the list.
By doing this, the node will be able to find all the questions in the email. Now that our scout has successfully gathered the Golden Nuggets, we need to move to the next step: teaching the AI to process each question.

Iteration

Iteration
With iteration, your assistant has a team of identical twins. When you hand over a list (like questions in the mail list), a twin appears for every single item on that list. Each twin takes their assigned item and performs the exact same task you’ve set up, ensuring nothing gets missed.

Hands-On 2: Set up Iteration Node

1

Add the Node

  1. Add an Iteration node after the Parameter Extractor.
  2. Click on the Iteration node and navigate to the Input panel on the right.
  3. Select {x} question_list from the Parameter Extractor. Leave the output variable blank for now.
Add Iteration Node
Advanced Options in IterationIn the Iteration panel, you’ll see more settings. Let’s have a quick walk-through.
Advanced Options in Iteration
Parallel Mode: OFF (Default)
  • When disabled, the workflow processes each item in the list one after another (finish Question 1, then move to Question 2).
  • When enabled, the workflow attempts to process all items in the list simultaneously (similar to 5 chefs cooking 5 different dishes at the same time).
Error Response Method: Terminate on error by default.
  • Terminate: This means if any single item in the list (e.g., the 2nd question) fails during the sub-process, the entire workflow will stop immediately
  • Ignore Error and Continue: This means even if the 2nd question fails, the workflow will skip it and move on to process the remaining questions
  • Remove Abnormal Output: Similar to ignore, but it also removes that specific failed item from the final output list results
Back to the workflow, you’ll see a sub-process area under the Iteration node. Every node inside this box will run once for every question.
2

Add Knowledge Retrieval Node

  1. Inside the Iteration box, add a Knowledge Retrieval node.
  2. Set the query text to {x} item. In Iteration, item always refers to the question that is currently being processed.
Add Knowledge Retrieval Node and Set Query Text
3

Add LLM Node

  1. Add an LLM node after Knowledge Retrieval.
  2. Configure it to answer the question based on the retrieved context.
Remember Lesson 4? Use those Prompt skills and don’t forget context!
Feel free to use the prompt below:System:
You are a professional Dify Customer Service Manager. Please provide a response to questions strictly based on the `Context`.
User:
questions: Iteration/{x} item
Add LLM Prompt
Since the iteration node generates an answer for each individual question, we need to gather all these answers to create one complete reply email.
4

Set Iteration Output

  1. Click the Iteration node.
  2. In the Output Variable, select the variable representing the LLM’s answer inside the loop. Now, the Iteration node will collect every answer and gather them into a new list.
Set Iteration Output
5

Add Final LLM Node

Finally, connect one last LLM node. This final editor will take all the collected answers and polish them into one professional email.Don’t forget to add prompt in system and user message. Feel free to refer the prompt below.
You are a professional customer service assistant. Please organize the answers prepared for customer into a clear and complete email reply.
Sign the email as Anne.
User:
answers: Iteration/{x}output
customer: User Input/{x}customer_name
Add Final LLM Node
6

Final Check

  1. Click on the checklist to see if there’s any missing spot. According to the notes, we need to connect Output node while fix the invalid variable issue.
  2. Connect Output node with LLM 2 node before it, remove its previous variable, then select text in LLM 2 as the output variable.
Select Output Variable
Now, you can write a test email with 3 different questions and check on the generated reply.

Mini Challenge

What else could Parameter Extractor find?
Try exploring the parameter type in it.