Parameter Extraction
Last updated
Last updated
Utilize LLM to infer and extract structured parameters from natural language for subsequent tool invocation or HTTP requests.
Dify workflows provide a rich selection of tools, most of which require structured parameters as input. The parameter extractor can convert user natural language into parameters recognizable by these tools, facilitating tool invocation.
Some nodes within the workflow require specific data formats as inputs, such as the iteration node, which requires an array format. The parameter extractor can conveniently achieve structured parameter conversion.
Extracting key parameters required by tools from natural language, such as building a simple conversational Arxiv paper retrieval application.
In this example: The Arxiv paper retrieval tool requires paper author or paper ID as input parameters. The parameter extractor extracts the paper ID 2405.10739 from the query "What is the content of this paper: 2405.10739" and uses it as the tool parameter for precise querying.
Converting text to structured data, such as in the long story iteration generation application, where it serves as a pre-step for the iteration node, converting chapter content in text format to an array format, facilitating multi-round generation processing by the iteration node.
Extracting structured data and using the HTTP Request, which can request any accessible URL, suitable for obtaining external retrieval results, webhooks, generating images, and other scenarios.
Configuration Steps
Select the input variable, usually the variable input for parameter extraction.
Choose the model, as the parameter extractor relies on the LLM's inference and structured generation capabilities.
Define the parameters to extract, which can be manually added or quickly imported from existing tools.
Write instructions, where providing examples can help the LLM improve the effectiveness and stability of extracting complex parameters.
Advanced Settings
Inference Mode
Some models support two inference modes, achieving parameter extraction through function/tool calls or pure prompt methods, with differences in instruction compliance. For instance, some models may perform better in prompt inference if function calling is less effective.
Function Call/Tool Call
Prompt
Memory
When memory is enabled, each input to the question classifier will include the chat history in the conversation to help the LLM understand the context and improve question comprehension during interactive dialogues.
Output Variables
Extracted defined variables
Node built-in variables
__is_success Number
Extraction success status, with a value of 1 for success and 0 for failure.
__reason String
Extraction error reason