@@ -14,10 +14,10 @@ AI assistants need context from previous messages to provide coherent responses.
14
14
15
15
``` redis:[run_confirmation=true] Store conversation history
16
16
// Add user message to session
17
- LPUSH user:alice:history:session_001 '{"type": "human", "content": "What's the weather like?", "timestamp": 1717935001}'
17
+ LPUSH user:alice:history:session_001 '{"type": "human", "content": "What is the weather like?", "timestamp": 1717935001}'
18
18
19
19
// Add AI response
20
- LPUSH user:alice:history:session_001 '{"type": "ai", "content": "It's sunny with 75°F temperature.", "timestamp": 1717935002}'
20
+ LPUSH user:alice:history:session_001 '{"type": "ai", "content": "It is sunny with 75°F temperature.", "timestamp": 1717935002}'
21
21
22
22
// Add another user message
23
23
LPUSH user:alice:history:session_001 '{"type": "human", "content": "Should I bring an umbrella?", "timestamp": 1717935003}'
@@ -73,7 +73,7 @@ The `HINCR` command allows you to atomically increment the counter, preventing r
73
73
74
74
``` redis:[run_confirmation=true] Increment Requests
75
75
// Increment request counter
76
- HINCR user:alice:rate_limit requests_per_minute
76
+ HINCRBY user:alice:rate_limit requests_per_minute 1
77
77
78
78
// Check if field exists and get count
79
79
HEXISTS user:alice:rate_limit requests_per_minute
@@ -164,7 +164,7 @@ FT.SEARCH idx:knowledge
164
164
FT.SEARCH idx:knowledge
165
165
"(@user_id:{alice} @timestamp:[1717935000 +inf]) => [KNN 5 @embedding $vec AS score]"
166
166
PARAMS 2 vec "\x3f\x80\x00\x00\x40\x40\x00\x00\x40\x00\x00\x00\x3f\x40\x00\x00\x40\x80\x00\x00\x40\x20\x00\x00\x3f\x00\x00\x00\x40\x60\x00\x00"
167
- RETURN 4 content timestamp score
167
+ RETURN 3 content timestamp score
168
168
SORTBY score ASC
169
169
DIALECT 2
170
170
```
0 commit comments