docs: update typing -> typing_extensions for TypedDict (#1871)

This commit is contained in:
Vadym Barda
2024-09-26 18:06:45 -04:00
committed by GitHub
parent fe7e7b9121
commit 29a03309c9
30 changed files with 62 additions and 36 deletions
+2 -1
View File
@@ -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
+2 -1
View File
@@ -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
@@ -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
+2 -1
View File
@@ -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