-
Notifications
You must be signed in to change notification settings - Fork 44.2k
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
Command memory_ovr returned: Error: invalid literal for int() with base 10: 'clariontech_blog' #90
Comments
Getting the same error. My "project" is stuck in an infinite loop. Looks something like this: ←[36mNEXT ACTION: ←[0mCOMMAND = ←[36mmemory_ovr←[0m ARGUMENTS = ←[36m{'key': 'available_frameworks', 'string': '1. TensorFlow\n2. Keras-RL\n3. PyTorch\n4. RLlib\n5. Dopamine\n\nWe will need to do further research and comparison to determine the best option for our purposes.'}←[0m |
I had a similar error but I think I was able to fix it by asking chatGPT with some of the pertaining code: Thanks for providing the code. The issue appears to be related to the use of int(key) in the overwrite_memory() function. The error occurs because you are trying to convert the key to an integer, but the value passed in as the argument is a string ('yelp_api_library'). To fix this issue, you should ensure that the value passed as the key argument is a valid integer. You can check if the value is a valid integer using the following method: def is_valid_int(value): def overwrite_memory(key, string): |
I'm running into the same error: Here's how I would fix it (inspired by @Josedapker). Open def is_valid_int(value):
try:
int(value)
return True
except ValueError:
return False Then update def overwrite_memory(key, string):
# Check if the key is a valid integer
if is_valid_int(key):
key_int = int(key)
# Check if the integer key is within the range of the permanent_memory list
if 0 <= key_int < len(mem.permanent_memory):
_text = "Overwriting memory with key " + str(key) + " and string " + string
# Overwrite the memory slot with the given integer key and string
mem.permanent_memory[key_int] = string
print(_text)
return _text
else:
print(f"Invalid key '{key}', out of range.")
return None
# Check if the key is a valid string
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
print(_text)
return _text
else:
print(f"Invalid key '{key}', must be an integer or a string.")
return None Update the def message_agent(key, message):
global cfg
# Check if the key is a valid integer
if not is_valid_int(key):
return "Invalid key, cannot message agent."
# Message the agent with the valid integer key
agent_response = agents.message_agent(int(key), message)
# Speak response if speak_mode is enabled
if cfg.speak_mode:
speak.say_text(agent_response, 1)
return f"Agent {key} responded: {agent_response}" TLDR;
|
@slavakurilyak Seems to have worked for me 👍 |
@ug02fast Please try again as I updated |
See pull request #208 |
Can't this be fixed just by using the the isinstance() function to check if the key argument is an instance of the int class before calling int() function? def overwrite_memory(key, string):
if isinstance(key, int) and key >= 0 and key < len(mem.permanent_memory):
_text = "Overwriting memory with key " + \
str(key) + " and string " + string
mem.permanent_memory[key] = string
print(_text)
return _text
else:
print("Invalid key, cannot overwrite memory.")
return None |
I am running these changes and still experiencing the same error.
|
The following would be a better fix:
|
how do i fix it |
No description provided.
The text was updated successfully, but these errors were encountered: