An intelligent conversational AI assistant built with Streamlit, Groq LLM API, and Mem0 Cloud Platform. Unlike traditional stateless chatbots that forget everything when refreshed, this chatbot automatically extracts, stores, and recalls user facts, preferences, and personal details across past conversations and application restarts.
- GitHub Repo: https://github.com/Arslan-Codes097/Persistent-Memory-AI-Chatbot
- Live APP: https://persistent-memory-ai-chatbot.streamlit.app/
- 🧠 Persistent Long-Term Memory: Integrates Mem0 Cloud Platform to store user facts across sessions and app reboots.
- ⚡ Dynamic Context Injection: Automatically searches and injects relevant user memories into system instructions before generating LLM responses.
- 🔄 Semantic Memory Deduplication & Overwrite: Updates outdated facts automatically (e.g., updating user age from 25 to 26 without creating duplicate entries).
- 👤 Multi-User Isolation: Switch profiles seamlessly using the Your Name sidebar control to maintain distinct, isolated memory stores.
- 🔍 Live Memory Inspector: Inspect stored facts in real-time or delete them using sidebar controls (Refresh & Clear All).
- 🚀 Streamlit Cloud Compatible: Uses cloud-managed Mem0 Platform API so memory never dies even on ephemeral host runtimes.
| Category | Technology | Purpose / Role |
|---|---|---|
| Frontend UI | Streamlit | Responsive, stateful chatbot user interface |
| LLM Backend | Groq API (llama-3.3-70b-versatile) |
Ultra-fast LLM response streaming |
| Memory Engine | Mem0 Cloud Platform (mem0ai) |
Graph/Vector fact extraction & semantic memory recall |
| Language & Env | Python 3.9+ / python-dotenv |
Core application logic and environment variables management |
- User Query Input: User sends a message via Streamlit chat UI.
- User Identity Normalization: Converts user name into a sanitized slug for scoping memories.
- Memory Retrieval: Queries Mem0 Cloud Platform for relevant memories using standard v2 filters (
filters={'user_id': user_id}). - Context Injection: Formats retrieved facts into system prompt instructions.
- LLM Generation: Calls Groq API to stream natural, personalized responses back to the user.
- Background Memory Extraction: Asynchronously pushes the conversation turn to Mem0 for automated fact extraction and semantic updates.
flowchart TD
A[User Input via Streamlit UI] --> B[Normalize User Profile Name]
B --> C[MemoryHandler: Query Mem0 Cloud Filters]
C --> D[LLMConnector: Prepend Memories into System Prompt]
D --> E[Groq API: Stream Chat Response]
E --> F[MemoryHandler: Push Interaction to Mem0]
F --> G[Mem0 Cloud: Semantic Extraction & Fact Deduplication]
Persistent-Memory-AI-Chatbot/
├── assets/
│ ├── streamlit_chatbot_ui.png # Screenshot of Streamlit application UI
│ └── mem0_dashboard_proof.png # Screenshot of Mem0 Cloud Dashboard proof
├── app.py # Main Streamlit UI & chat orchestration
├── memory_handler.py # Direct Mem0 Platform v2 API integration
├── llm_connector.py # Groq API streaming connector & context injector
├── .env # Local environment secrets (GROQ_API_KEY & MEM0_API_KEY)
├── requirements.txt # Project dependencies
└── README.md # Project documentation
- Python 3.9+
- Groq API Key (console.groq.com)
- Mem0 API Key (app.mem0.ai)
git clone https://github.com/Arslan-Codes097/Persistent-Memory-AI-Chatbot.git
cd Persistent-Memory-AI-Chatbotpip install -r requirements.txtCreate a .env file in the root directory:
GROQ_API_KEY=your_groq_api_key_here
MEM0_API_KEY=your_mem0_api_key_herestreamlit run app.pyDeveloped by Arslan Babar
- GitHub: @Arslan-Codes097
- Project Repository: Persistent-Memory-AI-Chatbot

