truefoundry 0.5.0rc6__py3-none-any.whl → 0.5.1__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 (68) hide show
  1. truefoundry/common/auth_service_client.py +2 -2
  2. truefoundry/common/constants.py +9 -0
  3. truefoundry/common/utils.py +81 -1
  4. truefoundry/deploy/__init__.py +5 -0
  5. truefoundry/deploy/builder/builders/tfy_notebook_buildpack/__init__.py +4 -2
  6. truefoundry/deploy/builder/builders/tfy_python_buildpack/__init__.py +7 -5
  7. truefoundry/deploy/builder/builders/tfy_python_buildpack/dockerfile_template.py +87 -28
  8. truefoundry/deploy/builder/constants.py +8 -0
  9. truefoundry/deploy/builder/utils.py +9 -4
  10. truefoundry/deploy/cli/cli.py +2 -0
  11. truefoundry/deploy/cli/commands/__init__.py +1 -0
  12. truefoundry/deploy/cli/commands/deploy_init_command.py +22 -0
  13. truefoundry/deploy/lib/dao/application.py +2 -1
  14. truefoundry/deploy/v2/lib/patched_models.py +8 -0
  15. truefoundry/ml/__init__.py +25 -15
  16. truefoundry/ml/artifact/truefoundry_artifact_repo.py +8 -3
  17. truefoundry/ml/autogen/client/__init__.py +24 -0
  18. truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py +325 -0
  19. truefoundry/ml/autogen/client/models/__init__.py +24 -0
  20. truefoundry/ml/autogen/client/models/artifact_version_manifest.py +2 -2
  21. truefoundry/ml/autogen/client/models/export_deployment_files_request_dto.py +82 -0
  22. truefoundry/ml/autogen/client/models/infer_method_name.py +34 -0
  23. truefoundry/ml/autogen/client/models/model_server.py +34 -0
  24. truefoundry/ml/autogen/client/models/model_version_environment.py +97 -0
  25. truefoundry/ml/autogen/client/models/model_version_manifest.py +13 -8
  26. truefoundry/ml/autogen/client/models/sklearn_framework.py +25 -2
  27. truefoundry/ml/autogen/client/models/sklearn_model_schema.py +82 -0
  28. truefoundry/ml/autogen/client/models/sklearn_serialization_format.py +35 -0
  29. truefoundry/ml/autogen/client/models/transformers_framework.py +2 -2
  30. truefoundry/ml/autogen/client/models/validate_external_storage_root_request_dto.py +71 -0
  31. truefoundry/ml/autogen/client/models/validate_external_storage_root_response_dto.py +69 -0
  32. truefoundry/ml/autogen/client/models/xg_boost_framework.py +28 -3
  33. truefoundry/ml/autogen/client/models/xg_boost_model_schema.py +88 -0
  34. truefoundry/ml/autogen/client/models/xg_boost_serialization_format.py +36 -0
  35. truefoundry/ml/autogen/client_README.md +12 -0
  36. truefoundry/ml/autogen/entities/artifacts.py +119 -26
  37. truefoundry/ml/autogen/models/signature.py +6 -3
  38. truefoundry/ml/autogen/models/utils.py +12 -7
  39. truefoundry/ml/cli/commands/model_init.py +97 -0
  40. truefoundry/ml/cli/utils.py +34 -0
  41. truefoundry/ml/log_types/artifacts/model.py +53 -38
  42. truefoundry/ml/log_types/artifacts/utils.py +38 -2
  43. truefoundry/ml/mlfoundry_api.py +77 -81
  44. truefoundry/ml/mlfoundry_run.py +3 -33
  45. truefoundry/ml/model_framework.py +372 -3
  46. truefoundry/ml/validation_utils.py +2 -0
  47. {truefoundry-0.5.0rc6.dist-info → truefoundry-0.5.1.dist-info}/METADATA +2 -6
  48. {truefoundry-0.5.0rc6.dist-info → truefoundry-0.5.1.dist-info}/RECORD +50 -55
  49. truefoundry/deploy/function_service/__init__.py +0 -3
  50. truefoundry/deploy/function_service/__main__.py +0 -27
  51. truefoundry/deploy/function_service/app.py +0 -92
  52. truefoundry/deploy/function_service/build.py +0 -45
  53. truefoundry/deploy/function_service/remote/__init__.py +0 -6
  54. truefoundry/deploy/function_service/remote/context.py +0 -3
  55. truefoundry/deploy/function_service/remote/method.py +0 -67
  56. truefoundry/deploy/function_service/remote/remote.py +0 -144
  57. truefoundry/deploy/function_service/route.py +0 -137
  58. truefoundry/deploy/function_service/service.py +0 -113
  59. truefoundry/deploy/function_service/utils.py +0 -53
  60. truefoundry/langchain/__init__.py +0 -12
  61. truefoundry/langchain/deprecated.py +0 -302
  62. truefoundry/langchain/truefoundry_chat.py +0 -130
  63. truefoundry/langchain/truefoundry_embeddings.py +0 -171
  64. truefoundry/langchain/truefoundry_llm.py +0 -106
  65. truefoundry/langchain/utils.py +0 -44
  66. truefoundry/ml/log_types/artifacts/model_extras.py +0 -48
  67. {truefoundry-0.5.0rc6.dist-info → truefoundry-0.5.1.dist-info}/WHEEL +0 -0
  68. {truefoundry-0.5.0rc6.dist-info → truefoundry-0.5.1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,97 @@
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.pydantic_v1 import (
22
+ BaseModel,
23
+ Field,
24
+ StrictStr,
25
+ conlist,
26
+ constr,
27
+ validator,
28
+ )
29
+
30
+
31
+ class ModelVersionEnvironment(BaseModel):
32
+ """
33
+ +label=Environment # noqa: E501
34
+ """
35
+
36
+ python_version: Optional[constr(strict=True)] = Field(
37
+ default=None,
38
+ description="+label=Python Version +usage=Python version for the model version",
39
+ )
40
+ pip_packages: Optional[conlist(StrictStr)] = Field(
41
+ default=None,
42
+ description="+label=PIP Packages +usage=PIP packages for the model version",
43
+ )
44
+ __properties = ["python_version", "pip_packages"]
45
+
46
+ @validator("python_version")
47
+ def python_version_validate_regular_expression(cls, value):
48
+ """Validates the regular expression"""
49
+ if value is None:
50
+ return value
51
+
52
+ if not re.match(r"^\d+(\.\d+){1,2}([\-\.a-z0-9]+)?$", value):
53
+ raise ValueError(
54
+ r"must validate the regular expression /^\d+(\.\d+){1,2}([\-\.a-z0-9]+)?$/"
55
+ )
56
+ return value
57
+
58
+ class Config:
59
+ """Pydantic configuration"""
60
+
61
+ allow_population_by_field_name = True
62
+ validate_assignment = True
63
+
64
+ def to_str(self) -> str:
65
+ """Returns the string representation of the model using alias"""
66
+ return pprint.pformat(self.dict(by_alias=True))
67
+
68
+ def to_json(self) -> str:
69
+ """Returns the JSON representation of the model using alias"""
70
+ return json.dumps(self.to_dict())
71
+
72
+ @classmethod
73
+ def from_json(cls, json_str: str) -> ModelVersionEnvironment:
74
+ """Create an instance of ModelVersionEnvironment from a JSON string"""
75
+ return cls.from_dict(json.loads(json_str))
76
+
77
+ def to_dict(self):
78
+ """Returns the dictionary representation of the model using alias"""
79
+ _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: dict) -> ModelVersionEnvironment:
84
+ """Create an instance of ModelVersionEnvironment from a dict"""
85
+ if obj is None:
86
+ return None
87
+
88
+ if not isinstance(obj, dict):
89
+ return ModelVersionEnvironment.parse_obj(obj)
90
+
91
+ _obj = ModelVersionEnvironment.parse_obj(
92
+ {
93
+ "python_version": obj.get("python_version"),
94
+ "pip_packages": obj.get("pip_packages"),
95
+ }
96
+ )
97
+ 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.framework import Framework
22
+ from truefoundry.ml.autogen.client.models.model_version_environment import (
23
+ ModelVersionEnvironment,
24
+ )
22
25
  from truefoundry.ml.autogen.client.models.source1 import Source1
