truefoundry 0.4.4rc9__py3-none-any.whl → 0.4.4rc11__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of truefoundry might be problematic. Click here for more details.

Files changed (37) hide show
  1. truefoundry/common/tfy_signed_url_client.py +11 -6
  2. truefoundry/common/utils.py +3 -2
  3. truefoundry/ml/autogen/client/__init__.py +24 -3
  4. truefoundry/ml/autogen/client/api/experiments_api.py +0 -137
  5. truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py +2 -0
  6. truefoundry/ml/autogen/client/models/__init__.py +24 -3
  7. truefoundry/ml/autogen/client/models/artifact_dto.py +9 -0
  8. truefoundry/ml/autogen/client/models/artifact_version_dto.py +26 -0
  9. truefoundry/ml/autogen/client/models/artifact_version_serialization_format.py +34 -0
  10. truefoundry/ml/autogen/client/models/create_artifact_version_response_dto.py +8 -2
  11. truefoundry/ml/autogen/client/models/create_run_request_dto.py +1 -10
  12. truefoundry/ml/autogen/client/models/dataset_dto.py +9 -0
  13. truefoundry/ml/autogen/client/models/experiment_dto.py +14 -3
  14. truefoundry/ml/autogen/client/models/external_model_source.py +79 -0
  15. truefoundry/ml/autogen/client/models/finalize_artifact_version_request_dto.py +11 -0
  16. truefoundry/ml/autogen/client/models/framework.py +154 -0
  17. truefoundry/ml/autogen/client/models/library_name.py +35 -0
  18. truefoundry/ml/autogen/client/models/model_dto.py +9 -0
  19. truefoundry/ml/autogen/client/models/model_version_dto.py +26 -0
  20. truefoundry/ml/autogen/client/models/model_version_manifest.py +119 -0
  21. truefoundry/ml/autogen/client/models/run_info_dto.py +10 -1
  22. truefoundry/ml/autogen/client/models/source.py +177 -0
  23. truefoundry/ml/autogen/client/models/subject.py +79 -0
  24. truefoundry/ml/autogen/client/models/subject_type.py +34 -0
  25. truefoundry/ml/autogen/client/models/tensorflow_framework.py +74 -0
  26. truefoundry/ml/autogen/client/models/transformers_framework.py +90 -0
  27. truefoundry/ml/autogen/client/models/truefoundry_model_source.py +79 -0
  28. truefoundry/ml/autogen/client/models/update_model_version_request_dto.py +11 -0
  29. truefoundry/ml/autogen/client/models/upload_model_source.py +74 -0
  30. truefoundry/ml/autogen/client_README.md +12 -2
  31. truefoundry/ml/autogen/entities/artifacts.py +236 -4
  32. truefoundry/ml/mlfoundry_api.py +0 -1
  33. {truefoundry-0.4.4rc9.dist-info → truefoundry-0.4.4rc11.dist-info}/METADATA +1 -1
  34. {truefoundry-0.4.4rc9.dist-info → truefoundry-0.4.4rc11.dist-info}/RECORD +36 -25
  35. truefoundry/ml/autogen/client/models/list_seed_experiments_response_dto.py +0 -81
  36. {truefoundry-0.4.4rc9.dist-info → truefoundry-0.4.4rc11.dist-info}/WHEEL +0 -0
  37. {truefoundry-0.4.4rc9.dist-info → truefoundry-0.4.4rc11.dist-info}/entry_points.txt +0 -0
@@ -20,6 +20,7 @@ from datetime import datetime
20
20
  from typing import Any, Dict, Optional
21
21
 
22
22
  from truefoundry.ml.autogen.client.models.experiment_dto import ExperimentDto
23
+ from truefoundry.ml.autogen.client.models.subject import Subject
23
24
  from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr
24
25
 
25
26
 
@@ -34,6 +35,7 @@ class DatasetDto(BaseModel):
34
35
  fqn: StrictStr = Field(...)
35
36
  description: Optional[StrictStr] = None
36
37
  created_by: Optional[StrictStr] = None
38
+ created_by_subject: Subject = Field(...)
37
39
  created_at: Optional[datetime] = None
