Fix: a1 agent pass empty message to AWSbedrock error#182
Open
changwn wants to merge 2 commits intosnap-stanford:mainfrom
Open
Fix: a1 agent pass empty message to AWSbedrock error#182changwn wants to merge 2 commits intosnap-stanford:mainfrom
changwn wants to merge 2 commits intosnap-stanford:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Problem
Had intermittent error triggered by AWS Bedrock service as a local deployment. The error, showed as the issue 172, is a bug which will trigger error by bedrock server. When auto
Human MessagerepliesEach response must include thinking process followed by either <execute> or <solution> tag. But there are no tags in the current response. Please follow the instruction, fix and regenerate the response again, the Biomni agent actually sent the empty content to bedrock API which causes error.2. Solution:
I added a new helper function named
sanitize_messagesto clean the message and ensure it doesn't send empty message to bedrock. Note, I did NOT test the script on other LLM models since I only have access to AWS bedrock. It solved the error when calling AWS bedrock.2a) Call sanitize_message in generate function:
3. Need attention:
Although this sanitize function may fix the bug, I found there is a logic problem in the agent (
generatefunction ina1.py). Sometime, theAi Messagewill provide<observation> xxx </observation>instead of<solution>. The example in issue 172 that let the agent to list files in current directory and the agent replied with tag<observation>. However, the logic ingeneratefunction will only end the process when the response includes<solution>. Please consider addingobservationin the ifelse loop to guide the agent for next step action.4. Note:
Fixes #172 as requested.