docs: remove references to StateGraph(dict) (#4964)

remove StateGraph(dict)
This commit is contained in:
Sydney Runkle
2025-06-04 21:29:19 -04:00
committed by GitHub
parent 45e60ff9e1
commit 494c8ef0d2
2 changed files with 18 additions and 6 deletions
+9 -3
View File
@@ -376,12 +376,18 @@ class StateGraph(Generic[StateT, InputT]):
Example:
```python
from typing_extensions import TypedDict
from langchain_core.runnables import RunnableConfig
from langgraph.graph import START, StateGraph
def my_node(state, config):
class State(TypedDict):
x: int
def my_node(state: State, config: RunnableConfig) -> State:
return {"x": state["x"] + 1}
builder = StateGraph(dict)
builder = StateGraph(State)
builder.add_node(my_node) # node name will be 'my_node'
builder.add_edge(START, "my_node")
graph = builder.compile()
@@ -391,7 +397,7 @@ class StateGraph(Generic[StateT, InputT]):
Example: Customize the name:
```python
builder = StateGraph(dict)
builder = StateGraph(State)
builder.add_node("my_fair_node", my_node)
builder.add_edge(START, "my_fair_node")
graph = builder.compile()