Skip to content

Commit e872a04

Browse files
committed
docs(notebook): update create-react-agent notebooks
- Clear all outputs for clean execution on create-react-agent-memory.ipynb - Clear all outputs for clean execution on create-react-agent-hitl.ipynb - Ready for end-to-end execution with Redis checkpoint
1 parent aa54e21 commit e872a04

File tree

2 files changed

+17
-116
lines changed

2 files changed

+17
-116
lines changed

examples/create-react-agent-hitl.ipynb

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
},
5454
{
5555
"cell_type": "code",
56-
"execution_count": 1,
56+
"execution_count": null,
5757
"id": "a213e11a-5c62-4ddb-a707-490d91add383",
5858
"metadata": {},
5959
"outputs": [],
@@ -64,18 +64,10 @@
6464
},
6565
{
6666
"cell_type": "code",
67-
"execution_count": 2,
67+
"execution_count": null,
6868
"id": "23a1885c-04ab-4750-aefa-105891fddf3e",
6969
"metadata": {},
70-
"outputs": [
71-
{
72-
"name": "stdin",
73-
"output_type": "stream",
74-
"text": [
75-
"OPENAI_API_KEY: ········\n"
76-
]
77-
}
78-
],
70+
"outputs": [],
7971
"source": [
8072
"import getpass\n",
8173
"import os\n",
@@ -112,30 +104,10 @@
112104
},
113105
{
114106
"cell_type": "code",
115-
"execution_count": 3,
107+
"execution_count": null,
116108
"id": "7a154152-973e-4b5d-aa13-48c617744a4c",
117109
"metadata": {},
118-
"outputs": [
119-
{
120-
"name": "stdout",
121-
"output_type": "stream",
122-
"text": [
123-
"0.2.0\n",
124-
"02:38:15 langgraph.checkpoint.redis INFO Redis client is a standalone client\n",
125-
"02:38:15 redisvl.index.index INFO Index already exists, not overwriting.\n",
126-
"02:38:15 redisvl.index.index INFO Index already exists, not overwriting.\n",
127-
"02:38:15 redisvl.index.index INFO Index already exists, not overwriting.\n"
128-
]
129-
},
130-
{
131-
"name": "stderr",
132-
"output_type": "stream",
133-
"text": [
134-
"/tmp/ipykernel_519/104821471.py:41: LangGraphDeprecatedSinceV10: create_react_agent has been moved to `langchain.agents`. Please update your import to `from langchain.agents import create_agent`. Deprecated in LangGraph V1.0 to be removed in V2.0.\n",
135-
" graph = create_react_agent(\n"
136-
]
137-
}
138-
],
110+
"outputs": [],
139111
"source": [
140112
"# First we initialize the model we want to use.\n",
141113
"from langchain_openai import ChatOpenAI\n",
@@ -192,7 +164,7 @@
192164
},
193165
{
194166
"cell_type": "code",
195-
"execution_count": 4,
167+
"execution_count": null,
196168
"id": "16636975-5f2d-4dc7-ab8e-d0bea0830a28",
197169
"metadata": {},
198170
"outputs": [],

examples/create-react-agent-memory.ipynb

Lines changed: 11 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
},
5959
{
6060
"cell_type": "code",
61-
"execution_count": 1,
61+
"execution_count": null,
6262
"id": "a213e11a-5c62-4ddb-a707-490d91add383",
6363
"metadata": {},
6464
"outputs": [],
@@ -69,18 +69,10 @@
6969
},
7070
{
7171
"cell_type": "code",
72-
"execution_count": 2,
72+
"execution_count": null,
7373
"id": "23a1885c-04ab-4750-aefa-105891fddf3e",
7474
"metadata": {},
75-
"outputs": [
76-
{
77-
"name": "stdin",
78-
"output_type": "stream",
79-
"text": [
80-
"OPENAI_API_KEY: ········\n"
81-
]
82-
}
83-
],
75+
"outputs": [],
8476
"source": [
8577
"import getpass\n",
8678
"import os\n",
@@ -117,21 +109,10 @@
117109
},
118110
{
119111
"cell_type": "code",
120-
"execution_count": 3,
112+
"execution_count": null,
121113
"id": "7a154152-973e-4b5d-aa13-48c617744a4c",
122114
"metadata": {},
123-
"outputs": [
124-
{
125-
"name": "stdout",
126-
"output_type": "stream",
127-
"text": [
128-
"18:47:40 langgraph.checkpoint.redis INFO Redis client is a standalone client\n",
129-
"18:47:40 redisvl.index.index INFO Index already exists, not overwriting.\n",
130-
"18:47:40 redisvl.index.index INFO Index already exists, not overwriting.\n",
131-
"18:47:40 redisvl.index.index INFO Index already exists, not overwriting.\n"
132-
]
133-
}
134-
],
115+
"outputs": [],
135116
"source": [
136117
"# First we initialize the model we want to use.\n",
137118
"from langchain_openai import ChatOpenAI\n",
@@ -186,7 +167,7 @@
186167
},
187168
{
188169
"cell_type": "code",
189-
"execution_count": 4,
170+
"execution_count": null,
190171
"id": "16636975-5f2d-4dc7-ab8e-d0bea0830a28",
191172
"metadata": {},
192173
"outputs": [],
@@ -202,35 +183,10 @@
202183
},
203184
{
204185
"cell_type": "code",
205-
"execution_count": 5,
186+
"execution_count": null,
206187
"id": "9ffff6c3-a4f5-47c9-b51d-97caaee85cd6",
207188
"metadata": {},
208-
"outputs": [
209-
{
210-
"name": "stdout",
211-
"output_type": "stream",
212-
"text": [
213-
"================================\u001b[1m Human Message \u001b[0m=================================\n",
214-
"\n",
215-
"What's the weather in NYC?\n",
216-
"18:47:41 httpx INFO HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n",
217-
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
218-
"Tool Calls:\n",
219-
" get_weather (call_dszyH4rhcp3TcSjwI4iHLv4O)\n",
220-
" Call ID: call_dszyH4rhcp3TcSjwI4iHLv4O\n",
221-
" Args:\n",
222-
" location: New York City, NY\n",
223-
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
224-
"Name: get_weather\n",
225-
"\n",
226-
"It might be cloudy in nyc\n",
227-
"18:47:43 httpx INFO HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n",
228-
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
229-
"\n",
230-
"The weather in New York City might be cloudy. If you need more detailed information, feel free to ask!\n"
231-
]
232-
}
233-
],
189+
"outputs": [],
234190
"source": [
235191
"config = {\"configurable\": {\"thread_id\": \"1\"}}\n",
236192
"inputs = {\"messages\": [(\"user\", \"What's the weather in NYC?\")]}\n",
@@ -248,37 +204,10 @@
248204
},
249205
{
250206
"cell_type": "code",
251-
"execution_count": 6,
207+
"execution_count": null,
252208
"id": "187479f9-32fa-4611-9487-cf816ba2e147",
253209
"metadata": {},
254-
"outputs": [
255-
{
256-
"name": "stdout",
257-
"output_type": "stream",
258-
"text": [
259-
"================================\u001b[1m Human Message \u001b[0m=================================\n",
260-
"\n",
261-
"What's it known for?\n",
262-
"18:47:49 httpx INFO HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n",
263-
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
264-
"\n",
265-
"New York City is known for a wide array of iconic features and cultural landmarks, including:\n",
266-
"\n",
267-
"1. **Statue of Liberty**: A symbol of freedom and democracy, located on Liberty Island.\n",
268-
"2. **Times Square**: Known for its bright lights, Broadway theaters, and bustling atmosphere.\n",
269-
"3. **Central Park**: A massive urban park offering a natural escape in the heart of the city.\n",
270-
"4. **Empire State Building**: An iconic skyscraper with observatories offering stunning city views.\n",
271-
"5. **Broadway**: Famous for its world-class theater productions and musicals.\n",
272-
"6. **Wall Street**: The financial hub of the U.S., home to the New York Stock Exchange.\n",
273-
"7. **Cultural Diversity**: A melting pot of cultures, languages, and cuisines.\n",
274-
"8. **Museums**: Including the Metropolitan Museum of Art, Museum of Modern Art (MoMA), and the American Museum of Natural History.\n",
275-
"9. **Cuisine**: Known for diverse food offerings, including New York-style pizza and bagels.\n",
276-
"10. **Fashion**: A global fashion capital, hosting events like New York Fashion Week.\n",
277-
"\n",
278-
"These are just a few highlights, as NYC is a city with endless attractions and a vibrant cultural scene.\n"
279-
]
280-
}
281-
],
210+
"outputs": [],
282211
"source": [
283212
"inputs = {\"messages\": [(\"user\", \"What's it known for?\")]}\n",
284213
"print_stream(graph.stream(inputs, config=config, stream_mode=\"values\"))"
@@ -314,4 +243,4 @@
314243
},
315244
"nbformat": 4,
316245
"nbformat_minor": 5
317-
}
246+
}

0 commit comments

Comments
 (0)