38
40
  updated_at: Optional[datetime] = None
39
41
  storage_root: Optional[StrictStr] = None
@@ -47,6 +49,7 @@ class DatasetDto(BaseModel):
47
49
  "fqn",
48
50
  "description",
49
51
  "created_by",
52
+ "created_by_subject",
50
53
  "created_at",
51
54
  "updated_at",
52
55
  "storage_root",
@@ -77,6 +80,9 @@ class DatasetDto(BaseModel):
77
80
  def to_dict(self):
78
81
  """Returns the dictionary representation of the model using alias"""
79
82
  _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
83
+ # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of created_by_subject
84
+ if self.created_by_subject:
85
+ _dict["created_by_subject"] = self.created_by_subject.to_dict()
80
86
  # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of experiment
81
87
  if self.experiment:
82
88
  _dict["experiment"] = self.experiment.to_dict()
@@ -99,6 +105,9 @@ class DatasetDto(BaseModel):
99
105
  "fqn": obj.get("fqn"),
100
106
  "description": obj.get("description"),
101
107
  "created_by": obj.get("created_by"),
108
+ "created_by_subject": Subject.from_dict(obj.get("created_by_subject"))
109
+ if obj.get("created_by_subject") is not None
110
+ else None,
102
111
  "created_at": obj.get("created_at"),
103
112
  "updated_at": obj.get("updated_at"),
104
113
  "storage_root": obj.get("storage_root"),
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, Dict, Optional
20
20
 
21
21
  from truefoundry.ml.autogen.client.models.experiment_tag_dto import ExperimentTagDto
22
+ from truefoundry.ml.autogen.client.models.subject import Subject
22
23
  from truefoundry.pydantic_v1 import BaseModel, Field, StrictInt, StrictStr, conlist
23
24
 
24
25
 
@@ -33,9 +34,10 @@ class ExperimentDto(BaseModel):
33
34
  artifact_location: Optional[StrictStr] = None
34
35
  lifecycle_stage: Optional[StrictStr] = None
35
36
  tags: Optional[conlist(ExperimentTagDto)] = None
36
- creator_user_id: Optional[StrictStr] = None
37
+ creator_user_id: StrictStr = Field(...)
38
+ created_by_subject: Subject = Field(...)
37
39
  description: Optional[StrictStr] = None
38
- privacy_type: Optional[StrictStr] = None
40
+ privacy_type: Optional[StrictStr] = "PRIVATE"
39
41
  created_at: Optional[StrictInt] = None
40
42
  tenant_name: Optional[StrictStr] = None
41
43
  manifest: Optional[Dict[str, Any]] = None
@@ -51,6 +53,7 @@ class ExperimentDto(BaseModel):
51
53
  "lifecycle_stage",
52
54
  "tags",
53
55
  "creator_user_id",
56
+ "created_by_subject",
54
57
  "description",
55
58
  "privacy_type",
56
59
  "created_at",
@@ -91,6 +94,9 @@ class ExperimentDto(BaseModel):
91
94
  if _item:
92
95
  _items.append(_item.to_dict())
93
96
  _dict["tags"] = _items
97
+ # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of created_by_subject
98
+ if self.created_by_subject:
99
+ _dict["created_by_subject"] = self.created_by_subject.to_dict()
94
100
  return _dict
95
101
 
96
102
  @classmethod
@@ -113,8 +119,13 @@ class ExperimentDto(BaseModel):
113
119
  if obj.get("tags") is not None
114
120
  else None,
115
121
  "creator_user_id": obj.get("creator_user_id"),
122
+ "created_by_subject": Subject.from_dict(obj.get("created_by_subject"))
123
+ if obj.get("created_by_subject") is not None
124
+ else None,
116
125
  "description": obj.get("description"),
117
- "privacy_type": obj.get("privacy_type"),
126
+ "privacy_type": obj.get("privacy_type")
127
+ if obj.get("privacy_type") is not None
128
+ else "PRIVATE",
118
129
  "created_at": obj.get("created_at"),
119
130
  "tenant_name": obj.get("tenant_name"),
120
131
  "manifest": obj.get("manifest"),