23
26
  from truefoundry.pydantic_v1 import (
24
27
  BaseModel,
@@ -37,30 +40,27 @@ class ModelVersionManifest(BaseModel):
37
40
 
38
41
  description: Optional[constr(strict=True, max_length=512)] = Field(
39
42
  default=None,
40
- description="+label=Description +docs=Description of the artifact version",
43
+ description="+label=Description +usage=Description of the artifact or model version +docs=Description of the artifact or model version",
41
44
  )
42
45
  metadata: Dict[str, Any] = Field(
43
46
  default=...,
44
- description="+label=Metadata +docs=Metadata for the model version +usage=Metadata for the model version +uiType=JsonInput",
47
+ description="+label=Metadata +docs=Metadata for the artifact or model version +usage=Metadata for the artifact or model version +uiType=JsonInput",
45
48
  )
46
49
  type: Optional[StrictStr] = "model-version"
47
50
  source: Source1 = Field(...)
48
51
  framework: Optional[Framework] = None
52
+ environment: Optional[ModelVersionEnvironment] = None
49
53
  step: Optional[conint(strict=True, ge=0)] = Field(
50
54
  default=0, description="+label=Step"
51
55
  )
52
- model_schema: Optional[Dict[str, Any]] = Field(
53
- default=None,
54
- description="+label=Model Schema +usage=Schema of the model +uiType=Hidden",
55
- )
56
56
  __properties = [
57
57
  "description",
58
58
  "metadata",
59
59
  "type",
60
60
  "source",
61
61
  "framework",
62
+ "environment",
62
63
  "step",
63
- "model_schema",
64
64
  ]
65
65
 
66
66
  @validator("type")
@@ -101,6 +101,9 @@ class ModelVersionManifest(BaseModel):
101
101
  # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of framework
102
102
  if self.framework:
103
103
  _dict["framework"] = self.framework.to_dict()
104
+ # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of environment
105
+ if self.environment:
106
+ _dict["environment"] = self.environment.to_dict()
104
107
  return _dict
105
108
 
106
109
  @classmethod
@@ -125,8 +128,10 @@ class ModelVersionManifest(BaseModel):
125
128
  "framework": Framework.from_dict(obj.get("framework"))
126
129
  if obj.get("framework") is not None
127
130
  else None,
131
+ "environment": ModelVersionEnvironment.from_dict(obj.get("environment"))
132
+ if obj.get("environment") is not None
133
+ else None,
128
134
  "step": obj.get("step") if obj.get("step") is not None else 0,
129
- "model_schema": obj.get("model_schema"),
130
135
  }
