memorymind / README.md
killbizz's picture
fix: add HF Spaces metadata to README
becfaf4
|
Raw History Blame Contribute Delete
3.12 kB
---
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