aiq.data_models.common#

Attributes#

Classes#

HashableBaseModel

Subclass of a Pydantic BaseModel that is hashable. Use in objects that need to be hashed for caching purposes.

BaseModelRegistryTag

TypedBaseModel

Subclass of Pydantic BaseModel that allows for specifying the object type. Use in Pydantic discriminated unions.

Functions#

subclass_depth(→ int)

Compute a class' subclass depth.

_get_origin_or_base(→ type)

Get the origin of a type or the base class if it is not a generic.

Module Contents#

_LT#
class HashableBaseModel(/, **data: Any)#

Bases: pydantic.BaseModel

Subclass of a Pydantic BaseModel that is hashable. Use in objects that need to be hashed for caching purposes.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

classmethod generate_json_schema() dict[str, Any]#
classmethod write_json_schema(schema_path: str) None#
subclass_depth(cls: type) int#

Compute a class’ subclass depth.

_get_origin_or_base(cls: type) type#

Get the origin of a type or the base class if it is not a generic.

class BaseModelRegistryTag#
class TypedBaseModel(/, **data: Any)#

Bases: pydantic.BaseModel

Subclass of Pydantic BaseModel that allows for specifying the object type. Use in Pydantic discriminated unions.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

type: str = None#
full_type: ClassVar[str]#
classmethod static_type()#
classmethod static_full_type()#
static discriminator(v: Any) str | None#
TypedBaseModelT#