@@ -0,0 +1,79 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re # noqa: F401
19
+
20
+ from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
21
+
22
+
23
+ class ExternalModelSource(BaseModel):
24
+ """
25
+ ExternalModelSource
26
+ """
27
+
28
+ type: StrictStr = Field(
29
+ default=..., description="+label=Type +usage=Type of the source"
30
+ )
31
+ uri: StrictStr = Field(
32
+ default=..., description="+label=URI +usage=URI of the model source"
33
+ )
34
+ __properties = ["type", "uri"]
35
+
36
+ @validator("type")
37
+ def type_validate_enum(cls, value):
38
+ """Validates the enum"""
39
+ if value not in ("external"):
40
+ raise ValueError("must be one of enum values ('external')")
41
+ return value
42
+
43
+ class Config:
44
+ """Pydantic configuration"""
45
+
46
+ allow_population_by_field_name = True
47
+ validate_assignment = True
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.dict(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ return json.dumps(self.to_dict())
56
+
57
+ @classmethod
58
+ def from_json(cls, json_str: str) -> ExternalModelSource:
59
+ """Create an instance of ExternalModelSource from a JSON string"""
60
+ return cls.from_dict(json.loads(json_str))
61
+
62
+ def to_dict(self):
63
+ """Returns the dictionary representation of the model using alias"""
64
+ _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
65
+ return _dict
66
+
67
+ @classmethod
68
+ def from_dict(cls, obj: dict) -> ExternalModelSource:
69
+ """Create an instance of ExternalModelSource from a dict"""
70
+ if obj is None:
71
+ return None
72
+
73
+ if not isinstance(obj, dict):
74
+ return ExternalModelSource.parse_obj(obj)
75
+
76
+ _obj = ExternalModelSource.parse_obj(
77
+ {"type": obj.get("type"), "uri": obj.get("uri")}
78
+ )
79
+ return _obj
@@ -19,6 +19,9 @@ import re # noqa: F401
19
19
  from typing import Any, Dict, Optional
20
20
 
21
21
  from truefoundry.ml.autogen.client.models.internal_metadata import InternalMetadata
22
+ from truefoundry.ml.autogen.client.models.model_version_manifest import (
23
+ ModelVersionManifest,
24
+ )
22
25
  from truefoundry.pydantic_v1 import BaseModel, Field, StrictInt, StrictStr
23
26
 
24
27
 
@@ -35,6 +38,7 @@ class FinalizeArtifactVersionRequestDto(BaseModel):
35
38
  data_path: Optional[StrictStr] = None
36
39
  step: Optional[StrictInt] = None
37
40
  artifact_size: Optional[StrictInt] = None
41
+ manifest: Optional[ModelVersionManifest] = None
38
42
  __properties = [
39
43
  "id",
40
44
  "run_uuid",
@@ -44,6 +48,7 @@ class FinalizeArtifactVersionRequestDto(BaseModel):
44
48
  "data_path",
45
49
  "step",
46
50
  "artifact_size",
51
+ "manifest",
47
52
  ]
48
53
 
49
54
  class Config:
@@ -71,6 +76,9 @@ class FinalizeArtifactVersionRequestDto(BaseModel):
71
76
  # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of internal_metadata
72
77
  if self.internal_metadata:
73
78
  _dict["internal_metadata"] = self.internal_metadata.to_dict()
79
+ # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of manifest
80
+ if self.manifest:
81
+ _dict["manifest"] = self.manifest.to_dict()
74
82
  return _dict
75
83
 
76
84
  @classmethod
@@ -96,6 +104,9 @@ class FinalizeArtifactVersionRequestDto(BaseModel):
96
104
  "data_path": obj.get("data_path"),
97
105
  "step": obj.get("step"),
98
106
  "artifact_size": obj.get("artifact_size"),
107
+ "manifest": ModelVersionManifest.from_dict(obj.get("manifest"))
108
+ if obj.get("manifest") is not None
109
+ else None,
99
110
  }
100
111
  )
101
112
  return _obj
