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
@@ -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.external_artifact_source import (
22
+ ExternalArtifactSource,
23
+ )
24
+ from truefoundry.ml.autogen.client.models.true_foundry_artifact_source import (
25
+ TrueFoundryArtifactSource,
26
+ )
27
+ from truefoundry.pydantic_v1 import (
28
+ BaseModel,
29
+ Field,
30
+ ValidationError,
31
+ validator,
32
+ )
33
+
34
+ SOURCE1_ANY_OF_SCHEMAS = ["ExternalArtifactSource", "TrueFoundryArtifactSource"]
35
+
36
+
37
+ class Source1(BaseModel):
38
+ """
39
+ +label=Model Source +usage=Source for the model version +uiType=Group
40
+ """
41
+
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
+ if TYPE_CHECKING:
47
+ actual_instance: Union[ExternalArtifactSource, TrueFoundryArtifactSource]
48
+ else:
49
+ actual_instance: Any
50
+ any_of_schemas: List[str] = Field(SOURCE1_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 = Source1.construct()
72
+ error_messages = []
73
+ # validate data type: TrueFoundryArtifactSource
74
+ if not isinstance(v, TrueFoundryArtifactSource):
75
+ error_messages.append(
76
+ f"Error! Input type `{type(v)}` is not `TrueFoundryArtifactSource`"
77
+ )
78
+ else:
79
+ return v
80
+
81
+ # validate data type: ExternalArtifactSource
82
+ if not isinstance(v, ExternalArtifactSource):
83
+ error_messages.append(
84
+ f"Error! Input type `{type(v)}` is not `ExternalArtifactSource`"
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 Source1 with anyOf schemas: ExternalArtifactSource, TrueFoundryArtifactSource. Details: "
93
+ + ", ".join(error_messages)
94
+ )
95
+ else:
96
+ return v
97
+
98
+ @classmethod
99
+ def from_dict(cls, obj: dict) -> Source1:
100
+ return cls.from_json(json.dumps(obj))
101
+
102
+ @classmethod
103
+ def from_json(cls, json_str: str) -> Source1:
104
+ """Returns the object represented by the json string"""
105
+ instance = Source1.construct()
106
+ error_messages = []
107
+ # anyof_schema_1_validator: Optional[TrueFoundryArtifactSource] = None
108
+ try:
109
+ instance.actual_instance = TrueFoundryArtifactSource.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[ExternalArtifactSource] = None
114
+ try:
115
+ instance.actual_instance = ExternalArtifactSource.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 Source1 with anyOf schemas: ExternalArtifactSource, TrueFoundryArtifactSource. 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())
@@ -39,7 +39,11 @@ class TransformersFramework(BaseModel):
39
39
  default=None,
40
40
  description="+label=Pipeline Tag +usage=Pipeline tag +docs=Pipeline tag for the framework",
41
41
  )
42
- __properties = ["type", "library_name", "pipeline_tag"]
42
+ base_model: Optional[StrictStr] = Field(
43
+ default=None,
44
+ description="+label=Base Model +usage=Base model +docs=Base model Id. If this is a finetuned model, this points to the base model used for finetuning",
45
+ )
46
+ __properties = ["type", "library_name", "pipeline_tag", "base_model"]
43
47
 
44
48
  @validator("type")
45
49
  def type_validate_enum(cls, value):
@@ -86,6 +90,7 @@ class TransformersFramework(BaseModel):
86
90
  "type": obj.get("type"),
87
91
  "library_name": obj.get("library_name"),
88
92
  "pipeline_tag": obj.get("pipeline_tag"),
93
+ "base_model": obj.get("base_model"),
89
94
  }
90
95
  )
91
96
  return _obj
@@ -20,9 +20,9 @@ import re # noqa: F401
20
20
  from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
21
21
 
22
22
 
23
- class TruefoundryModelSource(BaseModel):
23
+ class TrueFoundryArtifactSource(BaseModel):
24
24
  """
25
- +usage=Source for the Model +label=Upload # noqa: E501
25
+ +usage=Source for the Artifact or Model +label=Upload # noqa: E501
26
26
  """
