truefoundry 0.5.0rc3__py3-none-any.whl → 0.5.0rc4__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 (27) hide show
  1. truefoundry/deploy/v2/lib/deploy_workflow.py +8 -2
  2. truefoundry/ml/__init__.py +6 -3
  3. truefoundry/ml/autogen/client/__init__.py +9 -4
  4. truefoundry/ml/autogen/client/models/__init__.py +9 -4
  5. truefoundry/ml/autogen/client/models/artifact_version_dto.py +3 -5
  6. truefoundry/ml/autogen/client/models/artifact_version_manifest.py +111 -0
  7. truefoundry/ml/autogen/client/models/{external_model_source.py → external_artifact_source.py} +8 -8
  8. truefoundry/ml/autogen/client/models/finalize_artifact_version_request_dto.py +3 -5
  9. truefoundry/ml/autogen/client/models/manifest.py +154 -0
  10. truefoundry/ml/autogen/client/models/model_version_manifest.py +3 -3
  11. truefoundry/ml/autogen/client/models/source.py +23 -23
  12. truefoundry/ml/autogen/client/models/source1.py +154 -0
  13. truefoundry/ml/autogen/client/models/transformers_framework.py +6 -1
  14. truefoundry/ml/autogen/client/models/{truefoundry_model_source.py → true_foundry_artifact_source.py} +9 -9
  15. truefoundry/ml/autogen/client/models/update_artifact_version_request_dto.py +11 -1
  16. truefoundry/ml/autogen/client_README.md +5 -2
  17. truefoundry/ml/autogen/entities/artifacts.py +22 -8
  18. truefoundry/ml/log_types/artifacts/artifact.py +131 -63
  19. truefoundry/ml/log_types/artifacts/general_artifact.py +7 -26
  20. truefoundry/ml/log_types/artifacts/model.py +74 -81
  21. truefoundry/ml/mlfoundry_api.py +4 -4
  22. truefoundry/ml/mlfoundry_run.py +8 -5
  23. truefoundry/ml/model_framework.py +2 -2
  24. {truefoundry-0.5.0rc3.dist-info → truefoundry-0.5.0rc4.dist-info}/METADATA +2 -2
  25. {truefoundry-0.5.0rc3.dist-info → truefoundry-0.5.0rc4.dist-info}/RECORD +27 -24
  26. {truefoundry-0.5.0rc3.dist-info → truefoundry-0.5.0rc4.dist-info}/WHEEL +0 -0
  27. {truefoundry-0.5.0rc3.dist-info → truefoundry-0.5.0rc4.dist-info}/entry_points.txt +0 -0
@@ -11,7 +11,10 @@ from flytekit.configuration import (
11
11
  )
12
12
  from flytekit.configuration import Image as FlytekitImage
13
13
  from flytekit.models.launch_plan import LaunchPlan as FlyteLaunchPlan
14
- from flytekit.tools.repo import serialize as serialize_workflow
14
+ from flytekit.tools.repo import (
15
+ serialize_get_control_plane_entities as get_serialized_entities,
16
+ )
17
+ from flytekit.tools.repo import serialize_load_only as serialize_workflow
15
18
  from flytekit.tools.translator import TaskSpec as FlyteTaskSpec
16
19
  from flytekit.tools.translator import WorkflowSpec as FlyteWorkflowSpec
17
20
  from google.protobuf.json_format import MessageToDict
@@ -207,9 +210,12 @@ def _generate_manifest_for_workflow(
207
210
  project_root_path=source_absolute_path, filepath=workflow_file_absolute_path
208
211
  )
209
212
 
