mirror of
https://github.com/Shubhamsaboo/awesome-llm-apps.git
synced 2026-03-11 17:48:31 -05:00
fix: rename loop variable to avoid shadowing Memory object
Fixes #449 The loop variable 'memory' in the memory iteration was shadowing the Memory object from mem0, causing 'AttributeError: dict object has no attribute add' when memory.add() was called later. Renamed to 'mem' to match the pattern already used in other parts of the codebase. Affected files: - ai_travel_agent_memory/travel_agent_memory.py - multi_llm_memory/multi_llm_memory.py
This commit is contained in:
@@ -70,9 +70,9 @@ if openai_api_key:
|
||||
relevant_memories = memory.search(query=prompt, user_id=user_id)
|
||||
context = "Relevant past information:\n"
|
||||
if relevant_memories and "results" in relevant_memories:
|
||||
for memory in relevant_memories["results"]:
|
||||
if "memory" in memory:
|
||||
context += f"- {memory['memory']}\n"
|
||||
for mem in relevant_memories["results"]:
|
||||
if "memory" in mem:
|
||||
context += f"- {mem['memory']}\n"
|
||||
|
||||
# Prepare the full prompt
|
||||
full_prompt = f"{context}\nHuman: {prompt}\nAI:"
|
||||
|
||||
@@ -51,9 +51,9 @@ if openai_api_key and anthropic_api_key:
|
||||
relevant_memories = memory.search(query=prompt, user_id=user_id)
|
||||
context = "Relevant past information:\n"
|
||||
if relevant_memories and "results" in relevant_memories:
|
||||
for memory in relevant_memories["results"]:
|
||||
if "memory" in memory:
|
||||
context += f"- {memory['memory']}\n"
|
||||
for mem in relevant_memories["results"]:
|
||||
if "memory" in mem:
|
||||
context += f"- {mem['memory']}\n"
|
||||
|
||||
full_prompt = f"{context}\nHuman: {prompt}\nAI:"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user