@@ -360,14 +360,23 @@ async def search_long_term_memory(
360
360
search_long_term_memory(text="user's favorite color")
361
361
```
362
362
363
- 2. Search with simple session filter:
363
+ 2. Get ALL memories for a user (e.g., "what do you remember about me?"):
364
+ ```python
365
+ search_long_term_memory(
366
+ text="", # Empty string returns all memories for the user
367
+ user_id={"eq": "user_123"},
368
+ limit=50 # Adjust based on how many memories you want
369
+ )
370
+ ```
371
+
372
+ 3. Search with simple session filter:
364
373
```python
365
374
search_long_term_memory(text="user's favorite color", session_id={
366
375
"eq": "session_12345"
367
376
})
368
377
```
369
378
370
- 3 . Search with complex filters:
379
+ 4 . Search with complex filters:
371
380
```python
372
381
search_long_term_memory(
373
382
text="user preferences",
@@ -381,7 +390,7 @@ async def search_long_term_memory(
381
390
)
382
391
```
383
392
384
- 4 . Search with datetime range filters:
393
+ 5 . Search with datetime range filters:
385
394
```python
386
395
search_long_term_memory(
387
396
text="recent conversations",
@@ -395,7 +404,7 @@ async def search_long_term_memory(
395
404
)
396
405
```
397
406
398
- 5 . Search with between datetime filter:
407
+ 6 . Search with between datetime filter:
399
408
```python
400
409
search_long_term_memory(
401
410
text="holiday discussions",
@@ -406,7 +415,7 @@ async def search_long_term_memory(
406
415
```
407
416
408
417
Args:
409
- text: The semantic search query text (required)
418
+ text: The semantic search query text (required). Use empty string "" to get all memories for a user.
410
419
session_id: Filter by session ID
411
420
namespace: Filter by namespace
412
421
topics: Filter by topics
@@ -482,20 +491,14 @@ async def memory_prompt(
482
491
"""
483
492
Hydrate a user query with relevant session history and long-term memories.
484
493
485
- CRITICAL: Use this tool for EVERY question that might benefit from memory context,
486
- especially when you don't have sufficient information to answer confidently.
487
-
488
494
This tool enriches the user's query by retrieving:
489
495
1. Context from the current conversation session
490
496
2. Relevant long-term memories related to the query
491
497
492
- ALWAYS use this tool when:
493
- - The user references past conversations
494
- - The question is about user preferences or personal information
495
- - You need additional context to provide a complete answer
496
- - The question seems to assume information you don't have in current context
498
+ The tool returns both the relevant memories AND the user's query in a format ready for
499
+ generating comprehensive responses.
497
500
498
- The function uses the text field from the payload as the user's query,
501
+ The function uses the query field from the payload as the user's query,
499
502
and any filters to retrieve relevant memories.
500
503
501
504
DATETIME INPUT FORMAT:
@@ -512,12 +515,20 @@ async def memory_prompt(
512
515
COMMON USAGE PATTERNS:
513
516
```python
514
517
1. Hydrate a user prompt with long-term memory search:
515
- hydrate_memory_prompt(text="What was my favorite color?")
518
+ memory_prompt(query="What was my favorite color?")
519
+ ```
520
+
521
+ 2. Answer "what do you remember about me?" type questions:
522
+ memory_prompt(
523
+ query="What do you remember about me?",
524
+ user_id={"eq": "user_123"},
525
+ limit=50
526
+ )
516
527
```
517
528
518
- 2 . Hydrate a user prompt with long-term memory search and session filter:
519
- hydrate_memory_prompt (
520
- text ="What is my favorite color?",
529
+ 3 . Hydrate a user prompt with long-term memory search and session filter:
530
+ memory_prompt (
531
+ query ="What is my favorite color?",
521
532
session_id={
522
533
"eq": "session_12345"
523
534
},
@@ -526,9 +537,9 @@ async def memory_prompt(
526
537
}
527
538
)
528
539
529
- 3 . Hydrate a user prompt with long-term memory search and complex filters:
530
- hydrate_memory_prompt (
531
- text ="What was my favorite color?",
540
+ 4 . Hydrate a user prompt with long-term memory search and complex filters:
541
+ memory_prompt (
542
+ query ="What was my favorite color?",
532
543
topics={
533
544
"any": ["preferences", "settings"]
534
545
},
@@ -538,9 +549,9 @@ async def memory_prompt(
538
549
limit=5
539
550
)
540
551
541
- 4 . Search with datetime range filters:
542
- hydrate_memory_prompt (
543
- text ="What did we discuss recently?",
552
+ 5 . Search with datetime range filters:
553
+ memory_prompt (
554
+ query ="What did we discuss recently?",
544
555
created_at={
545
556
"gte": "2024-01-01T00:00:00Z",
546
557
"lt": "2024-02-01T00:00:00Z"
@@ -552,7 +563,7 @@ async def memory_prompt(
552
563
```
553
564
554
565
Args:
555
- - text : The user's query
566
+ - query : The user's query
556
567
- session_id: Add conversation history from a working memory session
557
568
- namespace: Filter session and long-term memory namespace
558
569
- topics: Search for long-term memories matching topics
0 commit comments