@@ -0,0 +1,154 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re # noqa: F401
19
+ from typing import TYPE_CHECKING, Any, List, Optional, Union
20
+
21
+ from truefoundry.ml.autogen.client.models.tensorflow_framework import (
22
+ TensorflowFramework,
23
+ )
24
+ from truefoundry.ml.autogen.client.models.transformers_framework import (
25
+ TransformersFramework,
26
+ )
27
+ from truefoundry.pydantic_v1 import (
28
+ BaseModel,
29
+ Field,
30
+ ValidationError,
31
+ validator,
32
+ )
33
+
34
+ FRAMEWORK_ANY_OF_SCHEMAS = ["TensorflowFramework", "TransformersFramework"]
35
+
36
+
37
+ class Framework(BaseModel):
38
+ """
39
+ +label=Framework +usage=Framework for the model version +docs=Framework for the model version
40
+ """
41
+
42
+ # data type: TransformersFramework
43
+ anyof_schema_1_validator: Optional[TransformersFramework] = None
44
+ # data type: TensorflowFramework
45
+ anyof_schema_2_validator: Optional[TensorflowFramework] = None
46
+ if TYPE_CHECKING:
47
+ actual_instance: Union[TensorflowFramework, TransformersFramework]
48
+ else:
49
+ actual_instance: Any
50
+ any_of_schemas: List[str] = Field(FRAMEWORK_ANY_OF_SCHEMAS, const=True)
51
+
52
+ class Config:
53
+ validate_assignment = True
54
+
55
+ def __init__(self, *args, **kwargs) -> None:
56
+ if args:
57
+ if len(args) > 1:
58
+ raise ValueError(
59
+ "If a position argument is used, only 1 is allowed to set `actual_instance`"
60
+ )
61
+ if kwargs:
62
+ raise ValueError(
63
+ "If a position argument is used, keyword arguments cannot be used."
64
+ )
65
+ super().__init__(actual_instance=args[0])
66
+ else:
67
+ super().__init__(**kwargs)
68
+
69
+ @validator("actual_instance")
70
+ def actual_instance_must_validate_anyof(cls, v):
71
+ instance = Framework.construct()
72
+ error_messages = []
73
+ # validate data type: TransformersFramework
74
+ if not isinstance(v, TransformersFramework):
75
+ error_messages.append(
76
+ f"Error! Input type `{type(v)}` is not `TransformersFramework`"
77
+ )
78
+ else:
79
+ return v
80
+
81
+ # validate data type: TensorflowFramework
82
+ if not isinstance(v, TensorflowFramework):
83
+ error_messages.append(
84
+ f"Error! Input type `{type(v)}` is not `TensorflowFramework`"
85
+ )
86
+ else:
87
+ return v
88
+
89
+ if error_messages:
90
+ # no match
91
+ raise ValueError(
92
+ "No match found when setting the actual_instance in Framework with anyOf schemas: TensorflowFramework, TransformersFramework. Details: "
93
+ + ", ".join(error_messages)
94
+ )
95
+ else:
96
+ return v
97
+
98
+ @classmethod
99
+ def from_dict(cls, obj: dict) -> Framework:
100
+ return cls.from_json(json.dumps(obj))
101
+
102
+ @classmethod
103
+ def from_json(cls, json_str: str) -> Framework:
104
+ """Returns the object represented by the json string"""
105
+ instance = Framework.construct()
106
+ error_messages = []
107
+ # anyof_schema_1_validator: Optional[TransformersFramework] = None
108
+ try:
109
+ instance.actual_instance = TransformersFramework.from_json(json_str)
110
+ return instance
111
+ except (ValidationError, ValueError) as e:
112
+ error_messages.append(str(e))
113
+ # anyof_schema_2_validator: Optional[TensorflowFramework] = None
114
+ try:
115
+ instance.actual_instance = TensorflowFramework.from_json(json_str)
116
+ return instance
117
+ except (ValidationError, ValueError) as e:
118
+ error_messages.append(str(e))
119
+
120
+ if error_messages:
121
+ # no match
122
+ raise ValueError(
123
+ "No match found when deserializing the JSON string into Framework with anyOf schemas: TensorflowFramework, TransformersFramework. Details: "
124
+ + ", ".join(error_messages)
125
+ )
126
+ else:
127
+ return instance
128
+
129
+ def to_json(self) -> str:
130
+ """Returns the JSON representation of the actual instance"""
131
+ if self.actual_instance is None:
132
+ return "null"
133
+
134
+ to_json = getattr(self.actual_instance, "to_json", None)
135
+ if callable(to_json):
136
+ return self.actual_instance.to_json()
137
+ else:
138
+ return json.dumps(self.actual_instance)
139
+
140
+ def to_dict(self) -> dict:
141
+ """Returns the dict representation of the actual instance"""
142
+ if self.actual_instance is None:
143
+ return "null"
144
+
145
+ to_json = getattr(self.actual_instance, "to_json", None)
146
+ if callable(to_json):
147
+ return self.actual_instance.to_dict()
148
+ else:
149
+ # primitive type
150
+ return self.actual_instance
151
+
152
+ def to_str(self) -> str:
153
+ """Returns the string representation of the actual instance"""
154
+ return pprint.pformat(self.dict())
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ import json
15
+ import re # noqa: F401
16
+
17
+ from aenum import Enum
18
+
19
+
20
+ class LibraryName(str, Enum):
21
+ """
22
+ +label=Library Name +usage=Name of the library for the framework
23
+ """
24
+
25
+ """
26
+ allowed enum values
27
+ """
28
+ TRANSFORMERS = "transformers"
29
+ SENTENCE_MINUS_TRANSFORMERS = "sentence-transformers"
30
+ DIFFUSERS = "diffusers"
31
+
32
+ @classmethod
33
+ def from_json(cls, json_str: str) -> LibraryName:
34
+ """Create an instance of LibraryName from a JSON string"""
35
+ return LibraryName(json.loads(json_str))
@@ -22,6 +22,7 @@ from typing import Optional
22
22
  from truefoundry.ml.autogen.client.models.artifact_type import ArtifactType
