truefoundry 0.3.3__py3-none-any.whl → 0.4.0.dev0__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/cli/__main__.py +3 -17
- truefoundry/common/__init__.py +0 -0
- truefoundry/common/request_utils.py +56 -0
- truefoundry/deploy/cli/cli.py +1 -1
- truefoundry/deploy/lib/auth/credential_provider.py +2 -12
- truefoundry/deploy/lib/clients/servicefoundry_client.py +0 -9
- truefoundry/deploy/lib/exceptions.py +1 -6
- truefoundry/deploy/lib/session.py +1 -16
- truefoundry/langchain/truefoundry_chat.py +1 -1
- truefoundry/langchain/truefoundry_embeddings.py +1 -1
- truefoundry/langchain/truefoundry_llm.py +1 -1
- truefoundry/langchain/utils.py +0 -41
- truefoundry/ml/__init__.py +46 -6
- truefoundry/ml/artifact/__init__.py +0 -0
- truefoundry/ml/artifact/truefoundry_artifact_repo.py +1120 -0
- truefoundry/ml/autogen/__init__.py +0 -0
- truefoundry/ml/autogen/client/__init__.py +373 -0
- truefoundry/ml/autogen/client/api/__init__.py +16 -0
- truefoundry/ml/autogen/client/api/auth_api.py +184 -0
- truefoundry/ml/autogen/client/api/deprecated_api.py +605 -0
- truefoundry/ml/autogen/client/api/experiments_api.py +2109 -0
- truefoundry/ml/autogen/client/api/health_api.py +299 -0
- truefoundry/ml/autogen/client/api/metrics_api.py +371 -0
- truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py +7213 -0
- truefoundry/ml/autogen/client/api/python_deployment_config_api.py +201 -0
- truefoundry/ml/autogen/client/api/run_artifacts_api.py +231 -0
- truefoundry/ml/autogen/client/api/runs_api.py +2919 -0
- truefoundry/ml/autogen/client/api_client.py +822 -0
- truefoundry/ml/autogen/client/api_response.py +30 -0
- truefoundry/ml/autogen/client/configuration.py +489 -0
- truefoundry/ml/autogen/client/exceptions.py +161 -0
- truefoundry/ml/autogen/client/models/__init__.py +344 -0
- truefoundry/ml/autogen/client/models/add_custom_metrics_to_model_version_request_dto.py +69 -0
- truefoundry/ml/autogen/client/models/add_features_to_model_version_request_dto.py +83 -0
- truefoundry/ml/autogen/client/models/agent.py +125 -0
- truefoundry/ml/autogen/client/models/agent_app.py +118 -0
- truefoundry/ml/autogen/client/models/agent_open_api_tool.py +143 -0
- truefoundry/ml/autogen/client/models/agent_open_api_tool_with_fqn.py +144 -0
- truefoundry/ml/autogen/client/models/agent_with_fqn.py +127 -0
- truefoundry/ml/autogen/client/models/artifact_dto.py +115 -0
- truefoundry/ml/autogen/client/models/artifact_response_dto.py +75 -0
- truefoundry/ml/autogen/client/models/artifact_type.py +39 -0
- truefoundry/ml/autogen/client/models/artifact_version_dto.py +141 -0
- truefoundry/ml/autogen/client/models/artifact_version_response_dto.py +77 -0
- truefoundry/ml/autogen/client/models/artifact_version_status.py +35 -0
- truefoundry/ml/autogen/client/models/assistant_message.py +89 -0
- truefoundry/ml/autogen/client/models/authorize_user_for_model_request_dto.py +69 -0
- truefoundry/ml/autogen/client/models/authorize_user_for_model_version_request_dto.py +69 -0
- truefoundry/ml/autogen/client/models/backfill_default_storage_integration_id_request_dto.py +67 -0
- truefoundry/ml/autogen/client/models/blob_storage_reference.py +93 -0
- truefoundry/ml/autogen/client/models/body_get_search_runs_get.py +72 -0
- truefoundry/ml/autogen/client/models/chat_prompt.py +156 -0
- truefoundry/ml/autogen/client/models/chat_prompt_messages_inner.py +171 -0
- truefoundry/ml/autogen/client/models/columns_dto.py +73 -0
- truefoundry/ml/autogen/client/models/content.py +153 -0
- truefoundry/ml/autogen/client/models/content1.py +153 -0
- truefoundry/ml/autogen/client/models/content2.py +174 -0
- truefoundry/ml/autogen/client/models/content2_any_of_inner.py +150 -0
- truefoundry/ml/autogen/client/models/create_artifact_request_dto.py +74 -0
- truefoundry/ml/autogen/client/models/create_artifact_response_dto.py +66 -0
- truefoundry/ml/autogen/client/models/create_artifact_version_request_dto.py +74 -0
- truefoundry/ml/autogen/client/models/create_artifact_version_response_dto.py +66 -0
- truefoundry/ml/autogen/client/models/create_dataset_request_dto.py +76 -0
- truefoundry/ml/autogen/client/models/create_experiment_request_dto.py +94 -0
- truefoundry/ml/autogen/client/models/create_experiment_response_dto.py +67 -0
- truefoundry/ml/autogen/client/models/create_model_version_request_dto.py +95 -0
- truefoundry/ml/autogen/client/models/create_multi_part_upload_for_dataset_request_dto.py +73 -0
- truefoundry/ml/autogen/client/models/create_multi_part_upload_for_dataset_response_dto.py +79 -0
- truefoundry/ml/autogen/client/models/create_multi_part_upload_request_dto.py +73 -0
- truefoundry/ml/autogen/client/models/create_python_deployment_config_request_dto.py +72 -0
- truefoundry/ml/autogen/client/models/create_python_deployment_config_response_dto.py +68 -0
- truefoundry/ml/autogen/client/models/create_run_request_dto.py +97 -0
- truefoundry/ml/autogen/client/models/create_run_response_dto.py +76 -0
- truefoundry/ml/autogen/client/models/dataset_dto.py +112 -0
- truefoundry/ml/autogen/client/models/dataset_response_dto.py +75 -0
- truefoundry/ml/autogen/client/models/delete_artifact_versions_request_dto.py +65 -0
- truefoundry/ml/autogen/client/models/delete_dataset_request_dto.py +74 -0
- truefoundry/ml/autogen/client/models/delete_model_version_request_dto.py +65 -0
- truefoundry/ml/autogen/client/models/delete_run_request.py +65 -0
- truefoundry/ml/autogen/client/models/delete_tag_request_dto.py +68 -0
- truefoundry/ml/autogen/client/models/experiment_dto.py +127 -0
- truefoundry/ml/autogen/client/models/experiment_id_request_dto.py +67 -0
- truefoundry/ml/autogen/client/models/experiment_response_dto.py +75 -0
- truefoundry/ml/autogen/client/models/experiment_tag_dto.py +69 -0
- truefoundry/ml/autogen/client/models/feature_dto.py +68 -0
- truefoundry/ml/autogen/client/models/feature_value_type.py +35 -0
- truefoundry/ml/autogen/client/models/file_info_dto.py +76 -0
- truefoundry/ml/autogen/client/models/finalize_artifact_version_request_dto.py +101 -0
- truefoundry/ml/autogen/client/models/get_experiment_response_dto.py +88 -0
- truefoundry/ml/autogen/client/models/get_latest_run_log_response_dto.py +76 -0
- truefoundry/ml/autogen/client/models/get_metric_history_response.py +79 -0
- truefoundry/ml/autogen/client/models/get_signed_url_for_dataset_write_request_dto.py +68 -0
- truefoundry/ml/autogen/client/models/get_signed_urls_for_artifact_version_read_request_dto.py +68 -0
- truefoundry/ml/autogen/client/models/get_signed_urls_for_artifact_version_read_response_dto.py +81 -0
- truefoundry/ml/autogen/client/models/get_signed_urls_for_artifact_version_write_request_dto.py +69 -0
- truefoundry/ml/autogen/client/models/get_signed_urls_for_artifact_version_write_response_dto.py +83 -0
- truefoundry/ml/autogen/client/models/get_signed_urls_for_dataset_read_request_dto.py +68 -0
- truefoundry/ml/autogen/client/models/get_signed_urls_for_dataset_read_response_dto.py +81 -0
- truefoundry/ml/autogen/client/models/get_signed_urls_for_dataset_write_response_dto.py +81 -0
- truefoundry/ml/autogen/client/models/get_tenant_id_response_dto.py +74 -0
- truefoundry/ml/autogen/client/models/http_validation_error.py +82 -0
- truefoundry/ml/autogen/client/models/image_content_part.py +87 -0
- truefoundry/ml/autogen/client/models/image_url.py +75 -0
- truefoundry/ml/autogen/client/models/internal_metadata.py +180 -0
- truefoundry/ml/autogen/client/models/latest_run_log_dto.py +78 -0
- truefoundry/ml/autogen/client/models/list_artifact_versions_request_dto.py +107 -0
- truefoundry/ml/autogen/client/models/list_artifact_versions_response_dto.py +87 -0
- truefoundry/ml/autogen/client/models/list_artifacts_request_dto.py +96 -0
- truefoundry/ml/autogen/client/models/list_artifacts_response_dto.py +86 -0
- truefoundry/ml/autogen/client/models/list_colums_response_dto.py +75 -0
- truefoundry/ml/autogen/client/models/list_datasets_request_dto.py +78 -0
- truefoundry/ml/autogen/client/models/list_datasets_response_dto.py +86 -0
- truefoundry/ml/autogen/client/models/list_experiments_response_dto.py +86 -0
- truefoundry/ml/autogen/client/models/list_files_for_artifact_version_request_dto.py +76 -0
- truefoundry/ml/autogen/client/models/list_files_for_artifact_versions_response_dto.py +82 -0
- truefoundry/ml/autogen/client/models/list_files_for_dataset_request_dto.py +76 -0
- truefoundry/ml/autogen/client/models/list_files_for_dataset_response_dto.py +82 -0
- truefoundry/ml/autogen/client/models/list_latest_run_logs_response_dto.py +82 -0
- truefoundry/ml/autogen/client/models/list_metric_history_request_dto.py +69 -0
- truefoundry/ml/autogen/client/models/list_metric_history_response_dto.py +84 -0
- truefoundry/ml/autogen/client/models/list_model_version_response_dto.py +87 -0
- truefoundry/ml/autogen/client/models/list_model_versions_request_dto.py +93 -0
- truefoundry/ml/autogen/client/models/list_models_request_dto.py +89 -0
- truefoundry/ml/autogen/client/models/list_models_response_dto.py +84 -0
- truefoundry/ml/autogen/client/models/list_run_artifacts_response_dto.py +84 -0
- truefoundry/ml/autogen/client/models/list_run_logs_response_dto.py +82 -0
- truefoundry/ml/autogen/client/models/list_seed_experiments_response_dto.py +81 -0
- truefoundry/ml/autogen/client/models/log_batch_request_dto.py +106 -0
- truefoundry/ml/autogen/client/models/log_metric_request_dto.py +80 -0
- truefoundry/ml/autogen/client/models/log_param_request_dto.py +76 -0
- truefoundry/ml/autogen/client/models/method.py +37 -0
- truefoundry/ml/autogen/client/models/metric_collection_dto.py +82 -0
- truefoundry/ml/autogen/client/models/metric_dto.py +76 -0
- truefoundry/ml/autogen/client/models/mime_type.py +37 -0
- truefoundry/ml/autogen/client/models/model_configuration.py +103 -0
- truefoundry/ml/autogen/client/models/model_dto.py +122 -0
- truefoundry/ml/autogen/client/models/model_response_dto.py +75 -0
- truefoundry/ml/autogen/client/models/model_schema_dto.py +85 -0
- truefoundry/ml/autogen/client/models/model_version_dto.py +163 -0
- truefoundry/ml/autogen/client/models/model_version_response_dto.py +75 -0
- truefoundry/ml/autogen/client/models/multi_part_upload_dto.py +107 -0
- truefoundry/ml/autogen/client/models/multi_part_upload_response_dto.py +79 -0
- truefoundry/ml/autogen/client/models/multi_part_upload_storage_provider.py +34 -0
- truefoundry/ml/autogen/client/models/notify_artifact_version_failure_dto.py +65 -0
- truefoundry/ml/autogen/client/models/openapi_spec.py +152 -0
- truefoundry/ml/autogen/client/models/param_dto.py +66 -0
- truefoundry/ml/autogen/client/models/parameters.py +84 -0
- truefoundry/ml/autogen/client/models/prediction_type.py +34 -0
- truefoundry/ml/autogen/client/models/resolve_agent_app_response_dto.py +75 -0
- truefoundry/ml/autogen/client/models/restore_run_request_dto.py +65 -0
- truefoundry/ml/autogen/client/models/run_data_dto.py +104 -0
- truefoundry/ml/autogen/client/models/run_dto.py +84 -0
- truefoundry/ml/autogen/client/models/run_info_dto.py +105 -0
- truefoundry/ml/autogen/client/models/run_log_dto.py +90 -0
- truefoundry/ml/autogen/client/models/run_log_input_dto.py +80 -0
- truefoundry/ml/autogen/client/models/run_response_dto.py +75 -0
- truefoundry/ml/autogen/client/models/run_tag_dto.py +66 -0
- truefoundry/ml/autogen/client/models/search_runs_request_dto.py +94 -0
- truefoundry/ml/autogen/client/models/search_runs_response_dto.py +84 -0
- truefoundry/ml/autogen/client/models/set_experiment_tag_request_dto.py +73 -0
- truefoundry/ml/autogen/client/models/set_tag_request_dto.py +76 -0
- truefoundry/ml/autogen/client/models/signed_url_dto.py +69 -0
- truefoundry/ml/autogen/client/models/stop.py +152 -0
- truefoundry/ml/autogen/client/models/store_run_logs_request_dto.py +83 -0
- truefoundry/ml/autogen/client/models/system_message.py +89 -0
- truefoundry/ml/autogen/client/models/text.py +153 -0
- truefoundry/ml/autogen/client/models/text_content_part.py +84 -0
- truefoundry/ml/autogen/client/models/update_artifact_version_request_dto.py +74 -0
- truefoundry/ml/autogen/client/models/update_dataset_request_dto.py +74 -0
- truefoundry/ml/autogen/client/models/update_experiment_request_dto.py +74 -0
- truefoundry/ml/autogen/client/models/update_model_version_request_dto.py +93 -0
- truefoundry/ml/autogen/client/models/update_run_request_dto.py +78 -0
- truefoundry/ml/autogen/client/models/update_run_response_dto.py +76 -0
- truefoundry/ml/autogen/client/models/url.py +153 -0
- truefoundry/ml/autogen/client/models/user_message.py +89 -0
- truefoundry/ml/autogen/client/models/validation_error.py +87 -0
- truefoundry/ml/autogen/client/models/validation_error_loc_inner.py +154 -0
- truefoundry/ml/autogen/client/rest.py +426 -0
- truefoundry/ml/autogen/client_README.md +322 -0
- truefoundry/ml/cli/__init__.py +0 -0
- truefoundry/ml/cli/cli.py +18 -0
- truefoundry/ml/cli/commands/__init__.py +3 -0
- truefoundry/ml/cli/commands/download.py +87 -0
- truefoundry/ml/constants.py +84 -0
- truefoundry/ml/enums.py +70 -0
- truefoundry/ml/env_vars.py +13 -0
- truefoundry/ml/exceptions.py +8 -0
- truefoundry/ml/git_info.py +60 -0
- truefoundry/ml/internal_namespace.py +52 -0
- truefoundry/ml/log_types/__init__.py +4 -0
- truefoundry/ml/log_types/artifacts/artifact.py +427 -0
- truefoundry/ml/log_types/artifacts/constants.py +33 -0
- truefoundry/ml/log_types/artifacts/dataset.py +383 -0
- truefoundry/ml/log_types/artifacts/general_artifact.py +110 -0
- truefoundry/ml/log_types/artifacts/model.py +628 -0
- truefoundry/ml/log_types/artifacts/model_extras.py +48 -0
- truefoundry/ml/log_types/artifacts/utils.py +161 -0
- truefoundry/ml/log_types/image/__init__.py +3 -0
- truefoundry/ml/log_types/image/constants.py +8 -0
- truefoundry/ml/log_types/image/image.py +358 -0
- truefoundry/ml/log_types/image/image_normalizer.py +101 -0
- truefoundry/ml/log_types/image/types.py +68 -0
- truefoundry/ml/log_types/plot.py +281 -0
- truefoundry/ml/log_types/pydantic_base.py +10 -0
- truefoundry/ml/log_types/utils.py +12 -0
- truefoundry/ml/logger.py +17 -0
- truefoundry/ml/login.py +241 -0
- truefoundry/ml/mlfoundry_api.py +1620 -0
- truefoundry/ml/mlfoundry_run.py +1238 -0
- truefoundry/ml/run_utils.py +102 -0
- truefoundry/ml/services/__init__.py +0 -0
- truefoundry/ml/services/auth_service.py +109 -0
- truefoundry/ml/services/entities.py +108 -0
- truefoundry/ml/services/servicefoundry_service.py +35 -0
- truefoundry/ml/services/utils.py +122 -0
- truefoundry/ml/session.py +271 -0
- truefoundry/ml/validation_utils.py +346 -0
- truefoundry/pydantic_v1.py +5 -1
- {truefoundry-0.3.3.dist-info → truefoundry-0.4.0.dev0.dist-info}/METADATA +19 -12
- truefoundry-0.4.0.dev0.dist-info/RECORD +342 -0
- truefoundry-0.3.3.dist-info/RECORD +0 -136
- /truefoundry/{python_deploy_codegen.py → deploy/python_deploy_codegen.py} +0 -0
- {truefoundry-0.3.3.dist-info → truefoundry-0.4.0.dev0.dist-info}/WHEEL +0 -0
- {truefoundry-0.3.3.dist-info → truefoundry-0.4.0.dev0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
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, Union
|
|
20
|
+
|
|
21
|
+
from truefoundry.pydantic_v1 import BaseModel, Field, StrictFloat, StrictInt, StrictStr
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class MetricDto(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
MetricDto
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
key: StrictStr = Field(...)
|
|
30
|
+
value: Optional[Union[StrictFloat, StrictInt]] = None
|
|
31
|
+
timestamp: Optional[StrictInt] = None
|
|
32
|
+
step: Optional[StrictInt] = 0
|
|
33
|
+
__properties = ["key", "value", "timestamp", "step"]
|
|
34
|
+
|
|
35
|
+
class Config:
|
|
36
|
+
"""Pydantic configuration"""
|
|
37
|
+
|
|
38
|
+
allow_population_by_field_name = True
|
|
39
|
+
validate_assignment = True
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> MetricDto:
|
|
51
|
+
"""Create an instance of MetricDto from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self):
|
|
55
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
56
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
57
|
+
return _dict
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_dict(cls, obj: dict) -> MetricDto:
|
|
61
|
+
"""Create an instance of MetricDto from a dict"""
|
|
62
|
+
if obj is None:
|
|
63
|
+
return None
|
|
64
|
+
|
|
65
|
+
if not isinstance(obj, dict):
|
|
66
|
+
return MetricDto.parse_obj(obj)
|
|
67
|
+
|
|
68
|
+
_obj = MetricDto.parse_obj(
|
|
69
|
+
{
|
|
70
|
+
"key": obj.get("key"),
|
|
71
|
+
"value": obj.get("value"),
|
|
72
|
+
"timestamp": obj.get("timestamp"),
|
|
73
|
+
"step": obj.get("step") if obj.get("step") is not None else 0,
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
return _obj
|
|
@@ -0,0 +1,37 @@
|
|
|
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 MimeType(str, Enum):
|
|
21
|
+
"""
|
|
22
|
+
+label=MIME Type +usage=MIME type of the content
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
allowed enum values
|
|
27
|
+
"""
|
|
28
|
+
TEXT_SLASH_PLAIN = "text/plain"
|
|
29
|
+
APPLICATION_SLASH_JSON = "application/json"
|
|
30
|
+
IMAGE_SLASH_PNG = "image/png"
|
|
31
|
+
IMAGE_SLASH_JPEG = "image/jpeg"
|
|
32
|
+
APPLICATION_SLASH_X_MINUS_DIRECTORY = "application/x-directory"
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def from_json(cls, json_str: str) -> MimeType:
|
|
36
|
+
"""Create an instance of MimeType from a JSON string"""
|
|
37
|
+
return MimeType(json.loads(json_str))
|
|
@@ -0,0 +1,103 @@
|
|
|
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.parameters import Parameters
|
|
22
|
+
from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, constr, validator
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ModelConfiguration(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
+label=Model Configuration +icon=fa-cogs:#326ce5 +message=Configuration details for the provider and corresponding config +usage=Define the provider and its configuration +docs=Configuration settings specific to the provider, including model settings and other parameters. # noqa: E501
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
provider: StrictStr = Field(
|
|
31
|
+
default=...,
|
|
32
|
+
description='+label=Provider Name +usage=Name of the provider, must be non-empty, e.g., "openai", "google_gemini"',
|
|
33
|
+
)
|
|
34
|
+
model: constr(strict=True) = Field(
|
|
35
|
+
default=...,
|
|
36
|
+
description="+label=Model name +usage=Model name, must be non-empty",
|
|
37
|
+
)
|
|
38
|
+
parameters: Optional[Parameters] = Field(
|
|
39
|
+
default=None,
|
|
40
|
+
description="+usage=Parameters for the provider +label=Parameters +docs=Key-value pairs to store additional parameters for the provider",
|
|
41
|
+
)
|
|
42
|
+
extra_parameters: Optional[Dict[str, Any]] = Field(
|
|
43
|
+
default=None,
|
|
44
|
+
description="+usage=Extra parameters for the provider +label=Extra Parameters +docs=Additional parameters for the provider",
|
|
45
|
+
)
|
|
46
|
+
__properties = ["provider", "model", "parameters", "extra_parameters"]
|
|
47
|
+
|
|
48
|
+
@validator("model")
|
|
49
|
+
def model_validate_regular_expression(cls, value):
|
|
50
|
+
"""Validates the regular expression"""
|
|
51
|
+
if not re.match(r"^[a-zA-Z][a-zA-Z0-9\-]{1,30}[a-zA-Z0-9]$", value):
|
|
52
|
+
raise ValueError(
|
|
53
|
+
r"must validate the regular expression /^[a-zA-Z][a-zA-Z0-9\-]{1,30}[a-zA-Z0-9]$/"
|
|
54
|
+
)
|
|
55
|
+
return value
|
|
56
|
+
|
|
57
|
+
class Config:
|
|
58
|
+
"""Pydantic configuration"""
|
|
59
|
+
|
|
60
|
+
allow_population_by_field_name = True
|
|
61
|
+
validate_assignment = True
|
|
62
|
+
|
|
63
|
+
def to_str(self) -> str:
|
|
64
|
+
"""Returns the string representation of the model using alias"""
|
|
65
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
66
|
+
|
|
67
|
+
def to_json(self) -> str:
|
|
68
|
+
"""Returns the JSON representation of the model using alias"""
|
|
69
|
+
return json.dumps(self.to_dict())
|
|
70
|
+
|
|
71
|
+
@classmethod
|
|
72
|
+
def from_json(cls, json_str: str) -> ModelConfiguration:
|
|
73
|
+
"""Create an instance of ModelConfiguration from a JSON string"""
|
|
74
|
+
return cls.from_dict(json.loads(json_str))
|
|
75
|
+
|
|
76
|
+
def to_dict(self):
|
|
77
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
78
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
79
|
+
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of parameters
|
|
80
|
+
if self.parameters:
|
|
81
|
+
_dict["parameters"] = self.parameters.to_dict()
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: dict) -> ModelConfiguration:
|
|
86
|
+
"""Create an instance of ModelConfiguration from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return ModelConfiguration.parse_obj(obj)
|
|
92
|
+
|
|
93
|
+
_obj = ModelConfiguration.parse_obj(
|
|
94
|
+
{
|
|
95
|
+
"provider": obj.get("provider"),
|
|
96
|
+
"model": obj.get("model"),
|
|
97
|
+
"parameters": Parameters.from_dict(obj.get("parameters"))
|
|
98
|
+
if obj.get("parameters") is not None
|
|
99
|
+
else None,
|
|
100
|
+
"extra_parameters": obj.get("extra_parameters"),
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
return _obj
|
|
@@ -0,0 +1,122 @@
|
|
|
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 datetime import datetime
|
|
20
|
+
from typing import Optional
|
|
21
|
+
|
|
22
|
+
from truefoundry.ml.autogen.client.models.artifact_type import ArtifactType
|
|
23
|
+
from truefoundry.ml.autogen.client.models.experiment_dto import ExperimentDto
|
|
24
|
+
from truefoundry.ml.autogen.client.models.model_version_dto import ModelVersionDto
|
|
25
|
+
from truefoundry.pydantic_v1 import BaseModel, StrictBool, StrictStr
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ModelDto(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
ModelDto
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
id: Optional[StrictStr] = None
|
|
34
|
+
experiment_id: Optional[StrictStr] = None
|
|
35
|
+
type: Optional[ArtifactType] = None
|
|
36
|
+
name: Optional[StrictStr] = None
|
|
37
|
+
fqn: Optional[StrictStr] = None
|
|
38
|
+
description: Optional[StrictStr] = None
|
|
39
|
+
created_by: Optional[StrictStr] = None
|
|
40
|
+
created_at: Optional[datetime] = None
|
|
41
|
+
updated_at: Optional[datetime] = None
|
|
42
|
+
artifact_storage_root: Optional[StrictStr] = None
|
|
43
|
+
latest_version: Optional[ModelVersionDto] = None
|
|
44
|
+
monitoring_enabled: Optional[StrictBool] = None
|
|
45
|
+
experiment: Optional[ExperimentDto] = None
|
|
46
|
+
__properties = [
|
|
47
|
+
"id",
|
|
48
|
+
"experiment_id",
|
|
49
|
+
"type",
|
|
50
|
+
"name",
|
|
51
|
+
"fqn",
|
|
52
|
+
"description",
|
|
53
|
+
"created_by",
|
|
54
|
+
"created_at",
|
|
55
|
+
"updated_at",
|
|
56
|
+
"artifact_storage_root",
|
|
57
|
+
"latest_version",
|
|
58
|
+
"monitoring_enabled",
|
|
59
|
+
"experiment",
|
|
60
|
+
]
|
|
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) -> ModelDto:
|
|
78
|
+
"""Create an instance of ModelDto 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 latest_version
|
|
85
|
+
if self.latest_version:
|
|
86
|
+
_dict["latest_version"] = self.latest_version.to_dict()
|
|
87
|
+
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of experiment
|
|
88
|
+
if self.experiment:
|
|
89
|
+
_dict["experiment"] = self.experiment.to_dict()
|
|
90
|
+
return _dict
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def from_dict(cls, obj: dict) -> ModelDto:
|
|
94
|
+
"""Create an instance of ModelDto from a dict"""
|
|
95
|
+
if obj is None:
|
|
96
|
+
return None
|
|
97
|
+
|
|
98
|
+
if not isinstance(obj, dict):
|
|
99
|
+
return ModelDto.parse_obj(obj)
|
|
100
|
+
|
|
101
|
+
_obj = ModelDto.parse_obj(
|
|
102
|
+
{
|
|
103
|
+
"id": obj.get("id"),
|
|
104
|
+
"experiment_id": obj.get("experiment_id"),
|
|
105
|
+
"type": obj.get("type"),
|
|
106
|
+
"name": obj.get("name"),
|
|
107
|
+
"fqn": obj.get("fqn"),
|
|
108
|
+
"description": obj.get("description"),
|
|
109
|
+
"created_by": obj.get("created_by"),
|
|
110
|
+
"created_at": obj.get("created_at"),
|
|
111
|
+
"updated_at": obj.get("updated_at"),
|
|
112
|
+
"artifact_storage_root": obj.get("artifact_storage_root"),
|
|
113
|
+
"latest_version": ModelVersionDto.from_dict(obj.get("latest_version"))
|
|
114
|
+
if obj.get("latest_version") is not None
|
|
115
|
+
else None,
|
|
116
|
+
"monitoring_enabled": obj.get("monitoring_enabled"),
|
|
117
|
+
"experiment": ExperimentDto.from_dict(obj.get("experiment"))
|
|
118
|
+
if obj.get("experiment") is not None
|
|
119
|
+
else None,
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
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.ml.autogen.client.models.model_dto import ModelDto
|
|
21
|
+
from truefoundry.pydantic_v1 import BaseModel, Field
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ModelResponseDto(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
ModelResponseDto
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
model: ModelDto = Field(...)
|
|
30
|
+
__properties = ["model"]
|
|
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) -> ModelResponseDto:
|
|
48
|
+
"""Create an instance of ModelResponseDto 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
|
+
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of model
|
|
55
|
+
if self.model:
|
|
56
|
+
_dict["model"] = self.model.to_dict()
|
|
57
|
+
return _dict
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_dict(cls, obj: dict) -> ModelResponseDto:
|
|
61
|
+
"""Create an instance of ModelResponseDto from a dict"""
|
|
62
|
+
if obj is None:
|
|
63
|
+
return None
|
|
64
|
+
|
|
65
|
+
if not isinstance(obj, dict):
|
|
66
|
+
return ModelResponseDto.parse_obj(obj)
|
|
67
|
+
|
|
68
|
+
_obj = ModelResponseDto.parse_obj(
|
|
69
|
+
{
|
|
70
|
+
"model": ModelDto.from_dict(obj.get("model"))
|
|
71
|
+
if obj.get("model") is not None
|
|
72
|
+
else None
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
return _obj
|
|
@@ -0,0 +1,85 @@
|
|
|
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.feature_dto import FeatureDto
|
|
22
|
+
from truefoundry.ml.autogen.client.models.prediction_type import PredictionType
|
|
23
|
+
from truefoundry.pydantic_v1 import BaseModel, conlist
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ModelSchemaDto(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
ModelSchemaDto
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
features: Optional[conlist(FeatureDto)] = None
|
|
32
|
+
prediction: Optional[PredictionType] = None
|
|
33
|
+
__properties = ["features", "prediction"]
|
|
34
|
+
|
|
35
|
+
class Config:
|
|
36
|
+
"""Pydantic configuration"""
|
|
37
|
+
|
|
38
|
+
allow_population_by_field_name = True
|
|
39
|
+
validate_assignment = True
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> ModelSchemaDto:
|
|
51
|
+
"""Create an instance of ModelSchemaDto from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self):
|
|
55
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
56
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
57
|
+
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of each item in features (list)
|
|
58
|
+
_items = []
|
|
59
|
+
if self.features:
|
|
60
|
+
for _item in self.features:
|
|
61
|
+
if _item:
|
|
62
|
+
_items.append(_item.to_dict())
|
|
63
|
+
_dict["features"] = _items
|
|
64
|
+
return _dict
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def from_dict(cls, obj: dict) -> ModelSchemaDto:
|
|
68
|
+
"""Create an instance of ModelSchemaDto from a dict"""
|
|
69
|
+
if obj is None:
|
|
70
|
+
return None
|
|
71
|
+
|
|
72
|
+
if not isinstance(obj, dict):
|
|
73
|
+
return ModelSchemaDto.parse_obj(obj)
|
|
74
|
+
|
|
75
|
+
_obj = ModelSchemaDto.parse_obj(
|
|
76
|
+
{
|
|
77
|
+
"features": [
|
|
78
|
+
FeatureDto.from_dict(_item) for _item in obj.get("features")
|
|
79
|
+
]
|
|
80
|
+
if obj.get("features") is not None
|
|
81
|
+
else None,
|
|
82
|
+
"prediction": obj.get("prediction"),
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
return _obj
|
|
@@ -0,0 +1,163 @@
|
|
|
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 datetime import datetime
|
|
20
|
+
from typing import Any, Dict, Optional
|
|
21
|
+
|
|
22
|
+
from truefoundry.ml.autogen.client.models.artifact_version_status import (
|
|
23
|
+
ArtifactVersionStatus,
|
|
24
|
+
)
|
|
25
|
+
from truefoundry.ml.autogen.client.models.metric_dto import MetricDto
|
|
26
|
+
from truefoundry.ml.autogen.client.models.model_schema_dto import ModelSchemaDto
|
|
27
|
+
from truefoundry.pydantic_v1 import BaseModel, StrictBool, StrictInt, StrictStr, conlist
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ModelVersionDto(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
ModelVersionDto
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
id: Optional[StrictStr] = None
|
|
36
|
+
model_id: Optional[StrictStr] = None
|
|
37
|
+
version: Optional[StrictInt] = None
|
|
38
|
+
fqn: Optional[StrictStr] = None
|
|
39
|
+
artifact_storage_root: Optional[StrictStr] = None
|
|
40
|
+
artifact_metadata: Optional[Dict[str, Any]] = None
|
|
41
|
+
description: Optional[StrictStr] = None
|
|
42
|
+
status: Optional[ArtifactVersionStatus] = None
|
|
43
|
+
step: Optional[StrictInt] = 0
|
|
44
|
+
created_by: Optional[StrictStr] = None
|
|
45
|
+
model_schema: Optional[ModelSchemaDto] = None
|
|
46
|
+
custom_metrics: Optional[conlist(Dict[str, Any])] = None
|
|
47
|
+
created_at: Optional[datetime] = None
|
|
48
|
+
updated_at: Optional[datetime] = None
|
|
49
|
+
model_fqn: Optional[StrictStr] = None
|
|
50
|
+
data_path: Optional[StrictStr] = None
|
|
51
|
+
monitoring_enabled: Optional[StrictBool] = False
|
|
52
|
+
usage_code_snippet: Optional[StrictStr] = None
|
|
53
|
+
experiment_id: Optional[StrictStr] = None
|
|
54
|
+
run_id: Optional[StrictStr] = None
|
|
55
|
+
metrics: Optional[conlist(MetricDto)] = None
|
|
56
|
+
model_name: Optional[StrictStr] = None
|
|
57
|
+
model_framework: Optional[StrictStr] = None
|
|
58
|
+
artifact_size: Optional[StrictInt] = None
|
|
59
|
+
__properties = [
|
|
60
|
+
"id",
|
|
61
|
+
"model_id",
|
|
62
|
+
"version",
|
|
63
|
+
"fqn",
|
|
64
|
+
"artifact_storage_root",
|
|
65
|
+
"artifact_metadata",
|
|
66
|
+
"description",
|
|
67
|
+
"status",
|
|
68
|
+
"step",
|
|
69
|
+
"created_by",
|
|
70
|
+
"model_schema",
|
|
71
|
+
"custom_metrics",
|
|
72
|
+
"created_at",
|
|
73
|
+
"updated_at",
|
|
74
|
+
"model_fqn",
|
|
75
|
+
"data_path",
|
|
76
|
+
"monitoring_enabled",
|
|
77
|
+
"usage_code_snippet",
|
|
78
|
+
"experiment_id",
|
|
79
|
+
"run_id",
|
|
80
|
+
"metrics",
|
|
81
|
+
"model_name",
|
|
82
|
+
"model_framework",
|
|
83
|
+
"artifact_size",
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
class Config:
|
|
87
|
+
"""Pydantic configuration"""
|
|
88
|
+
|
|
89
|
+
allow_population_by_field_name = True
|
|
90
|
+
validate_assignment = True
|
|
91
|
+
|
|
92
|
+
def to_str(self) -> str:
|
|
93
|
+
"""Returns the string representation of the model using alias"""
|
|
94
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
95
|
+
|
|
96
|
+
def to_json(self) -> str:
|
|
97
|
+
"""Returns the JSON representation of the model using alias"""
|
|
98
|
+
return json.dumps(self.to_dict())
|
|
99
|
+
|
|
100
|
+
@classmethod
|
|
101
|
+
def from_json(cls, json_str: str) -> ModelVersionDto:
|
|
102
|
+
"""Create an instance of ModelVersionDto from a JSON string"""
|
|
103
|
+
return cls.from_dict(json.loads(json_str))
|
|
104
|
+
|
|
105
|
+
def to_dict(self):
|
|
106
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
107
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
108
|
+
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of model_schema
|
|
109
|
+
if self.model_schema:
|
|
110
|
+
_dict["model_schema"] = self.model_schema.to_dict()
|
|
111
|
+
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of each item in metrics (list)
|
|
112
|
+
_items = []
|
|
113
|
+
if self.metrics:
|
|
114
|
+
for _item in self.metrics:
|
|
115
|
+
if _item:
|
|
116
|
+
_items.append(_item.to_dict())
|
|
117
|
+
_dict["metrics"] = _items
|
|
118
|
+
return _dict
|
|
119
|
+
|
|
120
|
+
@classmethod
|
|
121
|
+
def from_dict(cls, obj: dict) -> ModelVersionDto:
|
|
122
|
+
"""Create an instance of ModelVersionDto from a dict"""
|
|
123
|
+
if obj is None:
|
|
124
|
+
return None
|
|
125
|
+
|
|
126
|
+
if not isinstance(obj, dict):
|
|
127
|
+
return ModelVersionDto.parse_obj(obj)
|
|
128
|
+
|
|
129
|
+
_obj = ModelVersionDto.parse_obj(
|
|
130
|
+
{
|
|
131
|
+
"id": obj.get("id"),
|
|
132
|
+
"model_id": obj.get("model_id"),
|
|
133
|
+
"version": obj.get("version"),
|
|
134
|
+
"fqn": obj.get("fqn"),
|
|
135
|
+
"artifact_storage_root": obj.get("artifact_storage_root"),
|
|
136
|
+
"artifact_metadata": obj.get("artifact_metadata"),
|
|
137
|
+
"description": obj.get("description"),
|
|
138
|
+
"status": obj.get("status"),
|
|
139
|
+
"step": obj.get("step") if obj.get("step") is not None else 0,
|
|
140
|
+
"created_by": obj.get("created_by"),
|
|
141
|
+
"model_schema": ModelSchemaDto.from_dict(obj.get("model_schema"))
|
|
142
|
+
if obj.get("model_schema") is not None
|
|
143
|
+
else None,
|
|
144
|
+
"custom_metrics": obj.get("custom_metrics"),
|
|
145
|
+
"created_at": obj.get("created_at"),
|
|
146
|
+
"updated_at": obj.get("updated_at"),
|
|
147
|
+
"model_fqn": obj.get("model_fqn"),
|
|
148
|
+
"data_path": obj.get("data_path"),
|
|
149
|
+
"monitoring_enabled": obj.get("monitoring_enabled")
|
|
150
|
+
if obj.get("monitoring_enabled") is not None
|
|
151
|
+
else False,
|
|
152
|
+
"usage_code_snippet": obj.get("usage_code_snippet"),
|
|
153
|
+
"experiment_id": obj.get("experiment_id"),
|
|
154
|
+
"run_id": obj.get("run_id"),
|
|
155
|
+
"metrics": [MetricDto.from_dict(_item) for _item in obj.get("metrics")]
|
|
156
|
+
if obj.get("metrics") is not None
|
|
157
|
+
else None,
|
|
158
|
+
"model_name": obj.get("model_name"),
|
|
159
|
+
"model_framework": obj.get("model_framework"),
|
|
160
|
+
"artifact_size": obj.get("artifact_size"),
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
return _obj
|