mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-10 11:47:51 +02:00
[Docs] Grammar and punctuation improvements in LangGraph introduction tutorial (#680)
* Fix backtick enclosure in section 2 * Remove unnecessary double new line in route_tools() docstring * Fix typos for describing checkpointer memory in section 3 * Fix grammar mistake when describing checkpointing in section 3 * Replace is with are to describe plural * Fix incomplete double underscore wrapping for markdown formatting in section 7 --------- Co-authored-by: William FH <13333726+hinthornw@users.noreply.github.com>
This commit is contained in:
co-authored by
William FH
parent
4578a653c7
commit
17f1a05b6b
@@ -511,7 +511,7 @@
|
||||
"source": [
|
||||
"Next we need to create a function to actually run the tools if they are called. We'll do this by adding the tools to a new node.\n",
|
||||
"\n",
|
||||
"Below, implement a `BasicToolNode` that checks the most recent message in the state and calls tools if the message contains `tool_calls. It relies on the LLM's `tool_calling` support, which is available in Anthropic, OpenAI, Google Gemini, and a number of other LLM providers.\n",
|
||||
"Below, implement a `BasicToolNode` that checks the most recent message in the state and calls tools if the message contains `tool_calls`. It relies on the LLM's `tool_calling` support, which is available in Anthropic, OpenAI, Google Gemini, and a number of other LLM providers.\n",
|
||||
"\n",
|
||||
"We will later replace this with LangGraph's prebuilt [ToolNode](https://langchain-ai.github.io/langgraph/reference/prebuilt/#toolnode) to speed things up, but building it ourselves first is instructive."
|
||||
]
|
||||
@@ -587,9 +587,10 @@
|
||||
"def route_tools(\n",
|
||||
" state: State,\n",
|
||||
") -> Literal[\"tools\", \"__end__\"]:\n",
|
||||
" \"\"\"Use in the conditional_edge to route to the ToolNode if the last message\n",
|
||||
"\n",
|
||||
" has tool calls. Otherwise, route to the end.\"\"\"\n",
|
||||
" \"\"\"\n",
|
||||
" Use in the conditional_edge to route to the ToolNode if the last message\n",
|
||||
" has tool calls. Otherwise, route to the end.\n",
|
||||
" \"\"\"\n",
|
||||
" if isinstance(state, list):\n",
|
||||
" ai_message = state[-1]\n",
|
||||
" elif messages := state.get(\"messages\", []):\n",
|
||||
@@ -1070,7 +1071,7 @@
|
||||
"id": "33be4cd8-f96f-4949-9d1f-48054502e5d0",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**Notice** that we are't the memory using an external list: it's all handled by the checkpointer! You can inspect the full execution in this [LangSmith trace](https://smith.langchain.com/public/48387889-c002-47a8-9f6a-1f6b298db64b/r) to see what's going on.\n",
|
||||
"**Notice** that we aren't using an external list for memory: it's all handled by the checkpointer! You can inspect the full execution in this [LangSmith trace](https://smith.langchain.com/public/48387889-c002-47a8-9f6a-1f6b298db64b/r) to see what's going on.\n",
|
||||
"\n",
|
||||
"Don't believe me? Try this using a different config."
|
||||
]
|
||||
@@ -1165,7 +1166,7 @@
|
||||
"source": [
|
||||
"The snapshot above contains the current state values, corresponding config, and the `next` node to process. In our case, the graph has reached an `__end__` state, so `next` is empty.\n",
|
||||
"\n",
|
||||
"**Congratulations!** Your chatbot can now maintain conversation state across sessions thanks to LangGraph's checkpointing system. This opens up exciting possibilities for more natural, contextual interactions. LangGraph's checkpointing even handles **arbitrary complex graph states**, which is much more expressive and powerful than simple chat memory.\n",
|
||||
"**Congratulations!** Your chatbot can now maintain conversation state across sessions thanks to LangGraph's checkpointing system. This opens up exciting possibilities for more natural, contextual interactions. LangGraph's checkpointing even handles **arbitrarily complex graph states**, which is much more expressive and powerful than simple chat memory.\n",
|
||||
"\n",
|
||||
"In the next part, we'll introduce human oversight to our bot to handle situations where it may need guidance or verification before proceeding.\n",
|
||||
" \n",
|
||||
@@ -1720,7 +1721,7 @@
|
||||
"source": [
|
||||
"Now the graph is complete, since we've provided the final response message! Since state updates simulate a graph step, they even generate corresponding traces. Inspec the [LangSmith trace](https://smith.langchain.com/public/c45207bb-bd26-4c9a-b631-928bbeebfbcb/r) of the `update_state` call above to see what's going on.\n",
|
||||
"\n",
|
||||
"**Notice** that our new messages is _appended_ to the messages already in the state. Remember how we defined the `State` type?\n",
|
||||
"**Notice** that our new messages are _appended_ to the messages already in the state. Remember how we defined the `State` type?\n",
|
||||
"\n",
|
||||
"```python\n",
|
||||
"class State(TypedDict):\n",
|
||||
@@ -2950,7 +2951,7 @@
|
||||
"id": "b182019e-bae3-4616-ba1b-f845c0ab6636",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**Notice** that checkpoints are saved for every step of the graph. This _spans invocations__ so you can rewind across a full thread's history. We've picked out `to_replay` as a state to resume from. This is the state after the `chatbot` node in the second graph invocation above.\n",
|
||||
"**Notice** that checkpoints are saved for every step of the graph. This __spans invocations__ so you can rewind across a full thread's history. We've picked out `to_replay` as a state to resume from. This is the state after the `chatbot` node in the second graph invocation above.\n",
|
||||
"\n",
|
||||
"Resuming from this point should call the **action** node next."
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user