23
23
  from truefoundry.ml.autogen.client.models.experiment_dto import ExperimentDto
24
24
  from truefoundry.ml.autogen.client.models.model_version_dto import ModelVersionDto
25
+ from truefoundry.ml.autogen.client.models.subject import Subject
25
26
  from truefoundry.pydantic_v1 import BaseModel, Field, StrictBool, StrictStr
26
27
 
27
28
 
@@ -37,6 +38,7 @@ class ModelDto(BaseModel):
37
38
  fqn: StrictStr = Field(...)
38
39
  description: Optional[StrictStr] = None
39
40
  created_by: Optional[StrictStr] = None
41
+ created_by_subject: Subject = Field(...)
40
42
  created_at: Optional[datetime] = None
41
43
  updated_at: Optional[datetime] = None
42
44
  artifact_storage_root: Optional[StrictStr] = None
@@ -51,6 +53,7 @@ class ModelDto(BaseModel):
51
53
  "fqn",
52
54
  "description",
53
55
  "created_by",
56
+ "created_by_subject",
54
57
  "created_at",
55
58
  "updated_at",
56
59
  "artifact_storage_root",
@@ -81,6 +84,9 @@ class ModelDto(BaseModel):
81
84
  def to_dict(self):
82
85
  """Returns the dictionary representation of the model using alias"""
83
86
  _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
87
+ # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of created_by_subject
88
+ if self.created_by_subject:
89
+ _dict["created_by_subject"] = self.created_by_subject.to_dict()
84
90
  # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of latest_version
85
91
  if self.latest_version:
86
92
  _dict["latest_version"] = self.latest_version.to_dict()
@@ -107,6 +113,9 @@ class ModelDto(BaseModel):
107
113
  "fqn": obj.get("fqn"),
108
114
  "description": obj.get("description"),
109
115
  "created_by": obj.get("created_by"),
116
+ "created_by_subject": Subject.from_dict(obj.get("created_by_subject"))
117
+ if obj.get("created_by_subject") is not None
118
+ else None,
110
119
  "created_at": obj.get("created_at"),
111
120
  "updated_at": obj.get("updated_at"),
112
121
  "artifact_storage_root": obj.get("artifact_storage_root"),
