Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Remove least relevant items from memory first

Fariz Rahman4f3bb609df26
diff --git a/autogpt/chat.py b/autogpt/chat.py
index b08869679d..1f6bca96eb 100644
--- a/autogpt/chat.py
+++ b/autogpt/chat.py
@@ -96,7 +96,7 @@ def chat_with_ai(
while current_tokens_used > 2500:
# remove memories until we are under 2500 tokens
- relevant_memory = relevant_memory[1:]
+ relevant_memory = relevant_memory[:-1]
(
next_message_to_add_index,
current_tokens_used,