131
136
  )
132
137
  return _obj
@@ -16,7 +16,12 @@ from __future__ import annotations
16
16
  import json
17
17
  import pprint
18
18
  import re # noqa: F401
19
+ from typing import Optional
19
20
 
21
+ from truefoundry.ml.autogen.client.models.sklearn_model_schema import SklearnModelSchema
22
+ from truefoundry.ml.autogen.client.models.sklearn_serialization_format import (
23
+ SklearnSerializationFormat,
24
+ )
20
25
  from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
21
26
 
22
27
 
@@ -29,7 +34,13 @@ class SklearnFramework(BaseModel):
29
34
  default=...,
30
35
  description="+label=Type +usage=Type of the framework +value=sklearn",
31
36
  )
32
- __properties = ["type"]
37
+ model_filepath: Optional[StrictStr] = Field(
38
+ default=None,
39
+ description="+label=Model file path +usage=Relative path to the model file",
40
+ )
41
+ serialization_format: Optional[SklearnSerializationFormat] = None
42
+ model_schema: Optional[SklearnModelSchema] = None
43
+ __properties = ["type", "model_filepath", "serialization_format", "model_schema"]
33
44
 
34
45
  @validator("type")
35
46
  def type_validate_enum(cls, value):
@@ -60,6 +71,9 @@ class SklearnFramework(BaseModel):
60
71
  def to_dict(self):
61
72
  """Returns the dictionary representation of the model using alias"""
62
73
  _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
74
+ # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of model_schema
75
+ if self.model_schema:
76
+ _dict["model_schema"] = self.model_schema.to_dict()
63
77
  return _dict
64
78
 
65
79
  @classmethod
@@ -71,5 +85,14 @@ class SklearnFramework(BaseModel):
71
85
  if not isinstance(obj, dict):
72
86
  return SklearnFramework.parse_obj(obj)
73
87
 
74
- _obj = SklearnFramework.parse_obj({"type": obj.get("type")})
88
+ _obj = SklearnFramework.parse_obj(
89
+ {
90
+ "type": obj.get("type"),
91
+ "model_filepath": obj.get("model_filepath"),
92
+ "serialization_format": obj.get("serialization_format"),
93
+ "model_schema": SklearnModelSchema.from_dict(obj.get("model_schema"))
94
+ if obj.get("model_schema") is not None
95
+ else None,
96
+ }
97
+ )
75
98
  return _obj
