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 another global memory access

James Collins91aa40e0df66
diff --git a/autogpt/processing/text.py b/autogpt/processing/text.py
index 2122f0f06c..9946951a7c 100644
--- a/autogpt/processing/text.py
+++ b/autogpt/processing/text.py
@@ -10,7 +10,6 @@ from autogpt.llm_utils import create_chat_completion
from autogpt.memory import get_memory
CFG = Config()
-MEMORY = get_memory(CFG)
def split_text(
@@ -109,7 +108,8 @@ def summarize_text(
memory_to_add = f"Source: {url}\n" f"Raw content part#{i + 1}: {chunk}"
- MEMORY.add(memory_to_add)
+ memory = get_memory(CFG)
+ memory.add(memory_to_add)
messages = [create_message(chunk, question)]
tokens_for_chunk = token_counter.count_message_tokens(messages, model)
@@ -128,7 +128,7 @@ def summarize_text(
memory_to_add = f"Source: {url}\n" f"Content summary part#{i + 1}: {summary}"
- MEMORY.add(memory_to_add)
+ memory.add(memory_to_add)
print(f"Summarized {len(chunks)} chunks.")