@@ -19,11 +19,18 @@ import re # noqa: F401
19
19
  from datetime import datetime
20
20
  from typing import Any, Dict, Optional
21
21
 
22
+ from truefoundry.ml.autogen.client.models.artifact_version_serialization_format import (
23
+ ArtifactVersionSerializationFormat,
24
+ )
22
25
  from truefoundry.ml.autogen.client.models.artifact_version_status import (
23
26
  ArtifactVersionStatus,
24
27
  )
25
28
  from truefoundry.ml.autogen.client.models.metric_dto import MetricDto
26
29
  from truefoundry.ml.autogen.client.models.model_schema_dto import ModelSchemaDto
30
+ from truefoundry.ml.autogen.client.models.model_version_manifest import (
31
+ ModelVersionManifest,
32
+ )
33
+ from truefoundry.ml.autogen.client.models.subject import Subject
27
34
  from truefoundry.pydantic_v1 import (
28
35
  BaseModel,
29
36
  Field,
@@ -50,6 +57,7 @@ class ModelVersionDto(BaseModel):
50
57
  status: Optional[ArtifactVersionStatus] = None
51
58
  step: Optional[StrictInt] = 0
52
59
  created_by: Optional[StrictStr] = None
60
+ created_by_subject: Subject = Field(...)
53
61
  model_schema: Optional[ModelSchemaDto] = None
54
62
  custom_metrics: Optional[conlist(Dict[str, Any])] = None
55
63
  created_at: Optional[datetime] = None
@@ -63,6 +71,8 @@ class ModelVersionDto(BaseModel):
63
71
  model_name: Optional[StrictStr] = None
64
72
  model_framework: Optional[StrictStr] = None
65
73
  artifact_size: Optional[StrictInt] = None
74
+ manifest: Optional[ModelVersionManifest] = None
75
+ serialization_format: ArtifactVersionSerializationFormat = Field(...)
66
76
  __properties = [
67
77
  "id",
68
78
  "model_id",
@@ -75,6 +85,7 @@ class ModelVersionDto(BaseModel):
75
85
  "status",
76
86
  "step",
77
87
  "created_by",
88
+ "created_by_subject",
78
89
  "model_schema",
79
90
  "custom_metrics",
80
91
  "created_at",
@@ -88,6 +99,8 @@ class ModelVersionDto(BaseModel):
88
99
  "model_name",
89
100
  "model_framework",
90
101
  "artifact_size",
102
+ "manifest",
103
+ "serialization_format",
91
104
  ]
92
105
 
93
106
  class Config:
@@ -112,6 +125,9 @@ class ModelVersionDto(BaseModel):
112
125
  def to_dict(self):
113
126
  """Returns the dictionary representation of the model using alias"""
114
127
  _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
128
+ # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of created_by_subject
129
+ if self.created_by_subject:
130
+ _dict["created_by_subject"] = self.created_by_subject.to_dict()
115
131
  # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of model_schema
116
132
  if self.model_schema:
117
133
  _dict["model_schema"] = self.model_schema.to_dict()
@@ -122,6 +138,9 @@ class ModelVersionDto(BaseModel):
122
138
  if _item:
123
139
  _items.append(_item.to_dict())
124
140
  _dict["metrics"] = _items
141
+ # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of manifest
142
+ if self.manifest:
143
+ _dict["manifest"] = self.manifest.to_dict()
125
144
  return _dict
126
145
 
127
146
  @classmethod
@@ -146,6 +165,9 @@ class ModelVersionDto(BaseModel):
146
165
  "status": obj.get("status"),
147
166
  "step": obj.get("step") if obj.get("step") is not None else 0,
148
167
  "created_by": obj.get("created_by"),
168
+ "created_by_subject": Subject.from_dict(obj.get("created_by_subject"))
169
+ if obj.get("created_by_subject") is not None
170
+ else None,
149
171
  "model_schema": ModelSchemaDto.from_dict(obj.get("model_schema"))
150
172
  if obj.get("model_schema") is not None
151
173
  else None,
@@ -165,6 +187,10 @@ class ModelVersionDto(BaseModel):
165
187
  "model_name": obj.get("model_name"),
166
188
  "model_framework": obj.get("model_framework"),
167
189
  "artifact_size": obj.get("artifact_size"),
190
+ "manifest": ModelVersionManifest.from_dict(obj.get("manifest"))
191
+ if obj.get("manifest") is not None
192
+ else None,
193
+ "serialization_format": obj.get("serialization_format"),
168
194
  }
