Skip to content

model

mlte/artifact/model.py

Model implementation for MLTE artifacts.

ArtifactHeaderModel

Bases: BaseModel

The ArtifactHeaderModel contains the common metadata for all artifacts.

Source code in mlte/artifact/model.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class ArtifactHeaderModel(BaseModel):
    """The ArtifactHeaderModel contains the common metadata for all artifacts."""

    identifier: str
    """The unique identifier for the artifact."""

    type: ArtifactType
    """The type identfier for the artifact."""

    timestamp: Optional[int] = -1
    """The timestamp of creation of this artifact, as Unix time."""

    creator: Optional[str]
    """The user that created this artifact."""

    model_config = ConfigDict(use_enum_values=True)

creator instance-attribute

The user that created this artifact.

identifier instance-attribute

The unique identifier for the artifact.

timestamp = -1 class-attribute instance-attribute

The timestamp of creation of this artifact, as Unix time.

type instance-attribute

The type identfier for the artifact.

ArtifactModel

Bases: Filterable

The base model for all MLTE artifacts.

Source code in mlte/artifact/model.py
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
class ArtifactModel(Filterable):
    """The base model for all MLTE artifacts."""

    header: ArtifactHeaderModel
    """The artifact header."""

    body: Union[
        NegotiationCardModel,
        ValueModel,
        SpecModel,
        ValidatedSpecModel,
        ReportModel,
    ] = Field(..., discriminator="artifact_type")
    """The artifact body."""

    def get_identifier(self) -> str:
        return self.header.identifier

    def get_type(self) -> Any:
        return self.header.type

body = Field(..., discriminator='artifact_type') class-attribute instance-attribute

The artifact body.

header instance-attribute

The artifact header.