You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To integrate a tool within a workflow that requires multiple parameters, when the output from an LLM is a single text string, you can use the following strategies:
Convert Single Text Output to Parameters: If your tool expects multiple parameters but you only have a single text output from the LLM, you can parse this text to extract the necessary parameters. This might involve converting the single string output into a dictionary where each key-value pair represents a parameter and its value.
Direct Invocation of an Agent: You can directly call your agent within the platform by using the agent_invoke method. This method allows for the direct execution of tools with the specified parameters. It handles the lifecycle of the tool invocation, including starting, processing, and completing the tool's execution, as well as error handling.
Advanced Tool Integration Features: Leverage advanced features for integrating tools within your workflow. This includes:
Variable Pool: Use this for storing outputs from one tool and using them as inputs for another, facilitating a seamless flow of data between tools.
Different Message Types: Depending on the output of your tool, you can create various types of messages (text, link, image, file BLOB), enhancing the interactivity and functionality of your workflow.
Error Handling and Parameter Validation: Ensure your workflow includes comprehensive error handling and parameter validation. This is crucial for maintaining a robust workflow and facilitating debugging when issues arise.
For more detailed guidance, including code examples and specific methods for invoking agents and handling parameters, refer to the api/core/tools/tool_engine.py file and the advanced-tool-integration.md tutorial in the Dify documentation. These resources provide in-depth explanations and examples that can help you effectively integrate tools into your workflows, even with the constraint of LLM outputs being a single text string.
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
Self Checks
Provide a description of requested docs changes
在workflow中调用工具需要传入多个参数,但是LLM的输出只能输出一个text,我要如何提取参数或者能否直接调用我在本平台的Agent?
The text was updated successfully, but these errors were encountered: