Skip to content

Commit 40c7dbf

Browse files
update deps and links
1 parent 1c3d826 commit 40c7dbf

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

python-recipes/agents/03_memory_agent.ipynb

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"## Short-term Memory\n",
4242
"The agent tracks chat history using Redis through LangGraph's [checkpointer](https://github.com/redis-developer/langgraph-redis). Each node in the graph (Retrieve Memories, Respond, Summarize) saves its state to Redis, including conversation history and thread metadata.\n",
4343
"\n",
44-
"<img src=\"resources/short-term-memory.png\" style=\"width: 100%; max-width: 400px;\">\n",
44+
"<img src=\"https://github.com/redis-developer/redis-ai-resources/blob/feat/update-memory-agent-recipe/python-recipes/agents/resources/short-term-memory.png?raw=true\" style=\"width: 100%; max-width: 400px;\">\n",
4545
"\n",
4646
"To prevent context window pollution, the agent summarizes conversations when they exceed a configurable length.\n",
4747
"\n",
@@ -51,11 +51,19 @@
5151
"- **Episodic**: User preferences and experiences\n",
5252
"- **Semantic**: General travel knowledge\n",
5353
"\n",
54-
"<img src=\"resources/long-term-memory.png\" style=\"width: 100%; max-width: 600px;\">\n",
54+
"<img src=\"https://github.com/redis-developer/redis-ai-resources/blob/feat/update-memory-agent-recipe/python-recipes/agents/resources/long-term-memory.png?raw=true\" style=\"width: 100%; max-width: 600px;\">\n",
5555
"\n",
5656
">**NOTE**: These memory types align with the [CoALA](https://arxiv.org/abs/2309.02427) paper's concepts. Our agent's procedural memory is encoded in its Python workflow."
5757
]
5858
},
59+
{
60+
"cell_type": "markdown",
61+
"metadata": {},
62+
"source": [
63+
"## Let's Begin\n",
64+
"<a href=\"https://colab.research.google.com/github/redis-developer/redis-ai-resources/blob/main/python-recipes/agents/03_memory_agent.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
65+
]
66+
},
5967
{
6068
"cell_type": "markdown",
6169
"metadata": {
@@ -79,7 +87,7 @@
7987
},
8088
"outputs": [],
8189
"source": [
82-
"%pip install langchain-openai langgraph-checkpoint langgraph langgraph-checkpoint-redis langchain-redis"
90+
"%pip install langchain-openai langgraph-checkpoint langgraph langgraph-checkpoint-redis pydantic"
8391
]
8492
},
8593
{
@@ -143,6 +151,8 @@
143151
},
144152
"outputs": [],
145153
"source": [
154+
"# NBVAL_SKIP\n",
155+
"\n",
146156
"%%sh\n",
147157
"curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg\n",
148158
"echo \"deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main\" | sudo tee /etc/apt/sources.list.d/redis.list\n",
@@ -581,8 +591,6 @@
581591
},
582592
"outputs": [],
583593
"source": [
584-
"\n",
585-
"\n",
586594
"from datetime import datetime\n",
587595
"from typing import List, Optional, Union\n",
588596
"\n",
@@ -751,7 +759,7 @@
751759
"\n",
752760
"> NOTE: **This tutorial uses tool-based memory** for optimal balance of control and efficiency.\n",
753761
"\n",
754-
"<img src=\"resources/memory-agents.png\" alt=\"Memory Agents Diagram\" width=\"250\">"
762+
"<img src=\"https://github.com/redis-developer/redis-ai-resources/blob/feat/update-memory-agent-recipe/python-recipes/agents/resources/memory-agents.png?raw=true\" alt=\"Memory Agents Diagram\" width=\"250\">"
755763
]
756764
},
757765
{
@@ -1145,7 +1153,6 @@
11451153
},
11461154
"outputs": [],
11471155
"source": [
1148-
"\n",
11491156
"from langchain_core.messages import HumanMessage\n",
11501157
"from langgraph.graph.message import MessagesState\n",
11511158
"\n",
@@ -1727,6 +1734,8 @@
17271734
}
17281735
],
17291736
"source": [
1737+
"# NBVAL_SKIP\n",
1738+
"\n",
17301739
"try:\n",
17311740
" user_id = input(\"Enter a user ID: \") or \"demo_user\"\n",
17321741
" thread_id = input(\"Enter a thread ID: \") or \"demo_thread\"\n",
@@ -1780,6 +1789,7 @@
17801789
}
17811790
],
17821791
"source": [
1792+
"# NBVAL_SKIP\n",
17831793
"res = retrieve_memories_tool.invoke({\"query\": \"Travel, activity, and dietary preferences\", \"memory_type\": [\"episodic\", \"semantic\"]})\n",
17841794
"res.split(\"\\n\")"
17851795
]

0 commit comments

Comments
 (0)