-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Failed to invoke tool: Failed to invoke tool: Output variable result[0]
must be a string
#15227
Comments
Hello, @rainvstar! I'm here to help you with your bug report and answer any questions you may have. Let's work together to resolve the issue you're facing. To resolve the issue where the output variable You can achieve this transformation by using a template node or a code node. Here's an example of how you can use a code node to convert the array into a string: def main(result: list):
# Assuming result is a list of objects, convert each object to a string representation
return {
"result": "\n".join([str(item) for item in result])
} This script takes each object in the array, converts it to a string, and joins them with newline characters. Alternatively, you can use a template node to achieve a similar transformation [1]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
I return as string, but it still not work。 |
@dosubot @crazywoola
result I had convert the array into a string, but it still not work when i use this workflow as tool in another workflow. |
Ensure that the output variable output_schema:
type: object
properties:
result:
type: string Additionally, make sure that the workflow where you are using this tool is also configured to handle the output as a string. If the issue persists, double-check that the output from your Python code is being correctly interpreted by the workflow as a string, and that there are no additional transformations or expectations in the subsequent workflow that might be causing the error [1]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
@dosubot @crazywoola
another workflow where to use the above tool
|
Ensure that the output variable Check the Additionally, verify that the To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
@dosubot @crazywoola |
To define the output type as a string in your second workflow when the "SQL查询服务" step outputs include "text" (String), you can use the <VarItem
name='text'
type='String'
description={t(`${i18nPrefix}.outputVars.text`)}
/> This code snippet shows how to define an output variable named 'text' with the type 'String', which matches the output type you want to use in your second workflow [1]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
I can't find VarItem Component. can you show me the picture? or give me a dsl then I can modify myself. I check my workflow and agent. Is it the definition of the workflow change? @dosubot @crazywoola |
The To define the output type as a string in your workflow, you should ensure that the output schema in your workflow configuration is correctly set to expect a string. Here's an example of how you might define it in your workflow's YAML configuration: output_schema:
type: object
properties:
result:
type: string This configuration specifies that the If you are using a visual interface or a DSL to define your workflow, ensure that the output variable is set to the correct type in the tool or node configuration. If the interface allows, you might need to manually set the output type to 'String' for the relevant node or tool. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
Self Checks
Dify version
1.0.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
I hava a workflow, the output is Array[Object]。I publish this workflow as a tool。
when I use this tool in another workflow ,it goes wrong.
Failed to invoke tool: Failed to invoke tool: Output variable
result[0]
must be a stringI don't understand how to deliever the output。
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
The text was updated successfully, but these errors were encountered: