File size: 2,494 Bytes
3782a7c
 
 
 
 
 
 
 
 
 
 
25fecf4
3782a7c
25fecf4
3782a7c
25fecf4
 
 
3782a7c
 
 
 
 
25fecf4
3782a7c
25fecf4
3782a7c
 
 
 
25fecf4
3782a7c
25fecf4
3782a7c
 
25fecf4
3782a7c
 
 
 
25fecf4
3782a7c
25fecf4
3782a7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25fecf4
 
3782a7c
25fecf4
3782a7c
 
25fecf4
3782a7c
 
 
 
25fecf4
3782a7c
 
 
25fecf4
3782a7c
25fecf4
3782a7c
 
 
25fecf4
3782a7c
25fecf4
 
ccfefe0
3782a7c
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
---
title: Matrix AI Chat with RAG
emoji: ๐Ÿ•ถ๏ธ
colorFrom: gray
colorTo: green
sdk: streamlit
sdk_version: 1.28.0
app_file: app.py
pinned: false
license: mit
---

# ๐Ÿ•ถ๏ธ Matrix AI Chat with RAG

**Enter the Matrix** - Advanced AI chat with Retrieval-Augmented Generation (RAG) and multiple AI models.

## โœจ Features

- **Multi-Model Support**: DeepSeek-R1, Llama-3.2-3B, Qwen2.5-VL-7B
- **RAG System**: Upload documents for context-aware responses
- **Matrix UI**: Cyberpunk green-on-black theme with animations
- **Smart Memory**: Persistent chat history and similarity search
- **Session Management**: Save/load conversations with unique IDs

## ๐Ÿš€ Quick Start

1. **Set HF Token**: Add your Hugging Face token in Space settings
2. **Select Model**: Choose from available AI models in sidebar
3. **Chat**: Start conversing with Matrix-style streaming
4. **Upload Data**: Add documents via "KNOWLEDGE MATRIX" section

## ๐Ÿ”ง Configuration

### Required Environment Variables
- `HF_TOKEN`: Your Hugging Face API token with inference access

### Supported Models
- **DeepSeek-R1**: Advanced reasoning (Together AI)
- **Llama-3.2-3B**: Efficient local model
- **Qwen2.5-VL-7B**: Vision-language model (Hyperbolic)

## ๐Ÿ“‹ Usage

### Basic Chat
1. Select AI model from sidebar
2. Enter message in chat input
3. Watch Matrix-style streaming response

### RAG Documents
1. Open "UPLOAD DATA" in sidebar
2. Add title and content
3. Click "INJECT DATA"
4. AI will reference your documents automatically

### Session Controls
- **NEW JACK IN**: Start fresh session
- **PURGE ALL**: Clear all data (double-click to confirm)

## ๐Ÿ› ๏ธ Local Development

```bash
# Clone and install
git clone <repo-url>
pip install streamlit numpy sentence-transformers scikit-learn transformers torch huggingface-hub openai

# Set token and run
export HF_TOKEN="your_token_here"
streamlit run app.py
```

## ๐Ÿšจ Troubleshooting

**No HF Token Found**
- Add `HF_TOKEN` to Space settings โ†’ Repository secrets

**Model Connection Failed**
- Check token validity and quota
- Verify internet connection
- Try different model

**Data Not Saving**
- Ensure sufficient storage space
- Check write permissions

## ๐Ÿ“ Data Storage

- `data/sessions/`: Chat history and metadata
- `data/documents/`: RAG documents and embeddings
- `data/embeddings/`: Vector embeddings for similarity search

All data persists between sessions. Use "PURGE ALL" to reset.

---

*Welcome to the Matrix. The choice is yours.* ๐Ÿ•ถ๏ธ