@@ -0,0 +1,82 @@
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
20
+
21
+ from truefoundry.ml.autogen.client.models.infer_method_name import InferMethodName
22
+ from truefoundry.pydantic_v1 import BaseModel, Field, conlist
23
+
24
+
25
+ class SklearnModelSchema(BaseModel):
26
+ """
27
+ +label=Sklearn Model Schema # noqa: E501
28
+ """
29
+
30
+ infer_method_name: InferMethodName = Field(
31
+ default=...,
32
+ description="+label=Inference Method Name +usage=Name of the method used for inference",
33
+ )
34
+ inputs: conlist(Dict[str, Any]) = Field(
35
+ default=..., description="+label= Input Schema +usage=Schema of the input"
36
+ )
37
+ outputs: conlist(Dict[str, Any]) = Field(
38
+ default=..., description="+label= Output Schema +usage=Schema of the output"
39
+ )
40
+ __properties = ["infer_method_name", "inputs", "outputs"]
41
+
42
+ class Config:
43
+ """Pydantic configuration"""
44
+
45
+ allow_population_by_field_name = True
46
+ validate_assignment = True
47
+
48
+ def to_str(self) -> str:
49
+ """Returns the string representation of the model using alias"""
50
+ return pprint.pformat(self.dict(by_alias=True))
51
+
52
+ def to_json(self) -> str:
53
+ """Returns the JSON representation of the model using alias"""
54
+ return json.dumps(self.to_dict())
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> SklearnModelSchema:
58
+ """Create an instance of SklearnModelSchema from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self):
62
+ """Returns the dictionary representation of the model using alias"""
63
+ _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
64
+ return _dict
65
+
66
+ @classmethod
67
+ def from_dict(cls, obj: dict) -> SklearnModelSchema:
68
+ """Create an instance of SklearnModelSchema from a dict"""
69
+ if obj is None:
70
+ return None
71
+
72
+ if not isinstance(obj, dict):
73
+ return SklearnModelSchema.parse_obj(obj)
74
+
75
+ _obj = SklearnModelSchema.parse_obj(
76
+ {
77
+ "infer_method_name": obj.get("infer_method_name"),
78
+ "inputs": obj.get("inputs"),
79
+ "outputs": obj.get("outputs"),
80
+ }
81
+ )
82
+ return _obj
@@ -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 SklearnSerializationFormat(str, Enum):
21
+ """
22
+ +label=Serialization format +usage=Serialization format used for sklearn models
23
+ """
24
+
25
+ """
26
+ allowed enum values
27
+ """
28
+ CLOUDPICKLE = "cloudpickle"
29
+ JOBLIB = "joblib"
30
+ PICKLE = "pickle"
31
+
32
+ @classmethod
33
+ def from_json(cls, json_str: str) -> SklearnSerializationFormat:
34
+ """Create an instance of SklearnSerializationFormat from a JSON string"""
35
+ return SklearnSerializationFormat(json.loads(json_str))
@@ -37,11 +37,11 @@ class TransformersFramework(BaseModel):
37
37
  )
38
38
  pipeline_tag: Optional[StrictStr] = Field(
39
39
  default=None,
40
- description="+label=Pipeline Tag +usage=Pipeline tag +docs=Pipeline tag for the framework",
40
+ description="+label=Pipeline Tag +usage=The `pipeline()` task this model can be used with e.g. `text-generation`. See [huggingface docs](https://huggingface.co/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline.task) for all possible values +docs=Pipeline tag for the framework",
41
41
  )
42
42
  base_model: Optional[StrictStr] = Field(
43
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",
44
+ description="+label=Base Model +usage=Base model Id. If this is a finetuned model, this points to the base model used for finetuning +docs=Base model Id. If this is a finetuned model, this points to the base model used for finetuning",
45
45
  )
46
46
  __properties = ["type", "library_name", "pipeline_tag", "base_model"]
47
47
 
@@ -0,0 +1,71 @@
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
21
+
22
+
23
+ class ValidateExternalStorageRootRequestDto(BaseModel):
24
+ """
25
+ ValidateExternalStorageRootRequestDto
26
+ """
27
+
28
+ storage_root_uri: StrictStr = Field(...)
29
+ experiment_id: StrictStr = Field(...)
30
+ __properties = ["storage_root_uri", "experiment_id"]
31
+
32
+ class Config:
33
+ """Pydantic configuration"""
34
+
35
+ allow_population_by_field_name = True
36
+ validate_assignment = True
37
+
38
+ def to_str(self) -> str:
39
+ """Returns the string representation of the model using alias"""
40
+ return pprint.pformat(self.dict(by_alias=True))
41
+
42
+ def to_json(self) -> str:
43
+ """Returns the JSON representation of the model using alias"""
44
+ return json.dumps(self.to_dict())
45
+
46
+ @classmethod
47
+ def from_json(cls, json_str: str) -> ValidateExternalStorageRootRequestDto:
48
+ """Create an instance of ValidateExternalStorageRootRequestDto from a JSON string"""
49
+ return cls.from_dict(json.loads(json_str))
50
+
51
+ def to_dict(self):
52
+ """Returns the dictionary representation of the model using alias"""
53
+ _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
54
+ return _dict
55
+
56
+ @classmethod
57
+ def from_dict(cls, obj: dict) -> ValidateExternalStorageRootRequestDto:
58
+ """Create an instance of ValidateExternalStorageRootRequestDto from a dict"""
59
+ if obj is None:
60
+ return None
61
+
62
+ if not isinstance(obj, dict):
63
+ return ValidateExternalStorageRootRequestDto.parse_obj(obj)
64
+
65
+ _obj = ValidateExternalStorageRootRequestDto.parse_obj(
66
+ {
67
+ "storage_root_uri": obj.get("storage_root_uri"),
68
+ "experiment_id": obj.get("experiment_id"),
69
+ }
70
+ )
71
+ return _obj
@@ -0,0 +1,69 @@
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.pydantic_v1 import BaseModel, Field, StrictBool, StrictStr
22
+
23
+
24
+ class ValidateExternalStorageRootResponseDto(BaseModel):
25
+ """
26
+ ValidateExternalStorageRootResponseDto
27
+ """
28
+
29
+ is_valid: StrictBool = Field(...)
30
+ message: Optional[StrictStr] = None
31
+ __properties = ["is_valid", "message"]
32
+
33
+ class Config:
34
+ """Pydantic configuration"""
35
+
36
+ allow_population_by_field_name = True
37
+ validate_assignment = True
38
+
39
+ def to_str(self) -> str:
40
+ """Returns the string representation of the model using alias"""
41
+ return pprint.pformat(self.dict(by_alias=True))
42
+
43
+ def to_json(self) -> str:
44
+ """Returns the JSON representation of the model using alias"""
45
+ return json.dumps(self.to_dict())
46
+
47
+ @classmethod
48
+ def from_json(cls, json_str: str) -> ValidateExternalStorageRootResponseDto:
49
+ """Create an instance of ValidateExternalStorageRootResponseDto from a JSON string"""
50
+ return cls.from_dict(json.loads(json_str))
51
+
52
+ def to_dict(self):
53
+ """Returns the dictionary representation of the model using alias"""
54
+ _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
55
+ return _dict
56
+
57
+ @classmethod
58
+ def from_dict(cls, obj: dict) -> ValidateExternalStorageRootResponseDto:
59
+ """Create an instance of ValidateExternalStorageRootResponseDto from a dict"""
60
+ if obj is None:
61
+ return None
62
+
63
+ if not isinstance(obj, dict):
64
+ return ValidateExternalStorageRootResponseDto.parse_obj(obj)
65
+
66
+ _obj = ValidateExternalStorageRootResponseDto.parse_obj(
67
+ {"is_valid": obj.get("is_valid"), "message": obj.get("message")}
68
+ )
69
+ return _obj
@@ -16,7 +16,14 @@ from __future__ import annotations
16
16
  import json
17
17
  import pprint
18
18
  import re # noqa: F401
19
-
19
+ from typing import Optional
20
+
21
+ from truefoundry.ml.autogen.client.models.xg_boost_model_schema import (
22
+ XGBoostModelSchema,
23
+ )
24
+ from truefoundry.ml.autogen.client.models.xg_boost_serialization_format import (
25
+ XGBoostSerializationFormat,
26
+ )
20
27
  from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
21
28
 
22
29
 
@@ -29,7 +36,13 @@ class XGBoostFramework(BaseModel):
29
36
  default=...,
30
37
  description="+label=Type +usage=Type of the framework +value=xgboost",
31
38
  )
32
- __properties = ["type"]
39
+ serialization_format: Optional[XGBoostSerializationFormat] = None
40
+ model_filepath: Optional[StrictStr] = Field(
41
+ default=None,
42
+ description="+label=Model file path +usage=Relative path to the model file",
43
+ )
44
+ model_schema: Optional[XGBoostModelSchema] = None
45
+ __properties = ["type", "serialization_format", "model_filepath", "model_schema"]
33
46
 
34
47
  @validator("type")
35
48
  def type_validate_enum(cls, value):
@@ -60,6 +73,9 @@ class XGBoostFramework(BaseModel):
60
73
  def to_dict(self):
61
74
  """Returns the dictionary representation of the model using alias"""
62
75
  _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
76
+ # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of model_schema
77
+ if self.model_schema:
78
+ _dict["model_schema"] = self.model_schema.to_dict()
63
79
  return _dict
64
80
 
65
81
  @classmethod
@@ -71,5 +87,14 @@ class XGBoostFramework(BaseModel):
71
87
  if not isinstance(obj, dict):
72
88
  return XGBoostFramework.parse_obj(obj)
73
89
 
74
- _obj = XGBoostFramework.parse_obj({"type": obj.get("type")})
90
+ _obj = XGBoostFramework.parse_obj(
91
+ {
92
+ "type": obj.get("type"),
93
+ "serialization_format": obj.get("serialization_format"),
94
+ "model_filepath": obj.get("model_filepath"),
95
+ "model_schema": XGBoostModelSchema.from_dict(obj.get("model_schema"))
96
+ if obj.get("model_schema") is not None
97
+ else None,
98
+ }
99
+ )
75
100
  return _obj
@@ -0,0 +1,88 @@
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
20
+
21
+ from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, conlist, validator
22
+
23
+
24
+ class XGBoostModelSchema(BaseModel):
25
+ """
26
+ +label=XGBoost Model Schema # noqa: E501
27
+ """
28
+
29
+ infer_method_name: StrictStr = Field(
30
+ default=...,
31
+ description="+label=Inference Method Name +usage=Name of the method used for inference",
32
+ )
33
+ inputs: conlist(Dict[str, Any]) = Field(
34
+ default=..., description="+label= Input Schema +usage=Schema of the input"
35
+ )
36
+ outputs: conlist(Dict[str, Any]) = Field(
37
+ default=..., description="+label= Output Schema +usage=Schema of the output"
38
+ )
39
+ __properties = ["infer_method_name", "inputs", "outputs"]
40
+
41
+ @validator("infer_method_name")
42
+ def infer_method_name_validate_enum(cls, value):
43
+ """Validates the enum"""
44
+ if value not in ("predict",):
45
+ raise ValueError("must be one of enum values ('predict')")
46
+ return value
47
+
48
+ class Config:
49
+ """Pydantic configuration"""
50
+
51
+ allow_population_by_field_name = True
52
+ validate_assignment = True
53
+
54
+ def to_str(self) -> str:
55
+ """Returns the string representation of the model using alias"""
56
+ return pprint.pformat(self.dict(by_alias=True))
57
+
58
+ def to_json(self) -> str:
59
+ """Returns the JSON representation of the model using alias"""
60
+ return json.dumps(self.to_dict())
61
+
62
+ @classmethod
63
+ def from_json(cls, json_str: str) -> XGBoostModelSchema:
64
+ """Create an instance of XGBoostModelSchema from a JSON string"""
65
+ return cls.from_dict(json.loads(json_str))
66
+
67
+ def to_dict(self):
68
+ """Returns the dictionary representation of the model using alias"""
69
+ _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
70
+ return _dict
71
+
72
+ @classmethod
73
+ def from_dict(cls, obj: dict) -> XGBoostModelSchema:
74
+ """Create an instance of XGBoostModelSchema from a dict"""
75
+ if obj is None:
76
+ return None
77
+
78
+ if not isinstance(obj, dict):
79
+ return XGBoostModelSchema.parse_obj(obj)
80
+
81
+ _obj = XGBoostModelSchema.parse_obj(
82
+ {
83
+ "infer_method_name": obj.get("infer_method_name"),
84
+ "inputs": obj.get("inputs"),
85
+ "outputs": obj.get("outputs"),
86
+ }
87
+ )
88
+ return _obj
@@ -0,0 +1,36 @@
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 XGBoostSerializationFormat(str, Enum):
21
+ """
22
+ +label=Serialization format +usage=Serialization format used for XGBoost models
23
+ """
24
+
25
+ """
26
+ allowed enum values
27
+ """
28
+ CLOUDPICKLE = "cloudpickle"
29
+ JOBLIB = "joblib"
30
+ PICKLE = "pickle"
31
+ JSON = "json"
32
+
33
+ @classmethod
34
+ def from_json(cls, json_str: str) -> XGBoostSerializationFormat:
35
+ """Create an instance of XGBoostSerializationFormat from a JSON string"""
36
+ return XGBoostSerializationFormat(json.loads(json_str))