Metadata describing a specific version of an artifact.
| 31 | |
| 32 | |
| 33 | class ArtifactVersion(BaseModel): |
| 34 | """Metadata describing a specific version of an artifact.""" |
| 35 | |
| 36 | model_config = ConfigDict( |
| 37 | alias_generator=alias_generators.to_camel, |
| 38 | populate_by_name=True, |
| 39 | ) |
| 40 | |
| 41 | version: int = Field( |
| 42 | description=( |
| 43 | "Monotonically increasing identifier for the artifact version." |
| 44 | ) |
| 45 | ) |
| 46 | canonical_uri: str = Field( |
| 47 | description="Canonical URI referencing the persisted artifact payload." |
| 48 | ) |
| 49 | custom_metadata: dict[str, Any] = Field( |
| 50 | default_factory=dict, |
| 51 | description="Optional user-supplied metadata stored with the artifact.", |
| 52 | ) |
| 53 | create_time: float = Field( |
| 54 | default_factory=lambda: platform_time.get_time(), |
| 55 | description=( |
| 56 | "Unix timestamp (seconds) when the version record was created." |
| 57 | ), |
| 58 | ) |
| 59 | mime_type: Optional[str] = Field( |
| 60 | default=None, |
| 61 | description=( |
| 62 | "MIME type when the artifact payload is stored as binary data." |
| 63 | ), |
| 64 | ) |
| 65 | |
| 66 | |
| 67 | def ensure_part(artifact: Union[types.Part, dict[str, Any]]) -> types.Part: |