Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何在工作流中使用工具 #4113

Closed
3 tasks done
983183947 opened this issue May 6, 2024 · 2 comments
Closed
3 tasks done

如何在工作流中使用工具 #4113

983183947 opened this issue May 6, 2024 · 2 comments
Labels
📚 documentation Improvements or additions to documentation 🌊 feat:workflow Workflow related stuff.

Comments

@983183947
Copy link

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit report (我已阅读并同意 Language Policy).
  • Pleas do not modify this template :) and fill in all the required fields.

Provide a description of requested docs changes

在workflow中调用工具需要传入多个参数,但是LLM的输出只能输出一个text,我要如何提取参数或者能否直接调用我在本平台的Agent?

@dosubot dosubot bot added 🌊 feat:workflow Workflow related stuff. 📚 documentation Improvements or additions to documentation labels May 6, 2024
Copy link

dosubot bot commented May 6, 2024

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:

  1. 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.

  2. 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.

  3. 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.
  4. 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.

Details

Sources


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.

To continue the conversation, mention @dosu.

@crazywoola
Copy link
Member

Close due to #1542

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 documentation Improvements or additions to documentation 🌊 feat:workflow Workflow related stuff.
Projects
None yet
Development

No branches or pull requests

2 participants