Skip to content

Commit 96a1e2a

Browse files
committed
Fix notebook failures: remove non-existent memory_index_name and metadata references
- Remove redis_config.memory_index_name reference (memory is now handled by Agent Memory Server) - Remove metadata parameter from ClientMemoryRecord (not supported in agent-memory-client) - Remove code trying to access memory.metadata on MemoryRecordResult - Update documentation to reference topics instead of metadata - Display topics in memory search results instead of metadata
1 parent a9b8a7a commit 96a1e2a

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

python-recipes/context-engineering/notebooks/section-1-introduction/02_role_of_context_engine.ipynb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@
132132
" # Show configured indexes\n",
133133
" print(f\"\\n🗂️ Vector Indexes:\")\n",
134134
" print(f\" • Course Catalog: {redis_config.vector_index_name}\")\n",
135-
" print(f\" • Agent Memory: {redis_config.memory_index_name}\")\n",
135+
" print(f\" • Agent Memory: Managed by Agent Memory Server\")\n",
136136
" \n",
137137
" # Show data types in use\n",
138138
" print(f\"\\n📋 Data Types in Use:\")\n",
139-
" print(f\" • Hashes: Course and memory storage\")\n",
139+
" print(f\" • Hashes: Course storage\")\n",
140140
" print(f\" • Vectors: Semantic embeddings (1536 dimensions)\")\n",
141141
" print(f\" • Strings: Simple key-value pairs\")\n",
142142
" print(f\" • Sets: Tags and categories\")\n",
@@ -149,7 +149,6 @@
149149
" class MockRedisConfig:\n",
150150
" def __init__(self):\n",
151151
" self.vector_index_name = \"course_catalog_index\"\n",
152-
" self.memory_index_name = \"agent_memory_index\"\n",
153152
" \n",
154153
" def health_check(self):\n",
155154
" return False # Simulate Redis not available in CI\n",

python-recipes/context-engineering/notebooks/section-3-memory/02_long_term_memory.ipynb

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -209,22 +209,19 @@
209209
"await memory_client.create_long_term_memory([ClientMemoryRecord(\n",
210210
" text=\"Student enrolled in CS101: Introduction to Programming on 2024-09-01\",\n",
211211
" memory_type=\"episodic\",\n",
212-
" topics=[\"enrollment\", \"courses\"],\n",
213-
" metadata={\"course_code\": \"CS101\", \"date\": \"2024-09-01\"}\n",
212+
" topics=[\"enrollment\", \"courses\", \"CS101\"]\n",
214213
")])\n",
215214
"\n",
216215
"await memory_client.create_long_term_memory([ClientMemoryRecord(\n",
217216
" text=\"Student completed CS101 with grade A on 2024-12-15\",\n",
218217
" memory_type=\"episodic\",\n",
219-
" topics=[\"completion\", \"grades\"],\n",
220-
" metadata={\"course_code\": \"CS101\", \"grade\": \"A\", \"date\": \"2024-12-15\"}\n",
218+
" topics=[\"completion\", \"grades\", \"CS101\"]\n",
221219
")])\n",
222220
"\n",
223221
"await memory_client.create_long_term_memory([ClientMemoryRecord(\n",
224222
" text=\"Student asked about machine learning courses on 2024-09-20\",\n",
225223
" memory_type=\"episodic\",\n",
226-
" topics=[\"inquiry\", \"machine_learning\"],\n",
227-
" metadata={\"date\": \"2024-09-20\"}\n",
224+
" topics=[\"inquiry\", \"machine_learning\"]\n",
228225
")])\n",
229226
"\n",
230227
"print(\"✅ Stored 3 episodic memories (events and experiences)\")"
@@ -292,9 +289,7 @@
292289
"\n",
293290
"for i, memory in enumerate(results.memories, 1):\n",
294291
" print(f\"{i}. {memory.text}\")\n",
295-
" print(f\" Type: {memory.memory_type}\")\n",
296-
" if memory.metadata:\n",
297-
" print(f\" Metadata: {memory.metadata}\")\n",
292+
" print(f\" Type: {memory.memory_type} | Topics: {', '.join(memory.topics or [])}\")\n",
298293
" print()"
299294
]
300295
},
@@ -418,8 +413,7 @@
418413
"\n",
419414
"for i, memory in enumerate(results.memories, 1):\n",
420415
" print(f\"{i}. {memory.text}\")\n",
421-
" if memory.metadata:\n",
422-
" print(f\" Metadata: {memory.metadata}\")\n",
416+
" print(f\" Topics: {', '.join(memory.topics or [])}\")\n",
423417
" print()"
424418
]
425419
},
@@ -462,9 +456,9 @@
462456
"\n",
463457
"### Best Practices\n",
464458
"\n",
465-
"1. **Use descriptive topics** - Makes filtering easier\n",
466-
"2. **Add metadata** - Especially for episodic memories\n",
467-
"3. **Write clear memory text** - Will be searched semantically\n",
459+
"1. **Use descriptive topics** - Makes filtering and categorization easier\n",
460+
"2. **Write clear memory text** - Will be searched semantically\n",
461+
"3. **Include relevant details in text** - Dates, names, and context help with retrieval\n",
468462
"4. **Let deduplication work** - Don't worry about duplicates\n",
469463
"5. **Search before storing** - Check if similar memory exists"
470464
]
@@ -479,7 +473,7 @@
479473
"\n",
480474
"2. **Test semantic search**: Create memories with different wordings but similar meanings. Search with various queries to see what matches.\n",
481475
"\n",
482-
"3. **Explore metadata**: Add rich metadata to episodic memories. How can you use this in your agent?\n",
476+
"3. **Explore topics**: Add rich topics to episodic memories. How can you use topic filtering in your agent?\n",
483477
"\n",
484478
"4. **Cross-session test**: Create a memory, close the notebook, restart, and verify the memory persists."
485479
]

0 commit comments

Comments
 (0)