27
27
 
28
28
  type: StrictStr = Field(
@@ -31,7 +31,7 @@ class TruefoundryModelSource(BaseModel):
31
31
  )
32
32
  uri: StrictStr = Field(
33
33
  default=...,
34
- description='+label=URI +uiType=UploadInput +uiProps={"hideClear":true}',
34
+ description='+label=URI +uiType=ModelUploadInput +uiProps={"hideClear":true}',
35
35
  )
36
36
  __properties = ["type", "uri"]
37
37
 
@@ -57,8 +57,8 @@ class TruefoundryModelSource(BaseModel):
57
57
  return json.dumps(self.to_dict())
58
58
 
59
59
  @classmethod
60
- def from_json(cls, json_str: str) -> TruefoundryModelSource:
61
- """Create an instance of TruefoundryModelSource from a JSON string"""
60
+ def from_json(cls, json_str: str) -> TrueFoundryArtifactSource:
61
+ """Create an instance of TrueFoundryArtifactSource from a JSON string"""
62
62
  return cls.from_dict(json.loads(json_str))
63
63
 
64
64
  def to_dict(self):
@@ -67,15 +67,15 @@ class TruefoundryModelSource(BaseModel):
67
67
  return _dict
68
68
 
69
69
  @classmethod
70
- def from_dict(cls, obj: dict) -> TruefoundryModelSource:
71
- """Create an instance of TruefoundryModelSource from a dict"""
70
+ def from_dict(cls, obj: dict) -> TrueFoundryArtifactSource:
71
+ """Create an instance of TrueFoundryArtifactSource from a dict"""
72
72
  if obj is None:
73
73
  return None
74
74
 
75
75
  if not isinstance(obj, dict):
76
- return TruefoundryModelSource.parse_obj(obj)
76
+ return TrueFoundryArtifactSource.parse_obj(obj)
77
77
 
78
- _obj = TruefoundryModelSource.parse_obj(
78
+ _obj = TrueFoundryArtifactSource.parse_obj(
79
79
  {"type": obj.get("type"), "uri": obj.get("uri")}
80
80
  )
81
81
  return _obj
@@ -18,6 +18,9 @@ import pprint
18
18
  import re # noqa: F401
19
19
  from typing import Any, Dict, Optional
20
20
 
21
+ from truefoundry.ml.autogen.client.models.artifact_version_manifest import (
22
+ ArtifactVersionManifest,
23
+ )
21
24
  from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr
22
25
 
23
26
 
@@ -29,7 +32,8 @@ class UpdateArtifactVersionRequestDto(BaseModel):
29
32
  id: StrictStr = Field(...)
30
33
  description: Optional[StrictStr] = None
31
34
  artifact_metadata: Optional[Dict[str, Any]] = None
32
- __properties = ["id", "description", "artifact_metadata"]
35
+ manifest: Optional[ArtifactVersionManifest] = None
36
+ __properties = ["id", "description", "artifact_metadata", "manifest"]
33
37
 
34
38
  class Config:
35
39
  """Pydantic configuration"""
@@ -53,6 +57,9 @@ class UpdateArtifactVersionRequestDto(BaseModel):
53
57
  def to_dict(self):
54
58
  """Returns the dictionary representation of the model using alias"""
55
59
  _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
60
+ # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of manifest
61
+ if self.manifest:
62
+ _dict["manifest"] = self.manifest.to_dict()
56
63
  return _dict
57
64
 
58
65
  @classmethod
@@ -69,6 +76,9 @@ class UpdateArtifactVersionRequestDto(BaseModel):
69
76
  "id": obj.get("id"),
70
77
  "description": obj.get("description"),
71
78
  "artifact_metadata": obj.get("artifact_metadata"),
79
+ "manifest": ArtifactVersionManifest.from_dict(obj.get("manifest"))
80
+ if obj.get("manifest") is not None
81
+ else None,
72
82
  }
73
83
  )
74
84
  return _obj
