Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Slight code improvement

davidmezzettid6bd6fc4c69d
diff --git a/src/python/txtai/agent/base.py b/src/python/txtai/agent/base.py
index 57933642..df4095f7 100644
--- a/src/python/txtai/agent/base.py
+++ b/src/python/txtai/agent/base.py
@@ -70,13 +70,9 @@ class Agent:
self.process.model.parameters(maxlength)
# Create memory, if necessary
- if self.window and session not in self.memory:
+ if self.window and (session not in self.memory or reset):
self.memory[session] = deque(maxlen=self.window)
- # Clear memory, if reset flag set
- if reset and session in self.memory:
- self.memory[session].clear()
-
# Run agent loop
output = self.process.run(self.prompt(text, session), stream=stream, **kwargs)