210
- workflow_entities = serialize_workflow(
213
+ serialize_workflow(
211
214
  pkgs=[package_path], settings=settings, local_source_root=source_absolute_path
212
215
  )
216
+ workflow_entities = get_serialized_entities(
217
+ settings, local_source_root=source_absolute_path
218
+ )
213
219
  _validate_workflow_entities(workflow_entities, source_absolute_path)
214
220
 
215
221
  workflow.flyte_entities = []
@@ -8,10 +8,13 @@ from truefoundry.ml.enums import (
8
8
  )
9
9
  from truefoundry.ml.exceptions import MlFoundryException
10
10
  from truefoundry.ml.log_types import Image, Plot
11
- from truefoundry.ml.log_types.artifacts.artifact import ArtifactPath, ArtifactVersion
11
+ from truefoundry.ml.log_types.artifacts.artifact import (
12
+ ArtifactPath,
13
+ ArtifactVersion,
14
+ BlobStorageDirectory,
15
+ )
12
16
  from truefoundry.ml.log_types.artifacts.dataset import DataDirectory, DataDirectoryPath
13
17
  from truefoundry.ml.log_types.artifacts.model import (
14
- BlobStorageModelDirectory,
15
18
  ModelVersion,
16
19
  )
17
20
  from truefoundry.ml.logger import init_logger
@@ -38,7 +41,7 @@ from truefoundry.ml.model_framework import (
38
41
  __all__ = [
39
42
  "ArtifactPath",
40
43
  "ArtifactVersion",
41
- "BlobStorageModelDirectory",
44
+ "BlobStorageDirectory",
42
45
  "DataDirectory",
43
46
  "DataDirectoryPath",
44
47
  "DataSlice",
@@ -61,6 +61,9 @@ from truefoundry.ml.autogen.client.models.artifact_response_dto import (
61
61
  )
62
62
  from truefoundry.ml.autogen.client.models.artifact_type import ArtifactType
63
63
  from truefoundry.ml.autogen.client.models.artifact_version_dto import ArtifactVersionDto
64
+ from truefoundry.ml.autogen.client.models.artifact_version_manifest import (
65
+ ArtifactVersionManifest,
66
+ )
64
67
  from truefoundry.ml.autogen.client.models.artifact_version_response_dto import (
65
68
  ArtifactVersionResponseDto,
66
69
  )
@@ -169,8 +172,8 @@ from truefoundry.ml.autogen.client.models.experiment_response_dto import (
169
172
  ExperimentResponseDto,
170
173
  )
171
174
  from truefoundry.ml.autogen.client.models.experiment_tag_dto import ExperimentTagDto
172
- from truefoundry.ml.autogen.client.models.external_model_source import (
173
- ExternalModelSource,
175
+ from truefoundry.ml.autogen.client.models.external_artifact_source import (
176
+ ExternalArtifactSource,
174
177
  )
175
178
  from truefoundry.ml.autogen.client.models.fast_ai_framework import FastAIFramework
176
179
  from truefoundry.ml.autogen.client.models.feature_dto import FeatureDto
@@ -300,6 +303,7 @@ from truefoundry.ml.autogen.client.models.log_metric_request_dto import (
300
303
  from truefoundry.ml.autogen.client.models.log_param_request_dto import (
301
304
  LogParamRequestDto,
302
305
  )
306
+ from truefoundry.ml.autogen.client.models.manifest import Manifest
303
307
  from truefoundry.ml.autogen.client.models.method import Method
304
308
  from truefoundry.ml.autogen.client.models.metric_collection_dto import (
305
309
  MetricCollectionDto,
@@ -362,6 +366,7 @@ from truefoundry.ml.autogen.client.models.set_tag_request_dto import SetTagReque
362
366
  from truefoundry.ml.autogen.client.models.signed_url_dto import SignedURLDto
363
367
  from truefoundry.ml.autogen.client.models.sklearn_framework import SklearnFramework
364
368
  from truefoundry.ml.autogen.client.models.source import Source
369
+ from truefoundry.ml.autogen.client.models.source1 import Source1
365
370
  from truefoundry.ml.autogen.client.models.spa_cy_framework import SpaCyFramework
366
371
  from truefoundry.ml.autogen.client.models.stats_models_framework import (
367
372
  StatsModelsFramework,
@@ -387,8 +392,8 @@ from truefoundry.ml.autogen.client.models.trigger_job_run_config_request_dto imp
387
392
  from truefoundry.ml.autogen.client.models.trigger_job_run_config_response_dto import (
388
393
  TriggerJobRunConfigResponseDto,
389
394
  )
390
- from truefoundry.ml.autogen.client.models.truefoundry_model_source import (
391
- TruefoundryModelSource,
395
+ from truefoundry.ml.autogen.client.models.true_foundry_artifact_source import (
396
+ TrueFoundryArtifactSource,
392
397
  )
393
398
  from truefoundry.ml.autogen.client.models.update_artifact_version_request_dto import (
394
399
  UpdateArtifactVersionRequestDto,
@@ -32,6 +32,9 @@ from truefoundry.ml.autogen.client.models.artifact_response_dto import (
32
32
  )
33
33
  from truefoundry.ml.autogen.client.models.artifact_type import ArtifactType
34
34
  from truefoundry.ml.autogen.client.models.artifact_version_dto import ArtifactVersionDto
35
+ from truefoundry.ml.autogen.client.models.artifact_version_manifest import (
36
+ ArtifactVersionManifest,
37
+ )
35
38
  from truefoundry.ml.autogen.client.models.artifact_version_response_dto import (
36
39
  ArtifactVersionResponseDto,
37
40
  )
@@ -140,8 +143,8 @@ from truefoundry.ml.autogen.client.models.experiment_response_dto import (
140
143
  ExperimentResponseDto,
141
144
  )
142
145
  from truefoundry.ml.autogen.client.models.experiment_tag_dto import ExperimentTagDto
143
- from truefoundry.ml.autogen.client.models.external_model_source import (
144
- ExternalModelSource,
146
+ from truefoundry.ml.autogen.client.models.external_artifact_source import (
147
+ ExternalArtifactSource,
145
148
  )
146
149
  from truefoundry.ml.autogen.client.models.fast_ai_framework import FastAIFramework
147
150
  from truefoundry.ml.autogen.client.models.feature_dto import FeatureDto
@@ -271,6 +274,7 @@ from truefoundry.ml.autogen.client.models.log_metric_request_dto import (
271
274
  from truefoundry.ml.autogen.client.models.log_param_request_dto import (
272
275
  LogParamRequestDto,
273
276
  )
277
+ from truefoundry.ml.autogen.client.models.manifest import Manifest
274
278
  from truefoundry.ml.autogen.client.models.method import Method
275
279
  from truefoundry.ml.autogen.client.models.metric_collection_dto import (
276
280
  MetricCollectionDto,
@@ -333,6 +337,7 @@ from truefoundry.ml.autogen.client.models.set_tag_request_dto import SetTagReque
333
337
  from truefoundry.ml.autogen.client.models.signed_url_dto import SignedURLDto
334
338
  from truefoundry.ml.autogen.client.models.sklearn_framework import SklearnFramework
335
339
  from truefoundry.ml.autogen.client.models.source import Source
340
+ from truefoundry.ml.autogen.client.models.source1 import Source1
336
341
  from truefoundry.ml.autogen.client.models.spa_cy_framework import SpaCyFramework
337
342
  from truefoundry.ml.autogen.client.models.stats_models_framework import (
338
343
  StatsModelsFramework,
@@ -358,8 +363,8 @@ from truefoundry.ml.autogen.client.models.trigger_job_run_config_request_dto imp
358
363
  from truefoundry.ml.autogen.client.models.trigger_job_run_config_response_dto import (
359
364
  TriggerJobRunConfigResponseDto,
360
365
  )
361
- from truefoundry.ml.autogen.client.models.truefoundry_model_source import (
362
- TruefoundryModelSource,
366
+ from truefoundry.ml.autogen.client.models.true_foundry_artifact_source import (
367
+ TrueFoundryArtifactSource,
363
368
  )
364
369
  from truefoundry.ml.autogen.client.models.update_artifact_version_request_dto import (
365
370
  UpdateArtifactVersionRequestDto,
@@ -26,9 +26,7 @@ from truefoundry.ml.autogen.client.models.artifact_version_status import (
26
26
  ArtifactVersionStatus,
27
27
  )
28
28
  from truefoundry.ml.autogen.client.models.internal_metadata import InternalMetadata
29
- from truefoundry.ml.autogen.client.models.model_version_manifest import (
30
- ModelVersionManifest,
31
- )
29
+ from truefoundry.ml.autogen.client.models.manifest import Manifest
32
30
  from truefoundry.ml.autogen.client.models.subject import Subject
33
31
  from truefoundry.pydantic_v1 import BaseModel, Field, StrictInt, StrictStr
34
32
 
@@ -59,7 +57,7 @@ class ArtifactVersionDto(BaseModel):
59
57
  artifact_name: Optional[StrictStr] = None
60
58
  internal_metadata: Optional[InternalMetadata] = None
61
59
  artifact_size: Optional[StrictInt] = None
62
- manifest: Optional[ModelVersionManifest] = None
60
+ manifest: Optional[Manifest] = None
63
61
  serialization_format: ArtifactVersionSerializationFormat = Field(...)
64
62
  __properties = [
65
63
  "id",
@@ -158,7 +156,7 @@ class ArtifactVersionDto(BaseModel):
158
156
  if obj.get("internal_metadata") is not None
159
157
  else None,
160
158
  "artifact_size": obj.get("artifact_size"),
161
- "manifest": ModelVersionManifest.from_dict(obj.get("manifest"))
159
+ "manifest": Manifest.from_dict(obj.get("manifest"))
162
160
  if obj.get("manifest") is not None
163
161
  else None,
164
162
  "serialization_format": obj.get("serialization_format"),
@@ -0,0 +1,111 @@
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.source import Source
22
+ from truefoundry.pydantic_v1 import (
23
+ BaseModel,
24
+ Field,
25
+ StrictStr,
26
+ conint,
27
+ constr,
28
+ validator,
29
+ )
30
+
31
+
32
+ class ArtifactVersionManifest(BaseModel):
33
+ """
34
+ Artifact Version manifest. # noqa: E501
35
+ """
36
+
37
+ description: Optional[constr(strict=True, max_length=512)] = Field(
38
+ default=None,
39
+ description="+label=Description +docs=Description of the artifact version",
40
+ )
41
+ metadata: Dict[str, Any] = Field(
42
+ default=...,
43
+ description="+label=Metadata +docs=Metadata for the model version +usage=Metadata for the model version +uiType=JsonInput",
44
+ )
45
+ type: Optional[StrictStr] = "artifact-version"
46
+ source: Source = Field(...)
47
+ step: Optional[conint(strict=True, ge=0)] = Field(
48
+ default=0, description="+label=Step"
49
+ )
50
+ __properties = ["description", "metadata", "type", "source", "step"]
51
+
52
+ @validator("type")
53
+ def type_validate_enum(cls, value):
54
+ """Validates the enum"""
55
+ if value is None:
56
+ return value
57
+
58
+ if value not in ("artifact-version"):
59
+ raise ValueError("must be one of enum values ('artifact-version')")
60
+ return value
61
+
62
+ class Config:
63
+ """Pydantic configuration"""
64
+
65
+ allow_population_by_field_name = True
66
+ validate_assignment = True
67
+
68
+ def to_str(self) -> str:
69
+ """Returns the string representation of the model using alias"""
70
+ return pprint.pformat(self.dict(by_alias=True))
71
+
72
+ def to_json(self) -> str:
73
+ """Returns the JSON representation of the model using alias"""
74
+ return json.dumps(self.to_dict())
75
+
76
+ @classmethod
77
+ def from_json(cls, json_str: str) -> ArtifactVersionManifest:
78
+ """Create an instance of ArtifactVersionManifest from a JSON string"""
79
+ return cls.from_dict(json.loads(json_str))
80
+
81
+ def to_dict(self):
82
+ """Returns the dictionary representation of the model using alias"""
83
+ _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
84
+ # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of source
85
+ if self.source:
86
+ _dict["source"] = self.source.to_dict()
87
+ return _dict
88
+
89
+ @classmethod
90
+ def from_dict(cls, obj: dict) -> ArtifactVersionManifest:
91
+ """Create an instance of ArtifactVersionManifest from a dict"""
92
+ if obj is None:
93
+ return None
94
+
95
+ if not isinstance(obj, dict):
96
+ return ArtifactVersionManifest.parse_obj(obj)
97
+
98
+ _obj = ArtifactVersionManifest.parse_obj(
99
+ {
100
+ "description": obj.get("description"),
101
+ "metadata": obj.get("metadata"),
102
+ "type": obj.get("type")
103
+ if obj.get("type") is not None
104
+ else "artifact-version",
105
+ "source": Source.from_dict(obj.get("source"))
106
+ if obj.get("source") is not None
107
+ else None,
108
+ "step": obj.get("step") if obj.get("step") is not None else 0,
109
+ }
110
+ )
111
+ return _obj
@@ -20,7 +20,7 @@ import re # noqa: F401
20
20
  from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
21
21
 
22
22
 
23
- class ExternalModelSource(BaseModel):
23
+ class ExternalArtifactSource(BaseModel):
24
24
  """
25
25
  +label=External # noqa: E501
26
26
  """
@@ -30,7 +30,7 @@ class ExternalModelSource(BaseModel):
30
30
  description="+label=Type +usage=Type of the source +value=external +type=External",
31
31
  )
32
32
  uri: StrictStr = Field(
33
- default=..., description="+label=URI +usage=URI of the model source"
33
+ default=..., description="+label=URI +usage=URI of the Artifact source"
34
34
  )
35
35
  __properties = ["type", "uri"]
36
36
 
@@ -56,8 +56,8 @@ class ExternalModelSource(BaseModel):
56
56
  return json.dumps(self.to_dict())
57
57
 
58
58
  @classmethod
59
- def from_json(cls, json_str: str) -> ExternalModelSource:
60
- """Create an instance of ExternalModelSource from a JSON string"""
59
+ def from_json(cls, json_str: str) -> ExternalArtifactSource:
60
+ """Create an instance of ExternalArtifactSource from a JSON string"""
61
61
  return cls.from_dict(json.loads(json_str))
62
62
 
63
63
  def to_dict(self):
@@ -66,15 +66,15 @@ class ExternalModelSource(BaseModel):
66
66
  return _dict
67
67
 
68
68
  @classmethod
69
- def from_dict(cls, obj: dict) -> ExternalModelSource:
70
- """Create an instance of ExternalModelSource from a dict"""
69
+ def from_dict(cls, obj: dict) -> ExternalArtifactSource:
70
+ """Create an instance of ExternalArtifactSource from a dict"""
71
71
  if obj is None:
72
72
  return None
73
73
 
74
74
  if not isinstance(obj, dict):
75
- return ExternalModelSource.parse_obj(obj)
75
+ return ExternalArtifactSource.parse_obj(obj)
76
76
 
77
- _obj = ExternalModelSource.parse_obj(
77
+ _obj = ExternalArtifactSource.parse_obj(
78
78
  {"type": obj.get("type"), "uri": obj.get("uri")}
79
79
  )
80
80
  return _obj
@@ -19,9 +19,7 @@ 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
+ from truefoundry.ml.autogen.client.models.manifest import Manifest
25
23
  from truefoundry.pydantic_v1 import BaseModel, Field, StrictInt, StrictStr
26
24
 
27
25
 
@@ -38,7 +36,7 @@ class FinalizeArtifactVersionRequestDto(BaseModel):
38
36
  data_path: Optional[StrictStr] = None
39
37
  step: Optional[StrictInt] = None
40
38
  artifact_size: Optional[StrictInt] = None
41
- manifest: Optional[ModelVersionManifest] = None
39
+ manifest: Optional[Manifest] = None
42
40
  __properties = [
43
41
  "id",
44
42
  "run_uuid",
@@ -104,7 +102,7 @@ class FinalizeArtifactVersionRequestDto(BaseModel):
104
102
  "data_path": obj.get("data_path"),
105
103
  "step": obj.get("step"),
106
104
  "artifact_size": obj.get("artifact_size"),
107
- "manifest": ModelVersionManifest.from_dict(obj.get("manifest"))
105
+ "manifest": Manifest.from_dict(obj.get("manifest"))
108
106
  if obj.get("manifest") is not None
109
107
  else None,
110
108
  }
@@ -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.artifact_version_manifest import (
22
+ ArtifactVersionManifest,
23
+ )
24
+ from truefoundry.ml.autogen.client.models.model_version_manifest import (
25
+ ModelVersionManifest,
26
+ )
27
+ from truefoundry.pydantic_v1 import (
28
+ BaseModel,
29
+ Field,
30
+ ValidationError,
31
+ validator,
32
+ )
33
+
34
+ MANIFEST_ANY_OF_SCHEMAS = ["ArtifactVersionManifest", "ModelVersionManifest"]
35
+
36
+
37
+ class Manifest(BaseModel):
38
+ """
39
+ Manifest
40
+ """
41
+
42
+ # data type: ModelVersionManifest
43
+ anyof_schema_1_validator: Optional[ModelVersionManifest] = None
44
+ # data type: ArtifactVersionManifest
45
+ anyof_schema_2_validator: Optional[ArtifactVersionManifest] = None
46
+ if TYPE_CHECKING:
47
+ actual_instance: Union[ArtifactVersionManifest, ModelVersionManifest]
48
+ else:
49
+ actual_instance: Any
50
+ any_of_schemas: List[str] = Field(MANIFEST_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 = Manifest.construct()
72
+ error_messages = []
73
+ # validate data type: ModelVersionManifest
74
+ if not isinstance(v, ModelVersionManifest):
75
+ error_messages.append(
76
+ f"Error! Input type `{type(v)}` is not `ModelVersionManifest`"
77
+ )
78
+ else:
79
+ return v
80
+
81
+ # validate data type: ArtifactVersionManifest
82
+ if not isinstance(v, ArtifactVersionManifest):
83
+ error_messages.append(
84
+ f"Error! Input type `{type(v)}` is not `ArtifactVersionManifest`"
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 Manifest with anyOf schemas: ArtifactVersionManifest, ModelVersionManifest. Details: "
93
+ + ", ".join(error_messages)
94
+ )
95
+ else:
96
+ return v
97
+
98
+ @classmethod
99
+ def from_dict(cls, obj: dict) -> Manifest:
100
+ return cls.from_json(json.dumps(obj))
101
+
102
+ @classmethod
103
+ def from_json(cls, json_str: str) -> Manifest:
104
+ """Returns the object represented by the json string"""
105
+ instance = Manifest.construct()
106
+ error_messages = []
107
+ # anyof_schema_1_validator: Optional[ModelVersionManifest] = None
108
+ try:
109
+ instance.actual_instance = ModelVersionManifest.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[ArtifactVersionManifest] = None
114
+ try:
115
+ instance.actual_instance = ArtifactVersionManifest.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 Manifest with anyOf schemas: ArtifactVersionManifest, ModelVersionManifest. 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())
@@ -19,7 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, Dict, Optional
20
20
 
21
21
  from truefoundry.ml.autogen.client.models.framework import Framework
22
- from truefoundry.ml.autogen.client.models.source import Source
22
+ from truefoundry.ml.autogen.client.models.source1 import Source1
23
23
  from truefoundry.pydantic_v1 import (
24
24
  BaseModel,
25
25
  Field,
@@ -44,7 +44,7 @@ class ModelVersionManifest(BaseModel):
44
44
  description="+label=Metadata +docs=Metadata for the model version +usage=Metadata for the model version +uiType=JsonInput",
45
45
  )
46
46
  type: Optional[StrictStr] = "model-version"
47
- source: Source = Field(...)
47
+ source: Source1 = Field(...)
48
48
  framework: Optional[Framework] = None
49
49
  step: Optional[conint(strict=True, ge=0)] = Field(
50
50
  default=0, description="+label=Step"
@@ -107,7 +107,7 @@ class ModelVersionManifest(BaseModel):
107
107
  "type": obj.get("type")
108
108
  if obj.get("type") is not None
109
109
  else "model-version",
110
- "source": Source.from_dict(obj.get("source"))
110
+ "source": Source1.from_dict(obj.get("source"))
111
111
  if obj.get("source") is not None
112
112
  else None,
113
113
  "framework": Framework.from_dict(obj.get("framework"))
@@ -18,11 +18,11 @@ import pprint
18
18
  import re # noqa: F401
19
19
  from typing import TYPE_CHECKING, Any, List, Optional, Union
20
20
 
21
- from truefoundry.ml.autogen.client.models.external_model_source import (
22
- ExternalModelSource,
21
+ from truefoundry.ml.autogen.client.models.external_artifact_source import (
22
+ ExternalArtifactSource,
23
23
  )
24
- from truefoundry.ml.autogen.client.models.truefoundry_model_source import (
25
- TruefoundryModelSource,
24
+ from truefoundry.ml.autogen.client.models.true_foundry_artifact_source import (
25
+ TrueFoundryArtifactSource,
26
26
  )
27
27
  from truefoundry.pydantic_v1 import (
28
28
  BaseModel,
@@ -31,20 +31,20 @@ from truefoundry.pydantic_v1 import (
31
31
  validator,
32
32
  )
33
33
 
34
- SOURCE_ANY_OF_SCHEMAS = ["ExternalModelSource", "TruefoundryModelSource"]
34
+ SOURCE_ANY_OF_SCHEMAS = ["ExternalArtifactSource", "TrueFoundryArtifactSource"]
35
35
 
36
36
 
37
37
  class Source(BaseModel):
38
38
  """
39
- +label=Model Source +usage=Source for the model version +uiType=Group
39
+ +label=Artifact Source +usage=Source for the Artifact version +uiType=Group
40
40
  """
41
41
 
42
- # data type: TruefoundryModelSource
43
- anyof_schema_1_validator: Optional[TruefoundryModelSource] = None
44
- # data type: ExternalModelSource
45
- anyof_schema_2_validator: Optional[ExternalModelSource] = None
42
+ # data type: TrueFoundryArtifactSource
43
+ anyof_schema_1_validator: Optional[TrueFoundryArtifactSource] = None
44
+ # data type: ExternalArtifactSource
45
+ anyof_schema_2_validator: Optional[ExternalArtifactSource] = None
46
46
  if TYPE_CHECKING:
47
- actual_instance: Union[ExternalModelSource, TruefoundryModelSource]
47
+ actual_instance: Union[ExternalArtifactSource, TrueFoundryArtifactSource]
48
48
  else:
49
49
  actual_instance: Any
50
50
  any_of_schemas: List[str] = Field(SOURCE_ANY_OF_SCHEMAS, const=True)
@@ -70,18 +70,18 @@ class Source(BaseModel):
70
70
  def actual_instance_must_validate_anyof(cls, v):
71
71
  instance = Source.construct()
72
72
  error_messages = []
73
- # validate data type: TruefoundryModelSource
74
- if not isinstance(v, TruefoundryModelSource):
73
+ # validate data type: TrueFoundryArtifactSource
74
+ if not isinstance(v, TrueFoundryArtifactSource):
75
75
  error_messages.append(
76
- f"Error! Input type `{type(v)}` is not `TruefoundryModelSource`"
76
+ f"Error! Input type `{type(v)}` is not `TrueFoundryArtifactSource`"
77
77
  )
78
78
  else:
79
79
  return v
80
80
 
81
- # validate data type: ExternalModelSource
82
- if not isinstance(v, ExternalModelSource):
81
+ # validate data type: ExternalArtifactSource
82
+ if not isinstance(v, ExternalArtifactSource):
83
83
  error_messages.append(
84
- f"Error! Input type `{type(v)}` is not `ExternalModelSource`"
84
+ f"Error! Input type `{type(v)}` is not `ExternalArtifactSource`"
85
85
  )
86
86
  else:
87
87
  return v
@@ -89,7 +89,7 @@ class Source(BaseModel):
89
89
  if error_messages:
90
90
  # no match
91
91
  raise ValueError(
92
- "No match found when setting the actual_instance in Source with anyOf schemas: ExternalModelSource, TruefoundryModelSource. Details: "
92
+ "No match found when setting the actual_instance in Source with anyOf schemas: ExternalArtifactSource, TrueFoundryArtifactSource. Details: "
93
93
  + ", ".join(error_messages)
94
94
  )
95
95
  else:
@@ -104,15 +104,15 @@ class Source(BaseModel):
104
104
  """Returns the object represented by the json string"""
105
105
  instance = Source.construct()
106
106
  error_messages = []
107
- # anyof_schema_1_validator: Optional[TruefoundryModelSource] = None
107
+ # anyof_schema_1_validator: Optional[TrueFoundryArtifactSource] = None
108
108
  try:
109
- instance.actual_instance = TruefoundryModelSource.from_json(json_str)
109
+ instance.actual_instance = TrueFoundryArtifactSource.from_json(json_str)
110
110
  return instance
111
111
  except (ValidationError, ValueError) as e:
112
112
  error_messages.append(str(e))
113
- # anyof_schema_2_validator: Optional[ExternalModelSource] = None
113
+ # anyof_schema_2_validator: Optional[ExternalArtifactSource] = None
114
114
  try:
115
- instance.actual_instance = ExternalModelSource.from_json(json_str)
115
+ instance.actual_instance = ExternalArtifactSource.from_json(json_str)
116
116
  return instance
117
117
  except (ValidationError, ValueError) as e:
118
118
  error_messages.append(str(e))
@@ -120,7 +120,7 @@ class Source(BaseModel):
120
120
  if error_messages:
121
121
  # no match
122
122
  raise ValueError(
123
- "No match found when deserializing the JSON string into Source with anyOf schemas: ExternalModelSource, TruefoundryModelSource. Details: "
123
+ "No match found when deserializing the JSON string into Source with anyOf schemas: ExternalArtifactSource, TrueFoundryArtifactSource. Details: "
124
124
  + ", ".join(error_messages)
125
125
  )
126
126
  else: