Skip to content

Commit 22934e3

Browse files
Update personalized_recommendations.md
1 parent fbf3e89 commit 22934e3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/vss/personalized_recommendations.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ This tutorial demonstrates how to build an AI assistant's memory system with Red
22

33
**Note**: Requires [Redis 8](https://hub.docker.com/_/redis/tags) for `HSETEX`, which adds per-field TTL for hashes - ideal for rate limiting to ensure fair resource usage.
44

5-
### Architecture Overview
5+
### Architecture overview
66
| Layer | Description | Data type |
77
| ---------- | ---------- | ---------- |
88
| `Session History`| `Recent conversation context` | List |
99
| `Rate Limiting` | `Per-user request throttling` | Hash |
1010
| `User Memory` | `Long-term facts and preferences` | Hash |
1111

12-
### Session History
12+
### Session history
1313
AI assistants need context from previous messages to provide coherent responses. Without conversation history, each interaction would be isolated. Redis lists are simple, ordered, and efficient for storing chat transcripts.
1414

1515
```redis:[run_confirmation=true] Store conversation history
@@ -25,7 +25,7 @@ LPUSH user:alice:history:session_001 '{"type": "human", "content": "Should I bri
2525
// Add AI response
2626
LPUSH user:alice:history:session_001 '{"type": "ai", "content": "No umbrella needed today!", "timestamp": 1717935004}'
2727
```
28-
### Reading Conversation History
28+
### Reading conversation history
2929
You can retrieve recent messages to provide context to the AI.
3030

3131
```redis:[run_confirmation=no] Read conversation history
@@ -40,7 +40,7 @@ You may want to limit the size of history to retain only the N most recent items
4040
LTRIM user:alice:history:session_001 0 29 // keep only latest 30 items
4141
```
4242

43-
### Session Expiration
43+
### Session expiration
4444
Without expiration, session history will accumulate indefinitely. Expiring keys improves memory usage and ensures privacy.
4545

4646
```redis:[run_confirmation=true] Session expiration
@@ -57,7 +57,7 @@ TTL user:alice:history:session_001
5757
PERSIST user:alice:history:session_001
5858
```
5959

60-
### Rate Limiting
60+
### Rate limiting
6161
Rate limiting prevents abuse and ensures fair usage across users. Redis hashes with field-level TTL via `HSETEX` are ideal for this.
6262

6363
```redis:[run_confirmation=true] Initialize Rate Limiting
@@ -92,7 +92,7 @@ HSETEX user:alice:rate_limit EX 86400 FIELDS 1 requests_per_day 1
9292
HGETALL user:alice:rate_limit
9393
```
9494

95-
### User Memory (Persistent Preferences)
95+
### User memory (persistent preferences)
9696
AI assistants become more helpful when they remember user preferences, schedules, or relevant facts. This persistent memory enables personalization over time.
9797

9898
```redis:[run_confirmation=true] Store User Preferences
@@ -116,7 +116,7 @@ HSET user:alice:personal:002 user_id "alice" content "has a golden retriever nam
116116
HSET user:alice:personal:003 user_id "alice" content "married to Bob, two kids Sarah (8) and Tom (5)" importance 9 timestamp 1717935000 embedding "\x40\x60\x00\x00\x40\x00\x00\x00\x3f\x40\x00\x00\x40\x80\x00\x00\x40\x20\x00\x00\x3f\x80\x00\x00\x40\x40\x00\x00\x3f\x00\x00\x00"
117117
```
118118

119-
### Vector Search: Semantic Memory Recall
119+
### Vector search: semantic memory recall
120120
Semantic search allows AI to retrieve relevant memory even when exact keywords don't match. For example, a query about "meetings" might return facts about "morning appointments."
121121

122122
Indexing persistent memory (User Memory) for semantically meaningful search.
@@ -165,7 +165,7 @@ FT.SEARCH idx:preferences
165165
DIALECT 2
166166
```
167167

168-
### Memory State Monitoring
168+
### Memory state monitoring
169169
Understanding what's stored in memory helps debug issues, optimize performance, and ensure data quality. It's also essential for user privacy compliance.
170170
```redis:[run_confirmation=false] Monitor user sessions
171171
// Get approximate memory usage of session
@@ -175,7 +175,7 @@ MEMORY USAGE user:alice:history:session_001
175175
LLEN user:alice:history:session_001
176176
TTL user:alice:history:session_001
177177
```
178-
### Data Cleanup
178+
### Data cleanup
179179
Remove all data related to a user (e.g., for GDPR compliance).
180180

181181
```redis:[run_confirmation=true] Delete user data
@@ -194,7 +194,7 @@ DEL user:alice:work:002
194194
DEL user:alice:work:003
195195
```
196196

197-
### Next Steps
197+
### Next steps
198198
Now that your assistant has memory and meaning, you can:
199199
- Combine with RAG Pipelines
200200
- Use sentence-transformers to generate high-dimensional vectors

0 commit comments

Comments
 (0)