truefoundry 0.4.10__py3-none-any.whl → 0.5.0__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.
- truefoundry/deploy/builder/builders/tfy_python_buildpack/dockerfile_template.py +2 -2
- truefoundry/deploy/lib/dao/application.py +2 -1
- truefoundry/ml/__init__.py +41 -1
- truefoundry/ml/autogen/client/__init__.py +44 -14
- truefoundry/ml/autogen/client/api/__init__.py +3 -3
- truefoundry/ml/autogen/client/api/deprecated_api.py +333 -0
- truefoundry/ml/autogen/client/api/generate_code_snippet_api.py +526 -0
- truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py +0 -322
- truefoundry/ml/autogen/client/api_client.py +8 -1
- truefoundry/ml/autogen/client/models/__init__.py +41 -11
- truefoundry/ml/autogen/client/models/add_features_to_model_version_request_dto.py +3 -17
- truefoundry/ml/autogen/client/models/agent.py +1 -1
- truefoundry/ml/autogen/client/models/agent_app.py +1 -1
- truefoundry/ml/autogen/client/models/agent_open_api_tool.py +1 -1
- truefoundry/ml/autogen/client/models/agent_open_api_tool_with_fqn.py +1 -1
- truefoundry/ml/autogen/client/models/agent_with_fqn.py +1 -1
- truefoundry/ml/autogen/client/models/artifact_version_dto.py +3 -5
- truefoundry/ml/autogen/client/models/artifact_version_manifest.py +111 -0
- truefoundry/ml/autogen/client/models/assistant_message.py +1 -1
- truefoundry/ml/autogen/client/models/blob_storage_reference.py +1 -1
- truefoundry/ml/autogen/client/models/chat_prompt.py +1 -1
- truefoundry/ml/autogen/client/models/command.py +152 -0
- truefoundry/ml/autogen/client/models/{feature_dto.py → create_workflow_task_config_request_dto.py} +18 -14
- truefoundry/ml/autogen/client/models/{external_model_source.py → external_artifact_source.py} +12 -11
- truefoundry/ml/autogen/client/models/fast_ai_framework.py +75 -0
- truefoundry/ml/autogen/client/models/finalize_artifact_version_request_dto.py +3 -5
- truefoundry/ml/autogen/client/models/framework.py +250 -14
- truefoundry/ml/autogen/client/models/gluon_framework.py +74 -0
- truefoundry/ml/autogen/client/models/{upload_model_source.py → h2_o_framework.py} +11 -11
- truefoundry/ml/autogen/client/models/image_content_part.py +1 -1
- truefoundry/ml/autogen/client/models/keras_framework.py +74 -0
- truefoundry/ml/autogen/client/models/light_gbm_framework.py +75 -0
- truefoundry/ml/autogen/client/models/manifest.py +154 -0
- truefoundry/ml/autogen/client/models/model_version_dto.py +7 -8
- truefoundry/ml/autogen/client/models/model_version_environment.py +97 -0
- truefoundry/ml/autogen/client/models/model_version_manifest.py +30 -6
- truefoundry/ml/autogen/client/models/onnx_framework.py +74 -0
- truefoundry/ml/autogen/client/models/paddle_framework.py +75 -0
- truefoundry/ml/autogen/client/models/py_torch_framework.py +75 -0
- truefoundry/ml/autogen/client/models/{feature_value_type.py → serialization_format.py} +8 -8
- truefoundry/ml/autogen/client/models/sklearn_framework.py +92 -0
- truefoundry/ml/autogen/client/models/source.py +23 -46
- truefoundry/ml/autogen/client/models/source1.py +154 -0
- truefoundry/ml/autogen/client/models/spa_cy_framework.py +74 -0
- truefoundry/ml/autogen/client/models/stats_models_framework.py +75 -0
- truefoundry/ml/autogen/client/models/system_message.py +1 -1
- truefoundry/ml/autogen/client/models/{tensorflow_framework.py → tensor_flow_framework.py} +11 -10
- truefoundry/ml/autogen/client/models/text_content_part.py +1 -1
- truefoundry/ml/autogen/client/models/transformers_framework.py +10 -4
- truefoundry/ml/autogen/client/models/trigger_job_run_config_request_dto.py +90 -0
- truefoundry/ml/autogen/client/models/trigger_job_run_config_response_dto.py +71 -0
- truefoundry/ml/autogen/client/models/{truefoundry_model_source.py → true_foundry_artifact_source.py} +13 -11
- truefoundry/ml/autogen/client/models/update_artifact_version_request_dto.py +11 -1
- truefoundry/ml/autogen/client/models/update_model_version_request_dto.py +1 -13
- truefoundry/ml/autogen/client/models/user_message.py +1 -1
- truefoundry/ml/autogen/client/models/xg_boost_framework.py +92 -0
- truefoundry/ml/autogen/client_README.md +30 -12
- truefoundry/ml/autogen/entities/artifacts.py +87 -9
- truefoundry/ml/autogen/models/__init__.py +4 -0
- truefoundry/ml/autogen/models/exceptions.py +30 -0
- truefoundry/ml/autogen/models/schema.py +1547 -0
- truefoundry/ml/autogen/models/signature.py +139 -0
- truefoundry/ml/autogen/models/utils.py +699 -0
- truefoundry/ml/log_types/artifacts/artifact.py +131 -63
- truefoundry/ml/log_types/artifacts/general_artifact.py +7 -26
- truefoundry/ml/log_types/artifacts/model.py +195 -197
- truefoundry/ml/mlfoundry_api.py +47 -52
- truefoundry/ml/mlfoundry_run.py +35 -43
- truefoundry/ml/model_framework.py +169 -0
- {truefoundry-0.4.10.dist-info → truefoundry-0.5.0.dist-info}/METADATA +1 -1
- {truefoundry-0.4.10.dist-info → truefoundry-0.5.0.dist-info}/RECORD +73 -51
- truefoundry/ml/autogen/client/api/python_deployment_config_api.py +0 -201
- truefoundry/ml/autogen/client/models/model_schema_dto.py +0 -85
- truefoundry/ml/autogen/client/models/prediction_type.py +0 -34
- {truefoundry-0.4.10.dist-info → truefoundry-0.5.0.dist-info}/WHEEL +0 -0
- {truefoundry-0.4.10.dist-info → truefoundry-0.5.0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,92 @@
|
|
|
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 Optional
|
|
20
|
+
|
|
21
|
+
from truefoundry.ml.autogen.client.models.serialization_format import (
|
|
22
|
+
SerializationFormat,
|
|
23
|
+
)
|
|
24
|
+
from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class SklearnFramework(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
+docs=Scikit-learn framework for the model version +label=Sklearn # noqa: E501
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
type: StrictStr = Field(
|
|
33
|
+
default=...,
|
|
34
|
+
description="+label=Type +usage=Type of the framework +value=sklearn",
|
|
35
|
+
)
|
|
36
|
+
serialization_format: Optional[SerializationFormat] = Field(
|
|
37
|
+
default=None,
|
|
38
|
+
description="+label=Serialization format +usage=Serialization format used for the model",
|
|
39
|
+
)
|
|
40
|
+
model_filename: Optional[StrictStr] = Field(
|
|
41
|
+
default=None, description="+label=Model file name +usage=Name of the model file"
|
|
42
|
+
)
|
|
43
|
+
__properties = ["type", "serialization_format", "model_filename"]
|
|
44
|
+
|
|
45
|
+
@validator("type")
|
|
46
|
+
def type_validate_enum(cls, value):
|
|
47
|
+
"""Validates the enum"""
|
|
48
|
+
if value not in ("sklearn",):
|
|
49
|
+
raise ValueError("must be one of enum values ('sklearn')")
|
|
50
|
+
return value
|
|
51
|
+
|
|
52
|
+
class Config:
|
|
53
|
+
"""Pydantic configuration"""
|
|
54
|
+
|
|
55
|
+
allow_population_by_field_name = True
|
|
56
|
+
validate_assignment = True
|
|
57
|
+
|
|
58
|
+
def to_str(self) -> str:
|
|
59
|
+
"""Returns the string representation of the model using alias"""
|
|
60
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
61
|
+
|
|
62
|
+
def to_json(self) -> str:
|
|
63
|
+
"""Returns the JSON representation of the model using alias"""
|
|
64
|
+
return json.dumps(self.to_dict())
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def from_json(cls, json_str: str) -> SklearnFramework:
|
|
68
|
+
"""Create an instance of SklearnFramework from a JSON string"""
|
|
69
|
+
return cls.from_dict(json.loads(json_str))
|
|
70
|
+
|
|
71
|
+
def to_dict(self):
|
|
72
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
73
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
74
|
+
return _dict
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_dict(cls, obj: dict) -> SklearnFramework:
|
|
78
|
+
"""Create an instance of SklearnFramework from a dict"""
|
|
79
|
+
if obj is None:
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
if not isinstance(obj, dict):
|
|
83
|
+
return SklearnFramework.parse_obj(obj)
|
|
84
|
+
|
|
85
|
+
_obj = SklearnFramework.parse_obj(
|
|
86
|
+
{
|
|
87
|
+
"type": obj.get("type"),
|
|
88
|
+
"serialization_format": obj.get("serialization_format"),
|
|
89
|
+
"model_filename": obj.get("model_filename"),
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
return _obj
|
|
@@ -18,13 +18,12 @@ 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.
|
|
22
|
-
|
|
21
|
+
from truefoundry.ml.autogen.client.models.external_artifact_source import (
|
|
22
|
+
ExternalArtifactSource,
|
|
23
23
|
)
|
|
24
|
-
from truefoundry.ml.autogen.client.models.
|
|
25
|
-
|
|
24
|
+
from truefoundry.ml.autogen.client.models.true_foundry_artifact_source import (
|
|
25
|
+
TrueFoundryArtifactSource,
|
|
26
26
|
)
|
|
27
|
-
from truefoundry.ml.autogen.client.models.upload_model_source import UploadModelSource
|
|
28
27
|
from truefoundry.pydantic_v1 import (
|
|
29
28
|
BaseModel,
|
|
30
29
|
Field,
|
|
@@ -32,28 +31,20 @@ from truefoundry.pydantic_v1 import (
|
|
|
32
31
|
validator,
|
|
33
32
|
)
|
|
34
33
|
|
|
35
|
-
SOURCE_ANY_OF_SCHEMAS = [
|
|
36
|
-
"ExternalModelSource",
|
|
37
|
-
"TruefoundryModelSource",
|
|
38
|
-
"UploadModelSource",
|
|
39
|
-
]
|
|
34
|
+
SOURCE_ANY_OF_SCHEMAS = ["ExternalArtifactSource", "TrueFoundryArtifactSource"]
|
|
40
35
|
|
|
41
36
|
|
|
42
37
|
class Source(BaseModel):
|
|
43
38
|
"""
|
|
44
|
-
+label=Artifact Source +
|
|
39
|
+
+label=Artifact Source +usage=Source for the Artifact version +uiType=Group
|
|
45
40
|
"""
|
|
46
41
|
|
|
47
|
-
# data type:
|
|
48
|
-
anyof_schema_1_validator: Optional[
|
|
49
|
-
# data type:
|
|
50
|
-
anyof_schema_2_validator: Optional[
|
|
51
|
-
# data type: ExternalModelSource
|
|
52
|
-
anyof_schema_3_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
|
|
53
46
|
if TYPE_CHECKING:
|
|
54
|
-
actual_instance: Union[
|
|
55
|
-
ExternalModelSource, TruefoundryModelSource, UploadModelSource
|
|
56
|
-
]
|
|
47
|
+
actual_instance: Union[ExternalArtifactSource, TrueFoundryArtifactSource]
|
|
57
48
|
else:
|
|
58
49
|
actual_instance: Any
|
|
59
50
|
any_of_schemas: List[str] = Field(SOURCE_ANY_OF_SCHEMAS, const=True)
|
|
@@ -79,26 +70,18 @@ class Source(BaseModel):
|
|
|
79
70
|
def actual_instance_must_validate_anyof(cls, v):
|
|
80
71
|
instance = Source.construct()
|
|
81
72
|
error_messages = []
|
|
82
|
-
# validate data type:
|
|
83
|
-
if not isinstance(v,
|
|
73
|
+
# validate data type: TrueFoundryArtifactSource
|
|
74
|
+
if not isinstance(v, TrueFoundryArtifactSource):
|
|
84
75
|
error_messages.append(
|
|
85
|
-
f"Error! Input type `{type(v)}` is not `
|
|
76
|
+
f"Error! Input type `{type(v)}` is not `TrueFoundryArtifactSource`"
|
|
86
77
|
)
|
|
87
78
|
else:
|
|
88
79
|
return v
|
|
89
80
|
|
|
90
|
-
# validate data type:
|
|
91
|
-
if not isinstance(v,
|
|
81
|
+
# validate data type: ExternalArtifactSource
|
|
82
|
+
if not isinstance(v, ExternalArtifactSource):
|
|
92
83
|
error_messages.append(
|
|
93
|
-
f"Error! Input type `{type(v)}` is not `
|
|
94
|
-
)
|
|
95
|
-
else:
|
|
96
|
-
return v
|
|
97
|
-
|
|
98
|
-
# validate data type: ExternalModelSource
|
|
99
|
-
if not isinstance(v, ExternalModelSource):
|
|
100
|
-
error_messages.append(
|
|
101
|
-
f"Error! Input type `{type(v)}` is not `ExternalModelSource`"
|
|
84
|
+
f"Error! Input type `{type(v)}` is not `ExternalArtifactSource`"
|
|
102
85
|
)
|
|
103
86
|
else:
|
|
104
87
|
return v
|
|
@@ -106,7 +89,7 @@ class Source(BaseModel):
|
|
|
106
89
|
if error_messages:
|
|
107
90
|
# no match
|
|
108
91
|
raise ValueError(
|
|
109
|
-
"No match found when setting the actual_instance in Source with anyOf schemas:
|
|
92
|
+
"No match found when setting the actual_instance in Source with anyOf schemas: ExternalArtifactSource, TrueFoundryArtifactSource. Details: "
|
|
110
93
|
+ ", ".join(error_messages)
|
|
111
94
|
)
|
|
112
95
|
else:
|
|
@@ -121,21 +104,15 @@ class Source(BaseModel):
|
|
|
121
104
|
"""Returns the object represented by the json string"""
|
|
122
105
|
instance = Source.construct()
|
|
123
106
|
error_messages = []
|
|
124
|
-
# anyof_schema_1_validator: Optional[
|
|
125
|
-
try:
|
|
126
|
-
instance.actual_instance = UploadModelSource.from_json(json_str)
|
|
127
|
-
return instance
|
|
128
|
-
except (ValidationError, ValueError) as e:
|
|
129
|
-
error_messages.append(str(e))
|
|
130
|
-
# anyof_schema_2_validator: Optional[TruefoundryModelSource] = None
|
|
107
|
+
# anyof_schema_1_validator: Optional[TrueFoundryArtifactSource] = None
|
|
131
108
|
try:
|
|
132
|
-
instance.actual_instance =
|
|
109
|
+
instance.actual_instance = TrueFoundryArtifactSource.from_json(json_str)
|
|
133
110
|
return instance
|
|
134
111
|
except (ValidationError, ValueError) as e:
|
|
135
112
|
error_messages.append(str(e))
|
|
136
|
-
#
|
|
113
|
+
# anyof_schema_2_validator: Optional[ExternalArtifactSource] = None
|
|
137
114
|
try:
|
|
138
|
-
instance.actual_instance =
|
|
115
|
+
instance.actual_instance = ExternalArtifactSource.from_json(json_str)
|
|
139
116
|
return instance
|
|
140
117
|
except (ValidationError, ValueError) as e:
|
|
141
118
|
error_messages.append(str(e))
|
|
@@ -143,7 +120,7 @@ class Source(BaseModel):
|
|
|
143
120
|
if error_messages:
|
|
144
121
|
# no match
|
|
145
122
|
raise ValueError(
|
|
146
|
-
"No match found when deserializing the JSON string into Source with anyOf schemas:
|
|
123
|
+
"No match found when deserializing the JSON string into Source with anyOf schemas: ExternalArtifactSource, TrueFoundryArtifactSource. Details: "
|
|
147
124
|
+ ", ".join(error_messages)
|
|
148
125
|
)
|
|
149
126
|
else:
|
|
@@ -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())
|
|
@@ -0,0 +1,74 @@
|
|
|
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 SpaCyFramework(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
+docs=spaCy framework for the model version +label=SpaCy # noqa: E501
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
type: StrictStr = Field(
|
|
29
|
+
default=..., description="+label=Type +usage=Type of the framework +value=spacy"
|
|
30
|
+
)
|
|
31
|
+
__properties = ["type"]
|
|
32
|
+
|
|
33
|
+
@validator("type")
|
|
34
|
+
def type_validate_enum(cls, value):
|
|
35
|
+
"""Validates the enum"""
|
|
36
|
+
if value not in ("spacy",):
|
|
37
|
+
raise ValueError("must be one of enum values ('spacy')")
|
|
38
|
+
return value
|
|
39
|
+
|
|
40
|
+
class Config:
|
|
41
|
+
"""Pydantic configuration"""
|
|
42
|
+
|
|
43
|
+
allow_population_by_field_name = True
|
|
44
|
+
validate_assignment = True
|
|
45
|
+
|
|
46
|
+
def to_str(self) -> str:
|
|
47
|
+
"""Returns the string representation of the model using alias"""
|
|
48
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
49
|
+
|
|
50
|
+
def to_json(self) -> str:
|
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
|
52
|
+
return json.dumps(self.to_dict())
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def from_json(cls, json_str: str) -> SpaCyFramework:
|
|
56
|
+
"""Create an instance of SpaCyFramework from a JSON string"""
|
|
57
|
+
return cls.from_dict(json.loads(json_str))
|
|
58
|
+
|
|
59
|
+
def to_dict(self):
|
|
60
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
61
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
62
|
+
return _dict
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def from_dict(cls, obj: dict) -> SpaCyFramework:
|
|
66
|
+
"""Create an instance of SpaCyFramework from a dict"""
|
|
67
|
+
if obj is None:
|
|
68
|
+
return None
|
|
69
|
+
|
|
70
|
+
if not isinstance(obj, dict):
|
|
71
|
+
return SpaCyFramework.parse_obj(obj)
|
|
72
|
+
|
|
73
|
+
_obj = SpaCyFramework.parse_obj({"type": obj.get("type")})
|
|
74
|
+
return _obj
|
|
@@ -0,0 +1,75 @@
|
|
|
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 StatsModelsFramework(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
+docs=StatsModels framework for the model version +label=StatsModels # noqa: E501
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
type: StrictStr = Field(
|
|
29
|
+
default=...,
|
|
30
|
+
description="+label=Type +usage=Type of the framework +value=statsmodels",
|
|
31
|
+
)
|
|
32
|
+
__properties = ["type"]
|
|
33
|
+
|
|
34
|
+
@validator("type")
|
|
35
|
+
def type_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in ("statsmodels",):
|
|
38
|
+
raise ValueError("must be one of enum values ('statsmodels')")
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
class Config:
|
|
42
|
+
"""Pydantic configuration"""
|
|
43
|
+
|
|
44
|
+
allow_population_by_field_name = True
|
|
45
|
+
validate_assignment = True
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
return json.dumps(self.to_dict())
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_json(cls, json_str: str) -> StatsModelsFramework:
|
|
57
|
+
"""Create an instance of StatsModelsFramework from a JSON string"""
|
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
|
59
|
+
|
|
60
|
+
def to_dict(self):
|
|
61
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
62
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
63
|
+
return _dict
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
def from_dict(cls, obj: dict) -> StatsModelsFramework:
|
|
67
|
+
"""Create an instance of StatsModelsFramework from a dict"""
|
|
68
|
+
if obj is None:
|
|
69
|
+
return None
|
|
70
|
+
|
|
71
|
+
if not isinstance(obj, dict):
|
|
72
|
+
return StatsModelsFramework.parse_obj(obj)
|
|
73
|
+
|
|
74
|
+
_obj = StatsModelsFramework.parse_obj({"type": obj.get("type")})
|
|
75
|
+
return _obj
|
|
@@ -37,7 +37,7 @@ class SystemMessage(BaseModel):
|
|
|
37
37
|
@validator("role")
|
|
38
38
|
def role_validate_enum(cls, value):
|
|
39
39
|
"""Validates the enum"""
|
|
40
|
-
if value not in ("system"):
|
|
40
|
+
if value not in ("system",):
|
|
41
41
|
raise ValueError("must be one of enum values ('system')")
|
|
42
42
|
return value
|
|
43
43
|
|
|
@@ -20,20 +20,21 @@ import re # noqa: F401
|
|
|
20
20
|
from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
class
|
|
23
|
+
class TensorFlowFramework(BaseModel):
|
|
24
24
|
"""
|
|
25
|
-
+docs=
|
|
25
|
+
+docs=TensorFlow framework for the model version +label=TensorFlow # noqa: E501
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
type: StrictStr = Field(
|
|
29
|
-
default=...,
|
|
29
|
+
default=...,
|
|
30
|
+
description="+label=Type +usage=Type of the framework +value=tensorflow",
|
|
30
31
|
)
|
|
31
32
|
__properties = ["type"]
|
|
32
33
|
|
|
33
34
|
@validator("type")
|
|
34
35
|
def type_validate_enum(cls, value):
|
|
35
36
|
"""Validates the enum"""
|
|
36
|
-
if value not in ("tensorflow"):
|
|
37
|
+
if value not in ("tensorflow",):
|
|
37
38
|
raise ValueError("must be one of enum values ('tensorflow')")
|
|
38
39
|
return value
|
|
39
40
|
|
|
@@ -52,8 +53,8 @@ class TensorflowFramework(BaseModel):
|
|
|
52
53
|
return json.dumps(self.to_dict())
|
|
53
54
|
|
|
54
55
|
@classmethod
|
|
55
|
-
def from_json(cls, json_str: str) ->
|
|
56
|
-
"""Create an instance of
|
|
56
|
+
def from_json(cls, json_str: str) -> TensorFlowFramework:
|
|
57
|
+
"""Create an instance of TensorFlowFramework from a JSON string"""
|
|
57
58
|
return cls.from_dict(json.loads(json_str))
|
|
58
59
|
|
|
59
60
|
def to_dict(self):
|
|
@@ -62,13 +63,13 @@ class TensorflowFramework(BaseModel):
|
|
|
62
63
|
return _dict
|
|
63
64
|
|
|
64
65
|
@classmethod
|
|
65
|
-
def from_dict(cls, obj: dict) ->
|
|
66
|
-
"""Create an instance of
|
|
66
|
+
def from_dict(cls, obj: dict) -> TensorFlowFramework:
|
|
67
|
+
"""Create an instance of TensorFlowFramework from a dict"""
|
|
67
68
|
if obj is None:
|
|
68
69
|
return None
|
|
69
70
|
|
|
70
71
|
if not isinstance(obj, dict):
|
|
71
|
-
return
|
|
72
|
+
return TensorFlowFramework.parse_obj(obj)
|
|
72
73
|
|
|
73
|
-
_obj =
|
|
74
|
+
_obj = TensorFlowFramework.parse_obj({"type": obj.get("type")})
|
|
74
75
|
return _obj
|
|
@@ -24,11 +24,12 @@ from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
|
|
|
24
24
|
|
|
25
25
|
class TransformersFramework(BaseModel):
|
|
26
26
|
"""
|
|
27
|
-
+docs=Transformers framework for the model version +
|
|
27
|
+
+docs=Transformers framework for the model version +label=Transformers +value=transformers # noqa: E501
|
|
28
28
|
"""
|
|
29
29
|
|
|
30
30
|
type: StrictStr = Field(
|
|
31
|
-
default=...,
|
|
31
|
+
default=...,
|
|
32
|
+
description="+label=Type +usage=Type of the framework +value=transformers",
|
|
32
33
|
)
|
|
33
34
|
library_name: Optional[LibraryName] = Field(
|
|
34
35
|
default=None,
|
|
@@ -38,12 +39,16 @@ class TransformersFramework(BaseModel):
|
|
|
38
39
|
default=None,
|
|
39
40
|
description="+label=Pipeline Tag +usage=Pipeline tag +docs=Pipeline tag for the framework",
|
|
40
41
|
)
|
|
41
|
-
|
|
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"]
|
|
42
47
|
|
|
43
48
|
@validator("type")
|
|
44
49
|
def type_validate_enum(cls, value):
|
|
45
50
|
"""Validates the enum"""
|
|
46
|
-
if value not in ("transformers"):
|
|
51
|
+
if value not in ("transformers",):
|
|
47
52
|
raise ValueError("must be one of enum values ('transformers')")
|
|
48
53
|
return value
|
|
49
54
|
|
|
@@ -85,6 +90,7 @@ class TransformersFramework(BaseModel):
|
|
|
85
90
|
"type": obj.get("type"),
|
|
86
91
|
"library_name": obj.get("library_name"),
|
|
87
92
|
"pipeline_tag": obj.get("pipeline_tag"),
|
|
93
|
+
"base_model": obj.get("base_model"),
|
|
88
94
|
}
|
|
89
95
|
)
|
|
90
96
|
return _obj
|