From 9fde14079a2c0192ce860ccfaca14124bf6b2a09 Mon Sep 17 00:00:00 2001 From: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com> Date: Wed, 4 Jun 2025 13:12:13 -0400 Subject: [PATCH] docs: use `retry_policy` instead of `retry` in docs (#4958) --- docs/docs/how-tos/graph-api.ipynb | 14 +++++++------- docs/docs/how-tos/many-tools.ipynb | 4 ++-- docs/docs/how-tos/use-functional-api.md | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/docs/how-tos/graph-api.ipynb b/docs/docs/how-tos/graph-api.ipynb index 664d1b555..9adfa27ac 100644 --- a/docs/docs/how-tos/graph-api.ipynb +++ b/docs/docs/how-tos/graph-api.ipynb @@ -1198,7 +1198,7 @@ "\n", "There are many use cases where you may wish for your node to have a custom retry policy, for example if you are calling an API, querying a database, or calling an LLM, etc. LangGraph lets you add retry policies to nodes.\n", "\n", - "To configure a retry policy, pass the `retry` parameter to the [add_node](https://langchain-ai.github.io/langgraph/reference/graphs/#langgraph.graph.state.StateGraph.add_node). The `retry` parameter takes in a `RetryPolicy` named tuple object. Below we instantiate a `RetryPolicy` object with the default parameters and associate it with a node:\n", + "To configure a retry policy, pass the `retry_policy` parameter to the [add_node](https://langchain-ai.github.io/langgraph/reference/graphs/#langgraph.graph.state.StateGraph.add_node). The `retry_policy` parameter takes in a `RetryPolicy` named tuple object. Below we instantiate a `RetryPolicy` object with the default parameters and associate it with a node:\n", "\n", "```python\n", "from langgraph.pregel import RetryPolicy\n", @@ -1206,7 +1206,7 @@ "builder.add_node(\n", " \"node_name\",\n", " node_function,\n", - " retry=RetryPolicy(),\n", + " retry_policy=RetryPolicy(),\n", ")\n", "```" ] @@ -1241,7 +1241,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "ad92598c-b688-42fa-aae0-9de36273d584", "metadata": {}, "outputs": [], @@ -1276,9 +1276,9 @@ "builder.add_node(\n", " \"query_database\",\n", " query_database,\n", - " retry=RetryPolicy(retry_on=sqlite3.OperationalError),\n", + " retry_policy=RetryPolicy(retry_on=sqlite3.OperationalError),\n", ")\n", - "builder.add_node(\"model\", call_model, retry=RetryPolicy(max_attempts=5))\n", + "builder.add_node(\"model\", call_model, retry_policy=RetryPolicy(max_attempts=5))\n", "builder.add_edge(START, \"model\")\n", "builder.add_edge(\"model\", \"query_database\")\n", "builder.add_edge(\"query_database\", END)\n", @@ -3416,7 +3416,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": ".venv", "language": "python", "name": "python3" }, @@ -3430,7 +3430,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.4" + "version": "3.12.9" } }, "nbformat": 4, diff --git a/docs/docs/how-tos/many-tools.ipynb b/docs/docs/how-tos/many-tools.ipynb index c2815987b..9e61b5ed4 100644 --- a/docs/docs/how-tos/many-tools.ipynb +++ b/docs/docs/how-tos/many-tools.ipynb @@ -405,7 +405,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": null, "id": "1954a5f1-91e4-4b32-9be9-c8bc1cc43cb5", "metadata": {}, "outputs": [], @@ -465,7 +465,7 @@ "\n", "graph_builder = StateGraph(State)\n", "graph_builder.add_node(\"agent\", agent)\n", - "graph_builder.add_node(\"select_tools\", select_tools, retry=RetryPolicy(max_attempts=3))\n", + "graph_builder.add_node(\"select_tools\", select_tools, retry_policy=RetryPolicy(max_attempts=3))\n", "\n", "tool_node = ToolNode(tools=tools)\n", "graph_builder.add_node(\"tools\", tool_node)\n", diff --git a/docs/docs/how-tos/use-functional-api.md b/docs/docs/how-tos/use-functional-api.md index 4f9b0e864..12bfe34fc 100644 --- a/docs/docs/how-tos/use-functional-api.md +++ b/docs/docs/how-tos/use-functional-api.md @@ -321,7 +321,7 @@ attempts = 0 # The default RetryPolicy is optimized for retrying specific network errors. retry_policy = RetryPolicy(retry_on=ValueError) -@task(retry=retry_policy) +@task(retry_policy=retry_policy) def get_info(): global attempts attempts += 1