mirror of
https://github.com/Shubhamsaboo/awesome-llm-apps.git
synced 2026-07-15 15:03:51 -05:00
[GH-ISSUE #449] Bug: Variable name conflict in Streamlit chat loop overwrites Memory object in ai travel agent with memory #1050
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Veeksha-c on GitHub (Jan 31, 2026).
Original GitHub issue: https://github.com/Shubhamsaboo/awesome-llm-apps/issues/449
In the provided Streamlit example for the AI Travel Agent, the loop variable used to display memories uses the same name as the initialized Memory object from the mem0 library. This causes a NameError or AttributeError when the script later tries to call memory.add(), as the original object has been overwritten by a dictionary/string from the loop.
The 'memory' variable here overwrites the 'memory = Memory.from_config(config)' object
for memory in relevant_memories["results"]:
if "memory" in memory:
context += f"- {memory['memory']}\n"
Suggested Fix
Rename the loop variable to mem or result to preserve the global memory object:
Python
for mem in relevant_memories["results"]:
if "memory" in mem:
context += f"- {mem['memory']}\n"
Additional Context
I am a student currently learning about Agentic AI and found this while testing the implementation locally with Docker. Thank you for maintaining this repository!
@Shubhamsaboo commented on GitHub (Feb 1, 2026):
Thank you for pointing it out. Just got it fixed.