-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
When I need to use tools, llm use two tools simultaneously, and then an error occurs. #8400
Comments
The error you're encountering, To address this, you can manage the sequence of tool invocations to ensure they do not execute simultaneously. Dify provides a mechanism to handle this through the use of a variable pool, which stores variables, files, etc., generated during the tool's operation. This allows tools to cooperate with each other and avoid conflicts. For example, you can save the output of one tool to the variable pool and then use it as input for another tool, ensuring a sequential execution: # Example: Saving the output of the first tool to the variable pool
result.append(self.create_blob_message(blob=b64decode(image.b64_json),
meta={ 'mime_type': 'image/png' },
save_as=self.VARIABLE_KEY.IMAGE.value))
# Example: Retrieving the output from the variable pool for the second tool
image_binary = self.get_variable_file(self.VARIABLE_KEY.IMAGE)
if not image_binary:
return self.create_text_message('Image not found, please request user to generate image firstly.') This approach ensures that tools are invoked in a sequence, preventing simultaneous execution errors and maintaining the required conversation flow [1]. Additionally, ensure that your conversation logic explicitly alternates between user and assistant roles to comply with the validation requirements. |
Claude does not support system role. Try to switch to another one. |
I'm using Claude from Bedrock, and this issue is caused by calling two different tools simultaneously, right? When I used it before, writing it this way didn't cause any problems. |
We have a PR 2 days ago. #8317 maybe you can check with @ybalbert001 |
I'm not using a Bedrock cross-region inference model. |
@YYyp99 how to reproduce you problem? share DSL? |
|
Self Checks
Dify version
0.8.2
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
When I use the search tool and the web scraping tool, it uses them together, calling both tools simultaneously. Afterwards, the LLM throws an error. [bedrock] Error: ValidationException: A conversation must alternate between user and assistant roles. Make sure the conversation alternates between user and assistant roles and try again.
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
The text was updated successfully, but these errors were encountered: