Gen-AI Developer Classroom notes 03/Jun/2025

State

  • Langgraph state can be implemented in 3 ways
  • Langgraph state can be of multiple types

  • Pydantic built in specialized types

Built-in Specialized Types

| Validator / Type | Summary |
|———————–|—————————————————————————————————|
| EmailStr | Validates that a string is a properly formatted email address. Uses the email-validator package internally[2][5]. |
| AnyUrl / HttpUrl | Validates that a string is a valid (HTTP) URL. |
| IPvAnyAddress | Validates that a string is a valid IPv4 or IPv6 address. |
| IPvAnyInterface | Validates that a string is a valid IP interface. |
| IPvAnyNetwork | Validates that a string is a valid IP network. |
| PaymentCardNumber | Validates that a string is a valid payment card number (Luhn algorithm). |
| UUID1, UUID3, UUID4, UUID5 | Validates that a string is a valid UUID of the respective version. |
| Decimal, condecimal | Ensures a value is a decimal, with optional constraints (e.g., max_digits, decimal_places). |
| conint, confloat, constr | Constrained versions of int, float, and str (e.g., min/max values, length, regex). |
| SecretStr, SecretBytes | For storing sensitive data, hides value in representation. |
| PastDate, FutureDate | Validates that a date is in the past or future. |

  • Refer Here for the state validations.

  • Generally when we build graphs, we might not want to show intermediate state values to end user 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