diff --git a/docs/docs/cloud/deployment/graph_rebuild.md b/docs/docs/cloud/deployment/graph_rebuild.md index b1034cd0f..eb5b8a322 100644 --- a/docs/docs/cloud/deployment/graph_rebuild.md +++ b/docs/docs/cloud/deployment/graph_rebuild.md @@ -58,7 +58,8 @@ To make the server aware of your graph, you need to specify a path to the variab To make your graph rebuild on each new run with custom configuration, you need to rewrite `openai_agent.py` to instead provide a _function_ that takes a config and returns a graph (or compiled graph) instance. Let's say we want to return our existing graph for user ID '1', and a tool-calling agent for other users. We can modify `openai_agent.py` as follows: ```python -from typing import Annotated, TypedDict +from typing import Annotated +from typing_extensions import TypedDict from langchain_openai import ChatOpenAI from langgraph.graph import END, START, MessageGraph from langgraph.graph.state import StateGraph diff --git a/docs/docs/cloud/deployment/setup.md b/docs/docs/cloud/deployment/setup.md index d4ef682d0..a5c99f565 100644 --- a/docs/docs/cloud/deployment/setup.md +++ b/docs/docs/cloud/deployment/setup.md @@ -101,7 +101,8 @@ Example `agent.py` file, which shows how to import from other modules you define ```python # my_agent/agent.py -from typing import TypedDict, Literal +from typing import Literal +from typing_extensions import TypedDict from langgraph.graph import StateGraph, END, START from my_agent.utils.nodes import call_model, should_continue, tool_node # import nodes diff --git a/docs/docs/cloud/deployment/setup_pyproject.md b/docs/docs/cloud/deployment/setup_pyproject.md index 70ae4cd1a..f62356899 100644 --- a/docs/docs/cloud/deployment/setup_pyproject.md +++ b/docs/docs/cloud/deployment/setup_pyproject.md @@ -110,7 +110,8 @@ Example `agent.py` file, which shows how to import from other modules you define ```python # my_agent/agent.py -from typing import TypedDict, Literal +from typing import Literal +from typing_extensions import TypedDict from langgraph.graph import StateGraph, END, START from my_agent.utils.nodes import call_model, should_continue, tool_node # import nodes diff --git a/docs/docs/cloud/how-tos/stream_messages.md b/docs/docs/cloud/how-tos/stream_messages.md index 64b353527..653da7f71 100644 --- a/docs/docs/cloud/how-tos/stream_messages.md +++ b/docs/docs/cloud/how-tos/stream_messages.md @@ -7,7 +7,8 @@ E.g., the state should look something like: === "Python" ```python - from typing import TypedDict, Annotated + from typing import Annotated + from typing_extensions import TypedDict from langgraph.graph import add_messages from langchain_core.messages import AnyMessage diff --git a/docs/docs/concepts/low_level.md b/docs/docs/concepts/low_level.md index 43f3093a7..155c35d9f 100644 --- a/docs/docs/concepts/low_level.md +++ b/docs/docs/concepts/low_level.md @@ -118,7 +118,7 @@ These two examples show how to use the default reducer: **Example A:** ```python -from typing import TypedDict +from typing_extensions import TypedDict class State(TypedDict): foo: int @@ -130,7 +130,8 @@ In this example, no reducer functions are specified for any key. Let's assume th **Example B:** ```python -from typing import TypedDict, Annotated +from typing import Annotated +from typing_extensions import TypedDict from operator import add class State(TypedDict): @@ -169,7 +170,8 @@ Since the state updates are always deserialized into LangChain `Messages` when u ```python from langchain_core.messages import AnyMessage from langgraph.graph.message import add_messages -from typing import Annotated, TypedDict +from typing import Annotated +from typing_extensions import TypedDict class GraphState(TypedDict): messages: Annotated[list[AnyMessage], add_messages] diff --git a/docs/docs/concepts/persistence.md b/docs/docs/concepts/persistence.md index 23a50c502..f5c550899 100644 --- a/docs/docs/concepts/persistence.md +++ b/docs/docs/concepts/persistence.md @@ -27,7 +27,8 @@ Let's see what checkpoints are saved when a simple graph is invoked as follows: ```python from langgraph.graph import StateGraph, START, END from langgraph.checkpoint.memory import MemorySaver -from typing import TypedDict, Annotated +from typing import Annotated +from typing_extensions import TypedDict from operator import add class State(TypedDict): @@ -180,7 +181,8 @@ These are the values that will be used to update the state. Note that this updat Let's assume you have defined the state of your graph with the following schema (see full example above): ```python -from typing import TypedDict, Annotated +from typing import Annotated +from typing_extensions import TypedDict from operator import add class State(TypedDict): diff --git a/docs/docs/how-tos/configuration.ipynb b/docs/docs/how-tos/configuration.ipynb index fe51c5ee2..62d8fecc3 100644 --- a/docs/docs/how-tos/configuration.ipynb +++ b/docs/docs/how-tos/configuration.ipynb @@ -77,7 +77,8 @@ "outputs": [], "source": [ "import operator\n", - "from typing import Annotated, Sequence, TypedDict\n", + "from typing import Annotated, Sequence\n", + "from typing_extensions import TypedDict\n", "\n", "from langchain_anthropic import ChatAnthropic\n", "from langchain_core.messages import BaseMessage, HumanMessage\n", diff --git a/docs/docs/how-tos/human_in_the_loop/breakpoints.ipynb b/docs/docs/how-tos/human_in_the_loop/breakpoints.ipynb index 22771c630..6bf7e3a72 100644 --- a/docs/docs/how-tos/human_in_the_loop/breakpoints.ipynb +++ b/docs/docs/how-tos/human_in_the_loop/breakpoints.ipynb @@ -122,7 +122,7 @@ } ], "source": [ - "from typing import TypedDict\n", + "from typing_extensions import TypedDict\n", "from langgraph.graph import StateGraph, START, END\n", "from langgraph.checkpoint.memory import MemorySaver\n", "from IPython.display import Image, display\n", diff --git a/docs/docs/how-tos/human_in_the_loop/dynamic_breakpoints.ipynb b/docs/docs/how-tos/human_in_the_loop/dynamic_breakpoints.ipynb index 249bc3981..f76caf26b 100644 --- a/docs/docs/how-tos/human_in_the_loop/dynamic_breakpoints.ipynb +++ b/docs/docs/how-tos/human_in_the_loop/dynamic_breakpoints.ipynb @@ -74,7 +74,7 @@ } ], "source": [ - "from typing import TypedDict\n", + "from typing_extensions import TypedDict\n", "from IPython.display import Image, display\n", "\n", "from langgraph.graph import StateGraph, START, END\n", diff --git a/docs/docs/how-tos/human_in_the_loop/edit-graph-state.ipynb b/docs/docs/how-tos/human_in_the_loop/edit-graph-state.ipynb index 4615778d5..33e256ee1 100644 --- a/docs/docs/how-tos/human_in_the_loop/edit-graph-state.ipynb +++ b/docs/docs/how-tos/human_in_the_loop/edit-graph-state.ipynb @@ -124,7 +124,7 @@ } ], "source": [ - "from typing import TypedDict\n", + "from typing_extensions import TypedDict\n", "from langgraph.graph import StateGraph, START, END\n", "from langgraph.checkpoint.memory import MemorySaver\n", "from IPython.display import Image, display\n", diff --git a/docs/docs/how-tos/human_in_the_loop/review-tool-calls.ipynb b/docs/docs/how-tos/human_in_the_loop/review-tool-calls.ipynb index 0c0d27a3c..7dd234f47 100644 --- a/docs/docs/how-tos/human_in_the_loop/review-tool-calls.ipynb +++ b/docs/docs/how-tos/human_in_the_loop/review-tool-calls.ipynb @@ -118,7 +118,7 @@ } ], "source": [ - "from typing import TypedDict, Literal\n", + "from typing_extensions import TypedDict, Literal\n", "from langgraph.graph import StateGraph, START, END, MessagesState\n", "from langgraph.checkpoint.memory import MemorySaver\n", "from langchain_anthropic import ChatAnthropic\n", diff --git a/docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb b/docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb index 5e92fdade..a3b4c36fb 100644 --- a/docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb +++ b/docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb @@ -118,7 +118,7 @@ } ], "source": [ - "from typing import TypedDict\n", + "from typing_extensions import TypedDict\n", "from langgraph.graph import StateGraph, START, END\n", "from langgraph.checkpoint.memory import MemorySaver\n", "from IPython.display import Image, display\n", diff --git a/docs/docs/how-tos/input_output_schema.ipynb b/docs/docs/how-tos/input_output_schema.ipynb index 97f69c48d..d902d64c8 100644 --- a/docs/docs/how-tos/input_output_schema.ipynb +++ b/docs/docs/how-tos/input_output_schema.ipynb @@ -69,7 +69,7 @@ ], "source": [ "from langgraph.graph import StateGraph, START, END\n", - "from typing import TypedDict\n", + "from typing_extensions import TypedDict\n", "\n", "\n", "class InputState(TypedDict):\n", diff --git a/docs/docs/how-tos/map-reduce.ipynb b/docs/docs/how-tos/map-reduce.ipynb index fb00f0bfb..804d9b0fd 100644 --- a/docs/docs/how-tos/map-reduce.ipynb +++ b/docs/docs/how-tos/map-reduce.ipynb @@ -105,7 +105,8 @@ "outputs": [], "source": [ "import operator\n", - "from typing import Annotated, TypedDict\n", + "from typing import Annotated\n", + "from typing_extensions import TypedDict\n", "\n", "from langchain_anthropic import ChatAnthropic\n", "\n", diff --git a/docs/docs/how-tos/node-retries.ipynb b/docs/docs/how-tos/node-retries.ipynb index 3616297c9..331499880 100644 --- a/docs/docs/how-tos/node-retries.ipynb +++ b/docs/docs/how-tos/node-retries.ipynb @@ -123,7 +123,8 @@ "source": [ "import operator\n", "import sqlite3\n", - "from typing import Annotated, Sequence, TypedDict\n", + "from typing import Annotated, Sequence\n", + "from typing_extensions import TypedDict\n", "\n", "from langchain_anthropic import ChatAnthropic\n", "from langchain_core.messages import BaseMessage\n", diff --git a/docs/docs/how-tos/pass-run-time-values-to-tools.ipynb b/docs/docs/how-tos/pass-run-time-values-to-tools.ipynb index 78eb0008c..08ca92e5b 100644 --- a/docs/docs/how-tos/pass-run-time-values-to-tools.ipynb +++ b/docs/docs/how-tos/pass-run-time-values-to-tools.ipynb @@ -271,7 +271,8 @@ "outputs": [], "source": [ "import operator\n", - "from typing import Annotated, Sequence, TypedDict\n", + "from typing import Annotated, Sequence\n", + "from typing_extensions import TypedDict\n", "\n", "from langchain_core.messages import BaseMessage\n", "\n", diff --git a/docs/docs/how-tos/pass_private_state.ipynb b/docs/docs/how-tos/pass_private_state.ipynb index 5c731d916..f810fd140 100644 --- a/docs/docs/how-tos/pass_private_state.ipynb +++ b/docs/docs/how-tos/pass_private_state.ipynb @@ -75,7 +75,7 @@ ], "source": [ "from langgraph.graph import StateGraph, START, END\n", - "from typing import TypedDict\n", + "from typing_extensions import TypedDict\n", "\n", "\n", "# The overall state of the graph\n", diff --git a/docs/docs/how-tos/streaming-events-from-within-tools-without-langchain.ipynb b/docs/docs/how-tos/streaming-events-from-within-tools-without-langchain.ipynb index b9743b2b4..2d702c1f2 100644 --- a/docs/docs/how-tos/streaming-events-from-within-tools-without-langchain.ipynb +++ b/docs/docs/how-tos/streaming-events-from-within-tools-without-langchain.ipynb @@ -267,7 +267,8 @@ "outputs": [], "source": [ "import operator\n", - "from typing import Annotated, TypedDict, Literal\n", + "from typing import Annotated, Literal\n", + "from typing_extensions import TypedDict\n", "\n", "from langgraph.graph import StateGraph, END, START\n", "\n", diff --git a/docs/docs/how-tos/streaming-from-final-node.ipynb b/docs/docs/how-tos/streaming-from-final-node.ipynb index 58c9a4a32..75adf2e29 100644 --- a/docs/docs/how-tos/streaming-from-final-node.ipynb +++ b/docs/docs/how-tos/streaming-from-final-node.ipynb @@ -125,7 +125,8 @@ "metadata": {}, "outputs": [], "source": [ - "from typing import TypedDict, Annotated\n", + "from typing import Annotated\n", + "from typing_extensions import TypedDict\n", "\n", "from langgraph.graph import END, StateGraph, START\n", "from langgraph.graph.message import MessagesState\n", diff --git a/docs/docs/how-tos/streaming-tokens-without-langchain.ipynb b/docs/docs/how-tos/streaming-tokens-without-langchain.ipynb index 797868fdf..12843108a 100644 --- a/docs/docs/how-tos/streaming-tokens-without-langchain.ipynb +++ b/docs/docs/how-tos/streaming-tokens-without-langchain.ipynb @@ -251,7 +251,8 @@ "outputs": [], "source": [ "import operator\n", - "from typing import Annotated, TypedDict, Literal\n", + "from typing import Annotated, Literal\n", + "from typing_extensions import TypedDict\n", "\n", "from langgraph.graph import StateGraph, END, START\n", "\n", diff --git a/docs/docs/how-tos/subgraph-transform-state.ipynb b/docs/docs/how-tos/subgraph-transform-state.ipynb index 8443d7456..e1f87f540 100644 --- a/docs/docs/how-tos/subgraph-transform-state.ipynb +++ b/docs/docs/how-tos/subgraph-transform-state.ipynb @@ -64,7 +64,7 @@ "metadata": {}, "outputs": [], "source": [ - "from typing import TypedDict\n", + "from typing_extensions import TypedDict\n", "from langgraph.graph.state import StateGraph, START, END\n", "\n", "\n", diff --git a/docs/docs/how-tos/subgraphs-manage-state.ipynb b/docs/docs/how-tos/subgraphs-manage-state.ipynb index 125fd53fb..011cc1049 100644 --- a/docs/docs/how-tos/subgraphs-manage-state.ipynb +++ b/docs/docs/how-tos/subgraphs-manage-state.ipynb @@ -130,7 +130,8 @@ "metadata": {}, "outputs": [], "source": [ - "from typing import TypedDict, Literal\n", + "from typing import Literal\n", + "from typing_extensions import TypedDict\n", "from langgraph.checkpoint.memory import MemorySaver\n", "\n", "\n", @@ -710,7 +711,8 @@ "metadata": {}, "outputs": [], "source": [ - "from typing import TypedDict, Literal\n", + "from typing import Literal\n", + "from typing_extensions import TypedDict\n", "from langgraph.checkpoint.memory import MemorySaver\n", "\n", "\n", diff --git a/docs/docs/tutorials/code_assistant/langgraph_code_assistant.ipynb b/docs/docs/tutorials/code_assistant/langgraph_code_assistant.ipynb index 816943202..e5e46e078 100644 --- a/docs/docs/tutorials/code_assistant/langgraph_code_assistant.ipynb +++ b/docs/docs/tutorials/code_assistant/langgraph_code_assistant.ipynb @@ -352,7 +352,8 @@ "metadata": {}, "outputs": [], "source": [ - "from typing import List, TypedDict\n", + "from typing import List\n", + "from typing_extensions import TypedDict\n", "\n", "\n", "class GraphState(TypedDict):\n", diff --git a/docs/docs/tutorials/multi_agent/agent_supervisor.ipynb b/docs/docs/tutorials/multi_agent/agent_supervisor.ipynb index 3d76c47c4..739809bd4 100644 --- a/docs/docs/tutorials/multi_agent/agent_supervisor.ipynb +++ b/docs/docs/tutorials/multi_agent/agent_supervisor.ipynb @@ -208,7 +208,8 @@ "source": [ "import functools\n", "import operator\n", - "from typing import Sequence, TypedDict\n", + "from typing import Sequence\n", + "from typing_extensions import TypedDict\n", "\n", "from langchain_core.messages import BaseMessage\n", "\n", diff --git a/docs/docs/tutorials/multi_agent/multi-agent-collaboration.ipynb b/docs/docs/tutorials/multi_agent/multi-agent-collaboration.ipynb index c8245117e..7ae239c78 100644 --- a/docs/docs/tutorials/multi_agent/multi-agent-collaboration.ipynb +++ b/docs/docs/tutorials/multi_agent/multi-agent-collaboration.ipynb @@ -198,7 +198,8 @@ "outputs": [], "source": [ "import operator\n", - "from typing import Annotated, Sequence, TypedDict\n", + "from typing import Annotated, Sequence\n", + "from typing_extensions import TypedDict\n", "\n", "from langchain_openai import ChatOpenAI\n", "\n", diff --git a/docs/docs/tutorials/plan-and-execute/plan-and-execute.ipynb b/docs/docs/tutorials/plan-and-execute/plan-and-execute.ipynb index cdb2995c8..8e2263a80 100644 --- a/docs/docs/tutorials/plan-and-execute/plan-and-execute.ipynb +++ b/docs/docs/tutorials/plan-and-execute/plan-and-execute.ipynb @@ -211,7 +211,8 @@ "outputs": [], "source": [ "import operator\n", - "from typing import Annotated, List, Tuple, TypedDict\n", + "from typing import Annotated, List, Tuple\n", + "from typing_extensions import TypedDict\n", "\n", "\n", "class PlanExecute(TypedDict):\n", diff --git a/docs/docs/tutorials/rag/langgraph_agentic_rag.ipynb b/docs/docs/tutorials/rag/langgraph_agentic_rag.ipynb index 393014cdd..6521a1a56 100644 --- a/docs/docs/tutorials/rag/langgraph_agentic_rag.ipynb +++ b/docs/docs/tutorials/rag/langgraph_agentic_rag.ipynb @@ -155,7 +155,8 @@ "metadata": {}, "outputs": [], "source": [ - "from typing import Annotated, Sequence, TypedDict\n", + "from typing import Annotated, Sequence\n", + "from typing_extensions import TypedDict\n", "\n", "from langchain_core.messages import BaseMessage\n", "\n", @@ -223,7 +224,8 @@ } ], "source": [ - "from typing import Annotated, Literal, Sequence, TypedDict\n", + "from typing import Annotated, Literal, Sequence\n", + "from typing_extensions import TypedDict\n", "\n", "from langchain import hub\n", "from langchain_core.messages import BaseMessage, HumanMessage\n", diff --git a/docs/docs/tutorials/rewoo/rewoo.ipynb b/docs/docs/tutorials/rewoo/rewoo.ipynb index 2d167fcc3..6836eb6dd 100644 --- a/docs/docs/tutorials/rewoo/rewoo.ipynb +++ b/docs/docs/tutorials/rewoo/rewoo.ipynb @@ -109,7 +109,8 @@ "metadata": {}, "outputs": [], "source": [ - "from typing import List, TypedDict\n", + "from typing import List\n", + "from typing_extensions import TypedDict\n", "\n", "\n", "class ReWOO(TypedDict):\n", diff --git a/docs/docs/tutorials/self-discover/self-discover.ipynb b/docs/docs/tutorials/self-discover/self-discover.ipynb index 6bf2c49dc..965cc3001 100644 --- a/docs/docs/tutorials/self-discover/self-discover.ipynb +++ b/docs/docs/tutorials/self-discover/self-discover.ipynb @@ -167,7 +167,8 @@ "metadata": {}, "outputs": [], "source": [ - "from typing import Optional, TypedDict\n", + "from typing import Optional\n", + "from typing_extensions import TypedDict\n", "\n", "from langchain_core.output_parsers import StrOutputParser\n", "from langchain_openai import ChatOpenAI\n", @@ -318,7 +319,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.2" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/docs/tutorials/web-navigation/web_voyager.ipynb b/docs/docs/tutorials/web-navigation/web_voyager.ipynb index 520d3e42d..94dcfb55e 100644 --- a/docs/docs/tutorials/web-navigation/web_voyager.ipynb +++ b/docs/docs/tutorials/web-navigation/web_voyager.ipynb @@ -307,7 +307,8 @@ "metadata": {}, "outputs": [], "source": [ - "from typing import List, Optional, TypedDict\n", + "from typing import List, Optional\n", + "from typing_extensions import TypedDict\n", "\n", "from langchain_core.messages import BaseMessage, SystemMessage\n", "from playwright.async_api import Page\n",