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

Improve Key Validation and Handling in Overwrite Memory and Message Agent Functions #208

Merged
merged 4 commits into from
Apr 6, 2023
Merged

Improve Key Validation and Handling in Overwrite Memory and Message Agent Functions #208

merged 4 commits into from
Apr 6, 2023

Conversation

slavakurilyak
Copy link
Contributor

This pull request introduces improvements to key validation and handling in the overwrite_memory and message_agent functions within the scripts/commands.py file.

Changes include:

  • Adding a new helper function is_valid_int to check if a value can be converted to an integer.
  • Updating the overwrite_memory function to handle both integer and string keys, and providing more informative error messages.
  • Updating the message_agent function to use the is_valid_int helper function for key validation and providing an informative error message for invalid keys.

These changes aim to make the code more robust and user-friendly, allowing for better handling of different key types and more informative error messages when invalid keys are encountered.

@ryanmac
Copy link
Contributor

ryanmac commented Apr 4, 2023

See also PR #105

elif isinstance(key, str):
_text = "Overwriting memory with key " + key + " and string " + string
# Overwrite the memory slot with the given string key and string
mem.string_key_memory[key] = string
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of saving on this attribute if it is not used anywhere else?

Copy link
Member

@Torantulino Torantulino Apr 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SYSTEM: Command memory_ovr returned: Error: module 'memory' has no attribute 'string_key_memory'

More importantly, that doesn't even seem to be an existing attribute.

scripts/commands.py Outdated Show resolved Hide resolved
Fixes:
```Command memory_ovr returned: Error: module 'memory' has no attribute 'string_key_memory'```
scripts/commands.py Outdated Show resolved Hide resolved
@Torantulino Torantulino merged commit c92eebc into Significant-Gravitas:master Apr 6, 2023
@Torantulino Torantulino mentioned this pull request Apr 6, 2023
@Torantulino
Copy link
Member

Fixes #90

@slavakurilyak slavakurilyak deleted the add_is_valid_int_and_key_validation branch April 6, 2023 13:18
Say383 pushed a commit to Say383/Auto-GPT that referenced this pull request Sep 8, 2023
Signed-off-by: Merwane Hamadi <merwanehamadi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants