Added more explicit type annotation indicating that the field can be either a string or None e.g endpoint: Optional[str] = None
As parse_obj_as is deprecated, using TypeAdapter for parsing and converting types
Replaced @root_validator(pre=True) to @model_validator(mode='before') and handling values as either ArgsKwargs or a dictionary.
Replaced constr with Annotated for defining string constraints.
There are some differences in how error messages are presented in Pydantic v2, added changes for better readability. For example, the transition from general error types like type_error to more specific ones such as value_error or dict_type is handled.
Issue: https://github.com/IBM/lmctl/issues/199
Changes in the PR for uplifting to Pydantic V2