mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-19 06:54:22 +01:00
Memory fixes.
This commit is contained in:
@@ -44,6 +44,8 @@ class LocalCache(MemoryProviderSingleton):
|
|||||||
|
|
||||||
Returns: None
|
Returns: None
|
||||||
"""
|
"""
|
||||||
|
if 'Command Error:' in text:
|
||||||
|
return ""
|
||||||
self.data.texts.append(text)
|
self.data.texts.append(text)
|
||||||
|
|
||||||
embedding = get_ada_embedding(text)
|
embedding = get_ada_embedding(text)
|
||||||
@@ -64,6 +66,7 @@ class LocalCache(MemoryProviderSingleton):
|
|||||||
option=SAVE_OPTIONS
|
option=SAVE_OPTIONS
|
||||||
)
|
)
|
||||||
f.write(out)
|
f.write(out)
|
||||||
|
return text
|
||||||
|
|
||||||
def clear(self) -> str:
|
def clear(self) -> str:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ class RedisMemory(MemoryProviderSingleton):
|
|||||||
|
|
||||||
Returns: Message indicating that the data has been added.
|
Returns: Message indicating that the data has been added.
|
||||||
"""
|
"""
|
||||||
|
if 'Command Error:' in data:
|
||||||
|
return ""
|
||||||
vector = get_ada_embedding(data)
|
vector = get_ada_embedding(data)
|
||||||
vector = np.array(vector).astype(np.float32).tobytes()
|
vector = np.array(vector).astype(np.float32).tobytes()
|
||||||
data_dict = {
|
data_dict = {
|
||||||
@@ -132,7 +134,7 @@ class RedisMemory(MemoryProviderSingleton):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Error calling Redis search: ", e)
|
print("Error calling Redis search: ", e)
|
||||||
return None
|
return None
|
||||||
return list(results.docs)
|
return [result.data for result in results.docs]
|
||||||
|
|
||||||
def get_stats(self):
|
def get_stats(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user