@@ -166,6 +166,7 @@ Class | Method | HTTP request | Description
166
166
  - [ArtifactResponseDto](truefoundry/ml/autogen/client/docs/ArtifactResponseDto.md)
167
167
  - [ArtifactType](truefoundry/ml/autogen/client/docs/ArtifactType.md)
168
168
  - [ArtifactVersionDto](truefoundry/ml/autogen/client/docs/ArtifactVersionDto.md)
169
+ - [ArtifactVersionManifest](truefoundry/ml/autogen/client/docs/ArtifactVersionManifest.md)
169
170
  - [ArtifactVersionResponseDto](truefoundry/ml/autogen/client/docs/ArtifactVersionResponseDto.md)
170
171
  - [ArtifactVersionSerializationFormat](truefoundry/ml/autogen/client/docs/ArtifactVersionSerializationFormat.md)
171
172
  - [ArtifactVersionStatus](truefoundry/ml/autogen/client/docs/ArtifactVersionStatus.md)
@@ -210,7 +211,7 @@ Class | Method | HTTP request | Description
210
211
  - [ExperimentIdRequestDto](truefoundry/ml/autogen/client/docs/ExperimentIdRequestDto.md)
211
212
  - [ExperimentResponseDto](truefoundry/ml/autogen/client/docs/ExperimentResponseDto.md)
212
213
  - [ExperimentTagDto](truefoundry/ml/autogen/client/docs/ExperimentTagDto.md)
213
- - [ExternalModelSource](truefoundry/ml/autogen/client/docs/ExternalModelSource.md)
214
+ - [ExternalArtifactSource](truefoundry/ml/autogen/client/docs/ExternalArtifactSource.md)
214
215
  - [FastAIFramework](truefoundry/ml/autogen/client/docs/FastAIFramework.md)
215
216
  - [FeatureDto](truefoundry/ml/autogen/client/docs/FeatureDto.md)
216
217
  - [FeatureValueType](truefoundry/ml/autogen/client/docs/FeatureValueType.md)
@@ -263,6 +264,7 @@ Class | Method | HTTP request | Description
263
264
  - [LogBatchRequestDto](truefoundry/ml/autogen/client/docs/LogBatchRequestDto.md)
264
265
  - [LogMetricRequestDto](truefoundry/ml/autogen/client/docs/LogMetricRequestDto.md)
265
266
  - [LogParamRequestDto](truefoundry/ml/autogen/client/docs/LogParamRequestDto.md)
267
+ - [Manifest](truefoundry/ml/autogen/client/docs/Manifest.md)
266
268
  - [Method](truefoundry/ml/autogen/client/docs/Method.md)
267
269
  - [MetricCollectionDto](truefoundry/ml/autogen/client/docs/MetricCollectionDto.md)
268
270
  - [MetricDto](truefoundry/ml/autogen/client/docs/MetricDto.md)
@@ -301,6 +303,7 @@ Class | Method | HTTP request | Description
301
303
  - [SignedURLDto](truefoundry/ml/autogen/client/docs/SignedURLDto.md)
302
304
  - [SklearnFramework](truefoundry/ml/autogen/client/docs/SklearnFramework.md)
303
305
  - [Source](truefoundry/ml/autogen/client/docs/Source.md)
306
+ - [Source1](truefoundry/ml/autogen/client/docs/Source1.md)
304
307
  - [SpaCyFramework](truefoundry/ml/autogen/client/docs/SpaCyFramework.md)
305
308
  - [StatsModelsFramework](truefoundry/ml/autogen/client/docs/StatsModelsFramework.md)
306
309
  - [Stop](truefoundry/ml/autogen/client/docs/Stop.md)
@@ -314,7 +317,7 @@ Class | Method | HTTP request | Description
314
317
  - [TransformersFramework](truefoundry/ml/autogen/client/docs/TransformersFramework.md)
315
318
  - [TriggerJobRunConfigRequestDto](truefoundry/ml/autogen/client/docs/TriggerJobRunConfigRequestDto.md)
316
319
  - [TriggerJobRunConfigResponseDto](truefoundry/ml/autogen/client/docs/TriggerJobRunConfigResponseDto.md)