169
195
  )
170
196
  return _obj
@@ -0,0 +1,119 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re # noqa: F401
19
+ from typing import Any, Dict, Optional
20
+
21
+ from truefoundry.ml.autogen.client.models.framework import Framework
22
+ from truefoundry.ml.autogen.client.models.source import Source
23
+ from truefoundry.pydantic_v1 import (
24
+ BaseModel,
25
+ Field,
26
+ StrictStr,
27
+ conint,
28
+ constr,
29
+ validator,
30
+ )
31
+
32
+
33
+ class ModelVersionManifest(BaseModel):
34
+ """
35
+ Model Version artifact. # noqa: E501
36
+ """
37
+
38
+ description: Optional[constr(strict=True, max_length=512)] = Field(
39
+ default=None,
40
+ description="+label=Description +docs=Description of the artifact version",
41
+ )
42
+ metadata: Dict[str, Any] = Field(
43
+ default=...,
44
+ description="+label=Metadata +docs=Metadata for the artifact version +usage=Metadata for the artifact version",
45
+ )
46
+ type: Optional[StrictStr] = "model-version"
47
+ source: Source = Field(...)
48
+ framework: Optional[Framework] = None
49
+ step: Optional[conint(strict=True, ge=0)] = Field(
50
+ default=0, description="+label=Step"
51
+ )
52
+ __properties = ["description", "metadata", "type", "source", "framework", "step"]
53
+
54
+ @validator("type")
55
+ def type_validate_enum(cls, value):
56
+ """Validates the enum"""
57
+ if value is None:
58
+ return value
59
+
60
+ if value not in ("model-version"):
61
+ raise ValueError("must be one of enum values ('model-version')")
62
+ return value
63
+
64
+ class Config:
65
+ """Pydantic configuration"""
66
+
67
+ allow_population_by_field_name = True
68
+ validate_assignment = True
69
+
70
+ def to_str(self) -> str:
71
+ """Returns the string representation of the model using alias"""
72
+ return pprint.pformat(self.dict(by_alias=True))
73
+
74
+ def to_json(self) -> str:
75
+ """Returns the JSON representation of the model using alias"""
76
+ return json.dumps(self.to_dict())
77
+
78
+ @classmethod
79
+ def from_json(cls, json_str: str) -> ModelVersionManifest:
80
+ """Create an instance of ModelVersionManifest from a JSON string"""
81
+ return cls.from_dict(json.loads(json_str))
82
+
83
+ def to_dict(self):
84
+ """Returns the dictionary representation of the model using alias"""
85
+ _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
86
+ # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of source
87
+ if self.source:
88
+ _dict["source"] = self.source.to_dict()
89
+ # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of framework
90
+ if self.framework:
91
+ _dict["framework"] = self.framework.to_dict()
92
+ return _dict
93
+
94
+ @classmethod
95
+ def from_dict(cls, obj: dict) -> ModelVersionManifest:
96
+ """Create an instance of ModelVersionManifest from a dict"""
97
+ if obj is None:
98
+ return None
99
+
100
+ if not isinstance(obj, dict):
101
+ return ModelVersionManifest.parse_obj(obj)
102
+
103
+ _obj = ModelVersionManifest.parse_obj(
104
+ {
105
+ "description": obj.get("description"),
106
+ "metadata": obj.get("metadata"),
107
+ "type": obj.get("type")
108
+ if obj.get("type") is not None
109
+ else "model-version",
110
+ "source": Source.from_dict(obj.get("source"))
111
+ if obj.get("source") is not None
112
+ else None,
113
+ "framework": Framework.from_dict(obj.get("framework"))
114
+ if obj.get("framework") is not None
115
+ else None,
116
+ "step": obj.get("step") if obj.get("step") is not None else 0,
117
+ }
118
+ )
119
+ return _obj