Spaces:
Sleeping
Sleeping
File size: 3,119 Bytes
becfaf4 d6adae3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | ---
title: MemoryMind
emoji: π§
colorFrom: blue
colorTo: green
sdk: docker
app_file: app.py
pinned: false
---
# MemoryMind β The Chatbot That Actually Remembers You
Most chatbots forget everything the moment you close the tab. MemoryMind doesn't.
It extracts facts from your conversation, stores them permanently, and uses them in future sessions β even weeks later. A live memory panel shows exactly what the bot knows about you, which memories it used in the last response, and lets you wipe everything with a single button.
---
## Features
- **Persistent memory** β facts survive browser refresh, app restarts, and new sessions
- **Semantic retrieval** β finds relevant memories by meaning, not just keywords
- **Memory correction** β say "actually I moved to Berlin" and it updates the old entry
- **Deduplication** β never stores the same fact twice
- **Memory panel** β live sidebar showing all stored facts, timestamps, and usage counts
- **Highlighted memories** β see exactly which memories informed each response
- **Reset button** β wipe all memory and start fresh (great for demos)
---
## Tech Stack
| Layer | Tool |
|---|---|
| LLM | Groq API β Llama 3.3 70B |
| Memory Store | ChromaDB (local, persistent) |
| Embeddings | sentence-transformers `all-MiniLM-L6-v2` |
| Frontend | Streamlit |
| Hosting | Hugging Face Spaces |
| Language | Python 3.11+ |
---
## Project Structure
```
βββ app.py # Streamlit UI + memory sidebar
βββ chatbot.py # LLM calls, prompt building, contradiction detection
βββ memory.py # ChromaDB store, retrieve, deduplicate, correct
βββ extractor.py # Fact extraction via second LLM call
βββ requirements.txt
βββ .env # GROQ_API_KEY (never committed)
```
---
## How Memory Works
```
User message
β
Retrieve top-5 relevant memories (semantic search on ChromaDB)
β
Build prompt: system + memories + chat history + user message
β
Groq LLM β response
β
Extract new facts from the exchange
β
Deduplicate β check for contradictions β store or correct
β
Render response + updated memory panel
```
---
## Setup
**1. Clone the repo**
```bash
git clone https://github.com/satomustar/Memorymind-Chatbot.git
cd Memorymind-Chatbot
```
**2. Create a virtual environment**
```bash
python3 -m venv .venv
source .venv/bin/activate
```
**3. Install dependencies**
```bash
pip install -r requirements.txt
```
**4. Add your Groq API key**
Create a `.env` file:
```
GROQ_API_KEY=your_key_here
```
Get a free key at [console.groq.com](https://console.groq.com).
**5. Run the app**
```bash
streamlit run app.py
```
---
## Testing
Test the memory core and chat logic without the UI:
```bash
# Test memory storage, retrieval, and deduplication
python test_extractor.py
# Interactive terminal chat
python chatbot.py
```
---
## Roadmap
- [ ] FastAPI backend (decouple UI from logic)
- [ ] Multi-user support with per-user memory namespaces
- [ ] Memory decay scoring (stale facts fade out)
- [ ] Deploy to Hugging Face Spaces
|