317
- - [TruefoundryModelSource](truefoundry/ml/autogen/client/docs/TruefoundryModelSource.md)
320
+ - [TrueFoundryArtifactSource](truefoundry/ml/autogen/client/docs/TrueFoundryArtifactSource.md)
318
321
  - [UpdateArtifactVersionRequestDto](truefoundry/ml/autogen/client/docs/UpdateArtifactVersionRequestDto.md)
319
322
  - [UpdateDatasetRequestDto](truefoundry/ml/autogen/client/docs/UpdateDatasetRequestDto.md)
320
323
  - [UpdateExperimentRequestDto](truefoundry/ml/autogen/client/docs/UpdateExperimentRequestDto.md)
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: artifacts.json
3
- # timestamp: 2024-10-30T07:36:31+00:00
3
+ # timestamp: 2024-11-15T09:16:35+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -89,7 +89,7 @@ class BlobStorageReference(BaseModel):
89
89
  )
90
90
 
91
91
 
92
- class ExternalModelSource(BaseModel):
92
+ class ExternalArtifactSource(BaseModel):
93
93
  """
94
94
  +label=External
95
95
  """
@@ -98,7 +98,7 @@ class ExternalModelSource(BaseModel):
98
98
  ...,
99
99
  description="+label=Type\n+usage=Type of the source\n+value=external\n+type=External",
100
100
  )
101
- uri: str = Field(..., description="+label=URI\n+usage=URI of the model source")
101
+ uri: str = Field(..., description="+label=URI\n+usage=URI of the Artifact source")
102
102
 
103
103
 
104
104
  class FastAIFramework(BaseModel):
@@ -365,9 +365,9 @@ class TransformersFramework(BaseModel):
365
365
  )
366
366
 
367
367
 
368
- class TruefoundryModelSource(BaseModel):
368
+ class TrueFoundryArtifactSource(BaseModel):
369
369
  """
370
- +usage=Source for the Model
370
+ +usage=Source for the Artifact or Model
371
371
  +label=Upload
372
372
  """
373
373
 
@@ -442,6 +442,18 @@ class AgentOpenAPIToolWithFQN(AgentOpenAPITool):
442
442
  fqn: str
443
443
 
444
444
 
445
+ class ArtifactVersion(BaseArtifactVersion):
446
+ type: Literal["artifact-version"] = Field(
447
+ ...,
448
+ description='+label=Type\n+usage=Artifact Version\n+value="artifact-version"',
449
+ )
450
+ source: Union[TrueFoundryArtifactSource, ExternalArtifactSource] = Field(
451
+ ...,
452
+ description="+label=Artifact Source\n+usage=Source for the Artifact version\n+uiType=Group",
453
+ )
454
+ step: conint(ge=0) = Field(0, description="+label=Step")
455
+
456
+
445
457
  class AssistantMessage(BaseModel):
446
458
  """
447
459
  +usage=Assistant message
@@ -497,7 +509,7 @@ class ModelVersion(BaseArtifactVersion):
497
509
  type: Literal["model-version"] = Field(
498
510
  ..., description='+label=Type\n+usage=Model Version\n+value="model-version"'
499
511
  )
500
- source: Union[TruefoundryModelSource, ExternalModelSource] = Field(
512
+ source: Union[TrueFoundryArtifactSource, ExternalArtifactSource] = Field(
501
513
  ...,
502
514
  description="+label=Model Source\n+usage=Source for the model version\n+uiType=Group",
503
515
  )
@@ -531,5 +543,7 @@ class AgentApp(BaseModel):
531
543
  root_agent: constr(min_length=1)
532
544
 
533
545
 
534
- class ArtifactsVersion(BaseModel):
535
- __root__: Union[ChatPrompt, AgentOpenAPITool, Agent, AgentApp, ModelVersion]
546
+ class VersionedArtifactType(BaseModel):
547
+ __root__: Union[
548
+ ChatPrompt, AgentOpenAPITool, Agent, AgentApp, ModelVersion, ArtifactVersion
549
+ ]