diff --git a/docs/docs/tutorials/introduction.ipynb b/docs/docs/tutorials/introduction.ipynb index b978af138..8e40e8b66 100644 --- a/docs/docs/tutorials/introduction.ipynb +++ b/docs/docs/tutorials/introduction.ipynb @@ -276,7 +276,7 @@ ], "source": [ "def stream_graph_updates(user_input: str):\n", - " for event in graph.stream({\"messages\": [(\"user\", user_input)]}):\n", + " for event in graph.stream({\"messages\": [{\"role\": \"user\", \"content\": user_input}]}):\n", " for value in event.values():\n", " print(\"Assistant:\", value[\"messages\"][-1].content)\n", "\n", @@ -958,7 +958,7 @@ "\n", "# The config is the **second positional argument** to stream() or invoke()!\n", "events = graph.stream(\n", - " {\"messages\": [(\"user\", user_input)]}, config, stream_mode=\"values\"\n", + " {\"messages\": [{\"role\": \"user\", \"content\": user_input}]}, config, stream_mode=\"values\"\n", ")\n", "for event in events:\n", " event[\"messages\"][-1].pretty_print()" @@ -998,7 +998,7 @@ "\n", "# The config is the **second positional argument** to stream() or invoke()!\n", "events = graph.stream(\n", - " {\"messages\": [(\"user\", user_input)]}, config, stream_mode=\"values\"\n", + " {\"messages\": [{\"role\": \"user\", \"content\": user_input}]}, config, stream_mode=\"values\"\n", ")\n", "for event in events:\n", " event[\"messages\"][-1].pretty_print()" @@ -1036,7 +1036,8 @@ "source": [ "# The only difference is we change the `thread_id` here to \"2\" instead of \"1\"\n", "events = graph.stream(\n", - " {\"messages\": [(\"user\", user_input)]},\n", + " {\"messages\": [{\"role\": \"user\", \"content\": user_input}]},\n", + " # highlight-next-line\n", " {\"configurable\": {\"thread_id\": \"2\"}},\n", " stream_mode=\"values\",\n", ")\n", @@ -1342,7 +1343,7 @@ "config = {\"configurable\": {\"thread_id\": \"1\"}}\n", "\n", "events = graph.stream(\n", - " {\"messages\": [(\"user\", user_input)]}, config, stream_mode=\"values\"\n", + " {\"messages\": [{\"role\": \"user\", \"content\": user_input}]}, config, stream_mode=\"values\"\n", ")\n", "for event in events:\n", " if \"messages\" in event:\n", @@ -1724,7 +1725,7 @@ "config = {\"configurable\": {\"thread_id\": \"1\"}}\n", "\n", "events = graph.stream(\n", - " {\"messages\": [(\"user\", user_input)]}, config, stream_mode=\"values\"\n", + " {\"messages\": [{\"role\": \"user\", \"content\": user_input}]}, config, stream_mode=\"values\"\n", ")\n", "for event in events:\n", " if \"messages\" in event:\n", @@ -2137,8 +2138,14 @@ "events = graph.stream(\n", " {\n", " \"messages\": [\n", - " (\"user\", \"I'm learning LangGraph. Could you do some research on it for me?\")\n", - " ]\n", + " {\n", + " \"role\": \"user\",\n", + " \"content\": (\n", + " \"I'm learning LangGraph. \"\n", + " \"Could you do some research on it for me?\"\n", + " ),\n", + " },\n", + " ],\n", " },\n", " config,\n", " stream_mode=\"values\",\n", @@ -2211,8 +2218,14 @@ "events = graph.stream(\n", " {\n", " \"messages\": [\n", - " (\"user\", \"Ya that's helpful. Maybe I'll build an autonomous agent with it!\")\n", - " ]\n", + " {\n", + " \"role\": \"user\",\n", + " \"content\": (\n", + " \"Ya that's helpful. Maybe I'll \"\n", + " \"build an autonomous agent with it!\"\n", + " ),\n", + " },\n", + " ],\n", " },\n", " config,\n", " stream_mode=\"values\",\n",