truefoundry 0.3.2__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/auto_gen/models.py +29 -1
- 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/{python_deploy_codegen.py → deploy/python_deploy_codegen.py} +1 -0
- 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.2.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.2.dist-info/RECORD +0 -136
- {truefoundry-0.3.2.dist-info → truefoundry-0.4.0.dev0.dist-info}/WHEEL +0 -0
- {truefoundry-0.3.2.dist-info → truefoundry-0.4.0.dev0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
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.agent_open_api_tool_with_fqn import (
|
|
22
|
+
AgentOpenAPIToolWithFQN,
|
|
23
|
+
)
|
|
24
|
+
from truefoundry.ml.autogen.client.models.agent_with_fqn import AgentWithFQN
|
|
25
|
+
from truefoundry.pydantic_v1 import (
|
|
26
|
+
BaseModel,
|
|
27
|
+
Field,
|
|
28
|
+
StrictStr,
|
|
29
|
+
conlist,
|
|
30
|
+
constr,
|
|
31
|
+
validator,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class AgentApp(BaseModel):
|
|
36
|
+
"""
|
|
37
|
+
AgentApp
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
type: Optional[StrictStr] = "agent-app"
|
|
41
|
+
tools: conlist(AgentOpenAPIToolWithFQN) = Field(...)
|
|
42
|
+
agents: conlist(AgentWithFQN) = Field(...)
|
|
43
|
+
root_agent: constr(strict=True, min_length=1) = Field(...)
|
|
44
|
+
__properties = ["type", "tools", "agents", "root_agent"]
|
|
45
|
+
|
|
46
|
+
@validator("type")
|
|
47
|
+
def type_validate_enum(cls, value):
|
|
48
|
+
"""Validates the enum"""
|
|
49
|
+
if value is None:
|
|
50
|
+
return value
|
|
51
|
+
|
|
52
|
+
if value not in ("agent-app"):
|
|
53
|
+
raise ValueError("must be one of enum values ('agent-app')")
|
|
54
|
+
return value
|
|
55
|
+
|
|
56
|
+
class Config:
|
|
57
|
+
"""Pydantic configuration"""
|
|
58
|
+
|
|
59
|
+
allow_population_by_field_name = True
|
|
60
|
+
validate_assignment = True
|
|
61
|
+
|
|
62
|
+
def to_str(self) -> str:
|
|
63
|
+
"""Returns the string representation of the model using alias"""
|
|
64
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
65
|
+
|
|
66
|
+
def to_json(self) -> str:
|
|
67
|
+
"""Returns the JSON representation of the model using alias"""
|
|
68
|
+
return json.dumps(self.to_dict())
|
|
69
|
+
|
|
70
|
+
@classmethod
|
|
71
|
+
def from_json(cls, json_str: str) -> AgentApp:
|
|
72
|
+
"""Create an instance of AgentApp from a JSON string"""
|
|
73
|
+
return cls.from_dict(json.loads(json_str))
|
|
74
|
+
|
|
75
|
+
def to_dict(self):
|
|
76
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
77
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
78
|
+
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of each item in tools (list)
|
|
79
|
+
_items = []
|
|
80
|
+
if self.tools:
|
|
81
|
+
for _item in self.tools:
|
|
82
|
+
if _item:
|
|
83
|
+
_items.append(_item.to_dict())
|
|
84
|
+
_dict["tools"] = _items
|
|
85
|
+
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of each item in agents (list)
|
|
86
|
+
_items = []
|
|
87
|
+
if self.agents:
|
|
88
|
+
for _item in self.agents:
|
|
89
|
+
if _item:
|
|
90
|
+
_items.append(_item.to_dict())
|
|
91
|
+
_dict["agents"] = _items
|
|
92
|
+
return _dict
|
|
93
|
+
|
|
94
|
+
@classmethod
|
|
95
|
+
def from_dict(cls, obj: dict) -> AgentApp:
|
|
96
|
+
"""Create an instance of AgentApp from a dict"""
|
|
97
|
+
if obj is None:
|
|
98
|
+
return None
|
|
99
|
+
|
|
100
|
+
if not isinstance(obj, dict):
|
|
101
|
+
return AgentApp.parse_obj(obj)
|
|
102
|
+
|
|
103
|
+
_obj = AgentApp.parse_obj(
|
|
104
|
+
{
|
|
105
|
+
"type": obj.get("type") if obj.get("type") is not None else "agent-app",
|
|
106
|
+
"tools": [
|
|
107
|
+
AgentOpenAPIToolWithFQN.from_dict(_item)
|
|
108
|
+
for _item in obj.get("tools")
|
|
109
|
+
]
|
|
110
|
+
if obj.get("tools") is not None
|
|
111
|
+
else None,
|
|
112
|
+
"agents": [AgentWithFQN.from_dict(_item) for _item in obj.get("agents")]
|
|
113
|
+
if obj.get("agents") is not None
|
|
114
|
+
else None,
|
|
115
|
+
"root_agent": obj.get("root_agent"),
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
return _obj
|
|
@@ -0,0 +1,143 @@
|
|
|
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 Dict, Optional
|
|
20
|
+
|
|
21
|
+
from truefoundry.ml.autogen.client.models.method import Method
|
|
22
|
+
from truefoundry.ml.autogen.client.models.openapi_spec import OpenapiSpec
|
|
23
|
+
from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, constr, validator
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class AgentOpenAPITool(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
OpenAPI Tool artifact. # noqa: E501
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
type: Optional[StrictStr] = "openapi-tool"
|
|
32
|
+
name: constr(strict=True) = Field(
|
|
33
|
+
default=..., description="Names cannot repeat accross tools +uiType=Hidden"
|
|
34
|
+
)
|
|
35
|
+
description: constr(strict=True, max_length=128, min_length=1) = Field(
|
|
36
|
+
default=..., description="+sort=10 +uiType=TextArea"
|
|
37
|
+
)
|
|
38
|
+
openapi_spec: OpenapiSpec = Field(...)
|
|
39
|
+
base_url: constr(strict=True) = Field(default=..., description="+sort=30")
|
|
40
|
+
path: constr(strict=True, min_length=1) = Field(
|
|
41
|
+
default=...,
|
|
42
|
+
description="+sort=40 +uiType=MethodPathSelector +label=Method + Path +usage=Select one Method and Path for this tool",
|
|
43
|
+
)
|
|
44
|
+
method: Method = Field(default=..., description="+sort=50 +uiType=Hidden")
|
|
45
|
+
headers: Optional[Dict[str, StrictStr]] = Field(
|
|
46
|
+
default=None,
|
|
47
|
+
description='+sort=60 +uiType=KV +uiProps={"allowSecrets":true,"secretConfig":{"enableNew":true,"hideOptions":true}}',
|
|
48
|
+
)
|
|
49
|
+
__properties = [
|
|
50
|
+
"type",
|
|
51
|
+
"name",
|
|
52
|
+
"description",
|
|
53
|
+
"openapi_spec",
|
|
54
|
+
"base_url",
|
|
55
|
+
"path",
|
|
56
|
+
"method",
|
|
57
|
+
"headers",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
@validator("type")
|
|
61
|
+
def type_validate_enum(cls, value):
|
|
62
|
+
"""Validates the enum"""
|
|
63
|
+
if value is None:
|
|
64
|
+
return value
|
|
65
|
+
|
|
66
|
+
if value not in ("openapi-tool"):
|
|
67
|
+
raise ValueError("must be one of enum values ('openapi-tool')")
|
|
68
|
+
return value
|
|
69
|
+
|
|
70
|
+
@validator("name")
|
|
71
|
+
def name_validate_regular_expression(cls, value):
|
|
72
|
+
"""Validates the regular expression"""
|
|
73
|
+
if not re.match(r"^[a-zA-Z][a-zA-Z0-9\-]{1,30}[a-zA-Z0-9]$", value):
|
|
74
|
+
raise ValueError(
|
|
75
|
+
r"must validate the regular expression /^[a-zA-Z][a-zA-Z0-9\-]{1,30}[a-zA-Z0-9]$/"
|
|
76
|
+
)
|
|
77
|
+
return value
|
|
78
|
+
|
|
79
|
+
@validator("base_url")
|
|
80
|
+
def base_url_validate_regular_expression(cls, value):
|
|
81
|
+
"""Validates the regular expression"""
|
|
82
|
+
if not re.match(
|
|
83
|
+
r"^(https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$",
|
|
84
|
+
value,
|
|
85
|
+
):
|
|
86
|
+
raise ValueError(
|
|
87
|
+
r"must validate the regular expression /^(https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/"
|
|
88
|
+
)
|
|
89
|
+
return value
|
|
90
|
+
|
|
91
|
+
class Config:
|
|
92
|
+
"""Pydantic configuration"""
|
|
93
|
+
|
|
94
|
+
allow_population_by_field_name = True
|
|
95
|
+
validate_assignment = True
|
|
96
|
+
|
|
97
|
+
def to_str(self) -> str:
|
|
98
|
+
"""Returns the string representation of the model using alias"""
|
|
99
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
100
|
+
|
|
101
|
+
def to_json(self) -> str:
|
|
102
|
+
"""Returns the JSON representation of the model using alias"""
|
|
103
|
+
return json.dumps(self.to_dict())
|
|
104
|
+
|
|
105
|
+
@classmethod
|
|
106
|
+
def from_json(cls, json_str: str) -> AgentOpenAPITool:
|
|
107
|
+
"""Create an instance of AgentOpenAPITool from a JSON string"""
|
|
108
|
+
return cls.from_dict(json.loads(json_str))
|
|
109
|
+
|
|
110
|
+
def to_dict(self):
|
|
111
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
112
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
113
|
+
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of openapi_spec
|
|
114
|
+
if self.openapi_spec:
|
|
115
|
+
_dict["openapi_spec"] = self.openapi_spec.to_dict()
|
|
116
|
+
return _dict
|
|
117
|
+
|
|
118
|
+
@classmethod
|
|
119
|
+
def from_dict(cls, obj: dict) -> AgentOpenAPITool:
|
|
120
|
+
"""Create an instance of AgentOpenAPITool from a dict"""
|
|
121
|
+
if obj is None:
|
|
122
|
+
return None
|
|
123
|
+
|
|
124
|
+
if not isinstance(obj, dict):
|
|
125
|
+
return AgentOpenAPITool.parse_obj(obj)
|
|
126
|
+
|
|
127
|
+
_obj = AgentOpenAPITool.parse_obj(
|
|
128
|
+
{
|
|
129
|
+
"type": obj.get("type")
|
|
130
|
+
if obj.get("type") is not None
|
|
131
|
+
else "openapi-tool",
|
|
132
|
+
"name": obj.get("name"),
|
|
133
|
+
"description": obj.get("description"),
|
|
134
|
+
"openapi_spec": OpenapiSpec.from_dict(obj.get("openapi_spec"))
|
|
135
|
+
if obj.get("openapi_spec") is not None
|
|
136
|
+
else None,
|
|
137
|
+
"base_url": obj.get("base_url"),
|
|
138
|
+
"path": obj.get("path"),
|
|
139
|
+
"method": obj.get("method"),
|
|
140
|
+
"headers": obj.get("headers"),
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
return _obj
|
|
@@ -0,0 +1,144 @@
|
|
|
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 Dict, Optional
|
|
20
|
+
|
|
21
|
+
from truefoundry.ml.autogen.client.models.method import Method
|
|
22
|
+
from truefoundry.ml.autogen.client.models.openapi_spec import OpenapiSpec
|
|
23
|
+
from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, constr, validator
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class AgentOpenAPIToolWithFQN(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
AgentOpenAPIToolWithFQN
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
type: StrictStr = Field(default=..., description="+value=openapi-tool")
|
|
32
|
+
name: constr(strict=True) = Field(
|
|
33
|
+
default=..., description="Names cannot repeat accross tools +uiType=Hidden"
|
|
34
|
+
)
|
|
35
|
+
description: constr(strict=True, max_length=128, min_length=1) = Field(
|
|
36
|
+
default=..., description="+sort=10 +uiType=TextArea"
|
|
37
|
+
)
|
|
38
|
+
openapi_spec: OpenapiSpec = Field(...)
|
|
39
|
+
base_url: constr(strict=True) = Field(default=..., description="+sort=30")
|
|
40
|
+
path: constr(strict=True, min_length=1) = Field(
|
|
41
|
+
default=...,
|
|
42
|
+
description="+sort=40 +uiType=MethodPathSelector +label=Method + Path +usage=Select one Method and Path for this tool",
|
|
43
|
+
)
|
|
44
|
+
method: Method = Field(default=..., description="+sort=50 +uiType=Hidden")
|
|
45
|
+
headers: Optional[Dict[str, StrictStr]] = Field(
|
|
46
|
+
default=None,
|
|
47
|
+
description='+sort=60 +uiType=KV +uiProps={"allowSecrets":true,"secretConfig":{"enableNew":true,"hideOptions":true}}',
|
|
48
|
+
)
|
|
49
|
+
id: StrictStr = Field(...)
|
|
50
|
+
fqn: StrictStr = Field(...)
|
|
51
|
+
__properties = [
|
|
52
|
+
"type",
|
|
53
|
+
"name",
|
|
54
|
+
"description",
|
|
55
|
+
"openapi_spec",
|
|
56
|
+
"base_url",
|
|
57
|
+
"path",
|
|
58
|
+
"method",
|
|
59
|
+
"headers",
|
|
60
|
+
"id",
|
|
61
|
+
"fqn",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
@validator("type")
|
|
65
|
+
def type_validate_enum(cls, value):
|
|
66
|
+
"""Validates the enum"""
|
|
67
|
+
if value not in ("openapi-tool"):
|
|
68
|
+
raise ValueError("must be one of enum values ('openapi-tool')")
|
|
69
|
+
return value
|
|
70
|
+
|
|
71
|
+
@validator("name")
|
|
72
|
+
def name_validate_regular_expression(cls, value):
|
|
73
|
+
"""Validates the regular expression"""
|
|
74
|
+
if not re.match(r"^[a-zA-Z][a-zA-Z0-9\-]{1,30}[a-zA-Z0-9]$", value):
|
|
75
|
+
raise ValueError(
|
|
76
|
+
r"must validate the regular expression /^[a-zA-Z][a-zA-Z0-9\-]{1,30}[a-zA-Z0-9]$/"
|
|
77
|
+
)
|
|
78
|
+
return value
|
|
79
|
+
|
|
80
|
+
@validator("base_url")
|
|
81
|
+
def base_url_validate_regular_expression(cls, value):
|
|
82
|
+
"""Validates the regular expression"""
|
|
83
|
+
if not re.match(
|
|
84
|
+
r"^(https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$",
|
|
85
|
+
value,
|
|
86
|
+
):
|
|
87
|
+
raise ValueError(
|
|
88
|
+
r"must validate the regular expression /^(https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/"
|
|
89
|
+
)
|
|
90
|
+
return value
|
|
91
|
+
|
|
92
|
+
class Config:
|
|
93
|
+
"""Pydantic configuration"""
|
|
94
|
+
|
|
95
|
+
allow_population_by_field_name = True
|
|
96
|
+
validate_assignment = True
|
|
97
|
+
|
|
98
|
+
def to_str(self) -> str:
|
|
99
|
+
"""Returns the string representation of the model using alias"""
|
|
100
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
101
|
+
|
|
102
|
+
def to_json(self) -> str:
|
|
103
|
+
"""Returns the JSON representation of the model using alias"""
|
|
104
|
+
return json.dumps(self.to_dict())
|
|
105
|
+
|
|
106
|
+
@classmethod
|
|
107
|
+
def from_json(cls, json_str: str) -> AgentOpenAPIToolWithFQN:
|
|
108
|
+
"""Create an instance of AgentOpenAPIToolWithFQN from a JSON string"""
|
|
109
|
+
return cls.from_dict(json.loads(json_str))
|
|
110
|
+
|
|
111
|
+
def to_dict(self):
|
|
112
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
113
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
114
|
+
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of openapi_spec
|
|
115
|
+
if self.openapi_spec:
|
|
116
|
+
_dict["openapi_spec"] = self.openapi_spec.to_dict()
|
|
117
|
+
return _dict
|
|
118
|
+
|
|
119
|
+
@classmethod
|
|
120
|
+
def from_dict(cls, obj: dict) -> AgentOpenAPIToolWithFQN:
|
|
121
|
+
"""Create an instance of AgentOpenAPIToolWithFQN from a dict"""
|
|
122
|
+
if obj is None:
|
|
123
|
+
return None
|
|
124
|
+
|
|
125
|
+
if not isinstance(obj, dict):
|
|
126
|
+
return AgentOpenAPIToolWithFQN.parse_obj(obj)
|
|
127
|
+
|
|
128
|
+
_obj = AgentOpenAPIToolWithFQN.parse_obj(
|
|
129
|
+
{
|
|
130
|
+
"type": obj.get("type"),
|
|
131
|
+
"name": obj.get("name"),
|
|
132
|
+
"description": obj.get("description"),
|
|
133
|
+
"openapi_spec": OpenapiSpec.from_dict(obj.get("openapi_spec"))
|
|
134
|
+
if obj.get("openapi_spec") is not None
|
|
135
|
+
else None,
|
|
136
|
+
"base_url": obj.get("base_url"),
|
|
137
|
+
"path": obj.get("path"),
|
|
138
|
+
"method": obj.get("method"),
|
|
139
|
+
"headers": obj.get("headers"),
|
|
140
|
+
"id": obj.get("id"),
|
|
141
|
+
"fqn": obj.get("fqn"),
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
return _obj
|
|
@@ -0,0 +1,127 @@
|
|
|
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 (
|
|
21
|
+
BaseModel,
|
|
22
|
+
Field,
|
|
23
|
+
StrictStr,
|
|
24
|
+
conlist,
|
|
25
|
+
constr,
|
|
26
|
+
validator,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class AgentWithFQN(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
AgentWithFQN
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
type: StrictStr = Field(default=..., description="+value=agent")
|
|
36
|
+
name: constr(strict=True) = Field(
|
|
37
|
+
default=..., description="Names cannot repeat accross agent +uiType=Hidden"
|
|
38
|
+
)
|
|
39
|
+
available_tools: conlist(constr(strict=True, min_length=1)) = Field(
|
|
40
|
+
default=..., description="+sort=30 +uiType=Hidden"
|
|
41
|
+
)
|
|
42
|
+
goal: constr(strict=True, max_length=128, min_length=1) = Field(
|
|
43
|
+
default=..., description="+sort=10 +uiType=TextArea"
|
|
44
|
+
)
|
|
45
|
+
instruction: constr(strict=True, max_length=2620, min_length=1) = Field(
|
|
46
|
+
default=...,
|
|
47
|
+
description='`instruction` is the system prompt for now. (2.5 * 1024) +sort=20 +uiType=AgentInstructions +uiProps={"helpText":"Use the syntax ${Tool FQN} to reference a tool, and ${AGENT FQN} to reference another agent"}',
|
|
48
|
+
)
|
|
49
|
+
model_id: constr(strict=True, min_length=1) = Field(
|
|
50
|
+
default=...,
|
|
51
|
+
description='+sort=40 +uiType=EnabledModelSelector +uiProps={"searchable":true,"modelType":"chat","providerType":"openai"}',
|
|
52
|
+
)
|
|
53
|
+
id: StrictStr = Field(...)
|
|
54
|
+
fqn: StrictStr = Field(...)
|
|
55
|
+
__properties = [
|
|
56
|
+
"type",
|
|
57
|
+
"name",
|
|
58
|
+
"available_tools",
|
|
59
|
+
"goal",
|
|
60
|
+
"instruction",
|
|
61
|
+
"model_id",
|
|
62
|
+
"id",
|
|
63
|
+
"fqn",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
@validator("type")
|
|
67
|
+
def type_validate_enum(cls, value):
|
|
68
|
+
"""Validates the enum"""
|
|
69
|
+
if value not in ("agent"):
|
|
70
|
+
raise ValueError("must be one of enum values ('agent')")
|
|
71
|
+
return value
|
|
72
|
+
|
|
73
|
+
@validator("name")
|
|
74
|
+
def name_validate_regular_expression(cls, value):
|
|
75
|
+
"""Validates the regular expression"""
|
|
76
|
+
if not re.match(r"^[a-zA-Z][a-zA-Z0-9\-]{1,30}[a-zA-Z0-9]$", value):
|
|
77
|
+
raise ValueError(
|
|
78
|
+
r"must validate the regular expression /^[a-zA-Z][a-zA-Z0-9\-]{1,30}[a-zA-Z0-9]$/"
|
|
79
|
+
)
|
|
80
|
+
return value
|
|
81
|
+
|
|
82
|
+
class Config:
|
|
83
|
+
"""Pydantic configuration"""
|
|
84
|
+
|
|
85
|
+
allow_population_by_field_name = True
|
|
86
|
+
validate_assignment = True
|
|
87
|
+
|
|
88
|
+
def to_str(self) -> str:
|
|
89
|
+
"""Returns the string representation of the model using alias"""
|
|
90
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
91
|
+
|
|
92
|
+
def to_json(self) -> str:
|
|
93
|
+
"""Returns the JSON representation of the model using alias"""
|
|
94
|
+
return json.dumps(self.to_dict())
|
|
95
|
+
|
|
96
|
+
@classmethod
|
|
97
|
+
def from_json(cls, json_str: str) -> AgentWithFQN:
|
|
98
|
+
"""Create an instance of AgentWithFQN from a JSON string"""
|
|
99
|
+
return cls.from_dict(json.loads(json_str))
|
|
100
|
+
|
|
101
|
+
def to_dict(self):
|
|
102
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
103
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
104
|
+
return _dict
|
|
105
|
+
|
|
106
|
+
@classmethod
|
|
107
|
+
def from_dict(cls, obj: dict) -> AgentWithFQN:
|
|
108
|
+
"""Create an instance of AgentWithFQN from a dict"""
|
|
109
|
+
if obj is None:
|
|
110
|
+
return None
|
|
111
|
+
|
|
112
|
+
if not isinstance(obj, dict):
|
|
113
|
+
return AgentWithFQN.parse_obj(obj)
|
|
114
|
+
|
|
115
|
+
_obj = AgentWithFQN.parse_obj(
|
|
116
|
+
{
|
|
117
|
+
"type": obj.get("type"),
|
|
118
|
+
"name": obj.get("name"),
|
|
119
|
+
"available_tools": obj.get("available_tools"),
|
|
120
|
+
"goal": obj.get("goal"),
|
|
121
|
+
"instruction": obj.get("instruction"),
|
|
122
|
+
"model_id": obj.get("model_id"),
|
|
123
|
+
"id": obj.get("id"),
|
|
124
|
+
"fqn": obj.get("fqn"),
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
return _obj
|
|
@@ -0,0 +1,115 @@
|
|
|
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.artifact_version_dto import ArtifactVersionDto
|
|
24
|
+
from truefoundry.pydantic_v1 import BaseModel, StrictInt, StrictStr, conlist
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ArtifactDto(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
ArtifactDto
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
id: Optional[StrictStr] = None
|
|
33
|
+
experiment_id: Optional[StrictStr] = None
|
|
34
|
+
type: Optional[ArtifactType] = None
|
|
35
|
+
name: Optional[StrictStr] = None
|
|
36
|
+
fqn: Optional[StrictStr] = None
|
|
37
|
+
description: Optional[StrictStr] = None
|
|
38
|
+
created_by: Optional[StrictStr] = None
|
|
39
|
+
created_at: Optional[datetime] = None
|
|
40
|
+
updated_at: Optional[datetime] = None
|
|
41
|
+
artifact_storage_root: Optional[StrictStr] = None
|
|
42
|
+
latest_version: Optional[ArtifactVersionDto] = None
|
|
43
|
+
run_steps: Optional[conlist(StrictInt)] = None
|
|
44
|
+
__properties = [
|
|
45
|
+
"id",
|
|
46
|
+
"experiment_id",
|
|
47
|
+
"type",
|
|
48
|
+
"name",
|
|
49
|
+
"fqn",
|
|
50
|
+
"description",
|
|
51
|
+
"created_by",
|
|
52
|
+
"created_at",
|
|
53
|
+
"updated_at",
|
|
54
|
+
"artifact_storage_root",
|
|
55
|
+
"latest_version",
|
|
56
|
+
"run_steps",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
class Config:
|
|
60
|
+
"""Pydantic configuration"""
|
|
61
|
+
|
|
62
|
+
allow_population_by_field_name = True
|
|
63
|
+
validate_assignment = True
|
|
64
|
+
|
|
65
|
+
def to_str(self) -> str:
|
|
66
|
+
"""Returns the string representation of the model using alias"""
|
|
67
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
68
|
+
|
|
69
|
+
def to_json(self) -> str:
|
|
70
|
+
"""Returns the JSON representation of the model using alias"""
|
|
71
|
+
return json.dumps(self.to_dict())
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_json(cls, json_str: str) -> ArtifactDto:
|
|
75
|
+
"""Create an instance of ArtifactDto from a JSON string"""
|
|
76
|
+
return cls.from_dict(json.loads(json_str))
|
|
77
|
+
|
|
78
|
+
def to_dict(self):
|
|
79
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
80
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
81
|
+
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of latest_version
|
|
82
|
+
if self.latest_version:
|
|
83
|
+
_dict["latest_version"] = self.latest_version.to_dict()
|
|
84
|
+
return _dict
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_dict(cls, obj: dict) -> ArtifactDto:
|
|
88
|
+
"""Create an instance of ArtifactDto from a dict"""
|
|
89
|
+
if obj is None:
|
|
90
|
+
return None
|
|
91
|
+
|
|
92
|
+
if not isinstance(obj, dict):
|
|
93
|
+
return ArtifactDto.parse_obj(obj)
|
|
94
|
+
|
|
95
|
+
_obj = ArtifactDto.parse_obj(
|
|
96
|
+
{
|
|
97
|
+
"id": obj.get("id"),
|
|
98
|
+
"experiment_id": obj.get("experiment_id"),
|
|
99
|
+
"type": obj.get("type"),
|
|
100
|
+
"name": obj.get("name"),
|
|
101
|
+
"fqn": obj.get("fqn"),
|
|
102
|
+
"description": obj.get("description"),
|
|
103
|
+
"created_by": obj.get("created_by"),
|
|
104
|
+
"created_at": obj.get("created_at"),
|
|
105
|
+
"updated_at": obj.get("updated_at"),
|
|
106
|
+
"artifact_storage_root": obj.get("artifact_storage_root"),
|
|
107
|
+
"latest_version": ArtifactVersionDto.from_dict(
|
|
108
|
+
obj.get("latest_version")
|
|
109
|
+
)
|
|
110
|
+
if obj.get("latest_version") is not None
|
|
111
|
+
else None,
|
|
112
|
+
"run_steps": obj.get("run_steps"),
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
return _obj
|