Gen-AI Developer Classroom notes 10/Sep/2026

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

By continuous learner

enthusiastic technology learner

Leave a Reply

Discover more from Direct AI Powered By Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading