AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Fix agent key error

Open jacobtohahn opened this issue 2 years ago • 2 comments

Background

If AutoGPT attempted to use message_agent with the key as a string [STRING], the command would return "Error: invalid literal for int() with base 10: '[STRING]'". This confused the AI and could lead to loops or JSON errors.

Changes

Before, the message_agent function in commands.py allowed the key to be a string, generating the error described above. The message_agent function has been modified to only allow the key to be an integer, returning "Invalid key, must be an integer." if it is not.

Documentation

Test Plan

The changes were tested by using human feedback to instruct the agent to use a string as a key, and verifying the command returned "Invalid key, must be an integer." if it was. The agent was then allowed to use an integer as a key, which produced the expected result.

PR Quality Checklist

  • [x] My pull request is atomic and focuses on a single change.
  • [x] I have thoroughly tested my changes with multiple different prompts.
  • [x] I have considered potential risks and mitigations for my changes.
  • [x] I have documented my changes clearly and comprehensively.
  • [x] I have not snuck in any "extra" small tweaks changes

jacobtohahn avatar Apr 15 '23 08:04 jacobtohahn

@nponeccop replacement for #1341

jacobtohahn avatar Apr 15 '23 08:04 jacobtohahn

@jacobtohahn There are conflicts now

nponeccop avatar Apr 15 '23 13:04 nponeccop

@nponeccop thanks for the heads up, just resolved them

jacobtohahn avatar Apr 15 '23 16:04 jacobtohahn