State
- A state is shared across all the nodes
-
State can be defined three ways
- Dervied from TypedDict
- Dataclass
- Pydantic model
-
Defining state using TypedDict
-
When to use what
- Prefer typeddict as much as possible
- Prefer dataclasses when you want default values
- Prefer Pydantic models when you need validations
-
Refer Here for the changes done to add the state using typed dict
-
I dont want all fields to be Required Refer Here
-
A Better way is as follows
-
Using dataclasses Refer Here
-
using pydantic models Refer Here
