truefoundry 0.3.4__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of truefoundry might be problematic. Click here for more details.

Files changed (253) hide show
  1. truefoundry/__init__.py +2 -0
  2. truefoundry/autodeploy/agents/developer.py +1 -1
  3. truefoundry/autodeploy/agents/project_identifier.py +2 -2
  4. truefoundry/autodeploy/agents/tester.py +1 -1
  5. truefoundry/autodeploy/cli.py +1 -1
  6. truefoundry/autodeploy/tools/list_files.py +1 -1
  7. truefoundry/cli/__main__.py +3 -17
  8. truefoundry/common/__init__.py +0 -0
  9. truefoundry/{deploy/lib/auth → common}/auth_service_client.py +50 -40
  10. truefoundry/common/constants.py +12 -0
  11. truefoundry/{deploy/lib/auth → common}/credential_file_manager.py +7 -7
  12. truefoundry/{deploy/lib/auth → common}/credential_provider.py +10 -23
  13. truefoundry/common/entities.py +124 -0
  14. truefoundry/common/exceptions.py +12 -0
  15. truefoundry/common/request_utils.py +84 -0
  16. truefoundry/common/servicefoundry_client.py +91 -0
  17. truefoundry/common/utils.py +56 -0
  18. truefoundry/deploy/auto_gen/models.py +4 -6
  19. truefoundry/deploy/cli/cli.py +3 -1
  20. truefoundry/deploy/cli/commands/apply_command.py +1 -1
  21. truefoundry/deploy/cli/commands/build_command.py +1 -1
  22. truefoundry/deploy/cli/commands/deploy_command.py +1 -1
  23. truefoundry/deploy/cli/commands/login_command.py +2 -2
  24. truefoundry/deploy/cli/commands/patch_application_command.py +1 -1
  25. truefoundry/deploy/cli/commands/patch_command.py +1 -1
  26. truefoundry/deploy/cli/commands/terminate_comand.py +1 -1
  27. truefoundry/deploy/cli/util.py +1 -1
  28. truefoundry/deploy/function_service/remote/remote.py +1 -1
  29. truefoundry/deploy/lib/auth/servicefoundry_session.py +2 -2
  30. truefoundry/deploy/lib/clients/servicefoundry_client.py +120 -159
  31. truefoundry/deploy/lib/const.py +1 -35
  32. truefoundry/deploy/lib/exceptions.py +0 -16
  33. truefoundry/deploy/lib/model/entity.py +1 -112
  34. truefoundry/deploy/lib/session.py +14 -42
  35. truefoundry/deploy/lib/util.py +0 -37
  36. truefoundry/{python_deploy_codegen.py → deploy/python_deploy_codegen.py} +2 -2
  37. truefoundry/deploy/v2/lib/deploy.py +3 -3
  38. truefoundry/deploy/v2/lib/deployable_patched_models.py +1 -1
  39. truefoundry/langchain/truefoundry_chat.py +1 -1
  40. truefoundry/langchain/truefoundry_embeddings.py +1 -1
  41. truefoundry/langchain/truefoundry_llm.py +1 -1
  42. truefoundry/langchain/utils.py +0 -41
  43. truefoundry/ml/__init__.py +37 -6
  44. truefoundry/ml/artifact/__init__.py +0 -0
  45. truefoundry/ml/artifact/truefoundry_artifact_repo.py +1161 -0
  46. truefoundry/ml/autogen/__init__.py +0 -0
  47. truefoundry/ml/autogen/client/__init__.py +370 -0
  48. truefoundry/ml/autogen/client/api/__init__.py +16 -0
  49. truefoundry/ml/autogen/client/api/auth_api.py +184 -0
  50. truefoundry/ml/autogen/client/api/deprecated_api.py +605 -0
  51. truefoundry/ml/autogen/client/api/experiments_api.py +1944 -0
  52. truefoundry/ml/autogen/client/api/health_api.py +299 -0
  53. truefoundry/ml/autogen/client/api/metrics_api.py +371 -0
  54. truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py +7213 -0
  55. truefoundry/ml/autogen/client/api/python_deployment_config_api.py +201 -0
  56. truefoundry/ml/autogen/client/api/run_artifacts_api.py +231 -0
  57. truefoundry/ml/autogen/client/api/runs_api.py +2919 -0
  58. truefoundry/ml/autogen/client/api_client.py +822 -0
  59. truefoundry/ml/autogen/client/api_response.py +30 -0
  60. truefoundry/ml/autogen/client/configuration.py +489 -0
  61. truefoundry/ml/autogen/client/exceptions.py +161 -0
  62. truefoundry/ml/autogen/client/models/__init__.py +341 -0
  63. truefoundry/ml/autogen/client/models/add_custom_metrics_to_model_version_request_dto.py +69 -0
  64. truefoundry/ml/autogen/client/models/add_features_to_model_version_request_dto.py +83 -0
  65. truefoundry/ml/autogen/client/models/agent.py +125 -0
  66. truefoundry/ml/autogen/client/models/agent_app.py +118 -0
  67. truefoundry/ml/autogen/client/models/agent_open_api_tool.py +143 -0
  68. truefoundry/ml/autogen/client/models/agent_open_api_tool_with_fqn.py +144 -0
  69. truefoundry/ml/autogen/client/models/agent_with_fqn.py +127 -0
  70. truefoundry/ml/autogen/client/models/artifact_dto.py +115 -0
  71. truefoundry/ml/autogen/client/models/artifact_response_dto.py +75 -0
  72. truefoundry/ml/autogen/client/models/artifact_type.py +39 -0
  73. truefoundry/ml/autogen/client/models/artifact_version_dto.py +141 -0
  74. truefoundry/ml/autogen/client/models/artifact_version_response_dto.py +77 -0
  75. truefoundry/ml/autogen/client/models/artifact_version_status.py +35 -0
  76. truefoundry/ml/autogen/client/models/assistant_message.py +89 -0
  77. truefoundry/ml/autogen/client/models/authorize_user_for_model_request_dto.py +69 -0
  78. truefoundry/ml/autogen/client/models/authorize_user_for_model_version_request_dto.py +69 -0
  79. truefoundry/ml/autogen/client/models/blob_storage_reference.py +93 -0
  80. truefoundry/ml/autogen/client/models/body_get_search_runs_get.py +72 -0
  81. truefoundry/ml/autogen/client/models/chat_prompt.py +156 -0
  82. truefoundry/ml/autogen/client/models/chat_prompt_messages_inner.py +171 -0
  83. truefoundry/ml/autogen/client/models/columns_dto.py +73 -0
  84. truefoundry/ml/autogen/client/models/content.py +153 -0
  85. truefoundry/ml/autogen/client/models/content1.py +153 -0
  86. truefoundry/ml/autogen/client/models/content2.py +174 -0
  87. truefoundry/ml/autogen/client/models/content2_any_of_inner.py +150 -0
  88. truefoundry/ml/autogen/client/models/create_artifact_request_dto.py +74 -0
  89. truefoundry/ml/autogen/client/models/create_artifact_response_dto.py +65 -0
  90. truefoundry/ml/autogen/client/models/create_artifact_version_request_dto.py +74 -0
  91. truefoundry/ml/autogen/client/models/create_artifact_version_response_dto.py +65 -0
  92. truefoundry/ml/autogen/client/models/create_dataset_request_dto.py +76 -0
  93. truefoundry/ml/autogen/client/models/create_experiment_request_dto.py +94 -0
  94. truefoundry/ml/autogen/client/models/create_experiment_response_dto.py +67 -0
  95. truefoundry/ml/autogen/client/models/create_model_version_request_dto.py +95 -0
  96. truefoundry/ml/autogen/client/models/create_multi_part_upload_for_dataset_request_dto.py +73 -0
  97. truefoundry/ml/autogen/client/models/create_multi_part_upload_for_dataset_response_dto.py +79 -0
  98. truefoundry/ml/autogen/client/models/create_multi_part_upload_request_dto.py +73 -0
  99. truefoundry/ml/autogen/client/models/create_python_deployment_config_request_dto.py +72 -0
  100. truefoundry/ml/autogen/client/models/create_python_deployment_config_response_dto.py +67 -0
  101. truefoundry/ml/autogen/client/models/create_run_request_dto.py +97 -0
  102. truefoundry/ml/autogen/client/models/create_run_response_dto.py +75 -0
  103. truefoundry/ml/autogen/client/models/dataset_dto.py +112 -0
  104. truefoundry/ml/autogen/client/models/dataset_response_dto.py +75 -0
  105. truefoundry/ml/autogen/client/models/delete_artifact_versions_request_dto.py +65 -0
  106. truefoundry/ml/autogen/client/models/delete_dataset_request_dto.py +74 -0
  107. truefoundry/ml/autogen/client/models/delete_model_version_request_dto.py +65 -0
  108. truefoundry/ml/autogen/client/models/delete_run_request.py +65 -0
  109. truefoundry/ml/autogen/client/models/delete_tag_request_dto.py +68 -0
  110. truefoundry/ml/autogen/client/models/experiment_dto.py +127 -0
  111. truefoundry/ml/autogen/client/models/experiment_id_request_dto.py +67 -0
  112. truefoundry/ml/autogen/client/models/experiment_response_dto.py +75 -0
  113. truefoundry/ml/autogen/client/models/experiment_tag_dto.py +69 -0
  114. truefoundry/ml/autogen/client/models/feature_dto.py +68 -0
  115. truefoundry/ml/autogen/client/models/feature_value_type.py +35 -0
  116. truefoundry/ml/autogen/client/models/file_info_dto.py +76 -0
  117. truefoundry/ml/autogen/client/models/finalize_artifact_version_request_dto.py +101 -0
  118. truefoundry/ml/autogen/client/models/get_experiment_response_dto.py +88 -0
  119. truefoundry/ml/autogen/client/models/get_latest_run_log_response_dto.py +75 -0
  120. truefoundry/ml/autogen/client/models/get_metric_history_response.py +79 -0
  121. truefoundry/ml/autogen/client/models/get_signed_url_for_dataset_write_request_dto.py +68 -0
  122. truefoundry/ml/autogen/client/models/get_signed_urls_for_artifact_version_read_request_dto.py +68 -0
  123. truefoundry/ml/autogen/client/models/get_signed_urls_for_artifact_version_read_response_dto.py +81 -0
  124. truefoundry/ml/autogen/client/models/get_signed_urls_for_artifact_version_write_request_dto.py +69 -0
  125. truefoundry/ml/autogen/client/models/get_signed_urls_for_artifact_version_write_response_dto.py +83 -0
  126. truefoundry/ml/autogen/client/models/get_signed_urls_for_dataset_read_request_dto.py +68 -0
  127. truefoundry/ml/autogen/client/models/get_signed_urls_for_dataset_read_response_dto.py +81 -0
  128. truefoundry/ml/autogen/client/models/get_signed_urls_for_dataset_write_response_dto.py +81 -0
  129. truefoundry/ml/autogen/client/models/get_tenant_id_response_dto.py +73 -0
  130. truefoundry/ml/autogen/client/models/http_validation_error.py +82 -0
  131. truefoundry/ml/autogen/client/models/image_content_part.py +87 -0
  132. truefoundry/ml/autogen/client/models/image_url.py +75 -0
  133. truefoundry/ml/autogen/client/models/internal_metadata.py +180 -0
  134. truefoundry/ml/autogen/client/models/latest_run_log_dto.py +78 -0
  135. truefoundry/ml/autogen/client/models/list_artifact_versions_request_dto.py +107 -0
  136. truefoundry/ml/autogen/client/models/list_artifact_versions_response_dto.py +87 -0
  137. truefoundry/ml/autogen/client/models/list_artifacts_request_dto.py +96 -0
  138. truefoundry/ml/autogen/client/models/list_artifacts_response_dto.py +86 -0
  139. truefoundry/ml/autogen/client/models/list_colums_response_dto.py +75 -0
  140. truefoundry/ml/autogen/client/models/list_datasets_request_dto.py +78 -0
  141. truefoundry/ml/autogen/client/models/list_datasets_response_dto.py +86 -0
  142. truefoundry/ml/autogen/client/models/list_experiments_response_dto.py +86 -0
  143. truefoundry/ml/autogen/client/models/list_files_for_artifact_version_request_dto.py +76 -0
  144. truefoundry/ml/autogen/client/models/list_files_for_artifact_versions_response_dto.py +82 -0
  145. truefoundry/ml/autogen/client/models/list_files_for_dataset_request_dto.py +76 -0
  146. truefoundry/ml/autogen/client/models/list_files_for_dataset_response_dto.py +82 -0
  147. truefoundry/ml/autogen/client/models/list_latest_run_logs_response_dto.py +82 -0
  148. truefoundry/ml/autogen/client/models/list_metric_history_request_dto.py +69 -0
  149. truefoundry/ml/autogen/client/models/list_metric_history_response_dto.py +84 -0
  150. truefoundry/ml/autogen/client/models/list_model_version_response_dto.py +87 -0
  151. truefoundry/ml/autogen/client/models/list_model_versions_request_dto.py +93 -0
  152. truefoundry/ml/autogen/client/models/list_models_request_dto.py +89 -0
  153. truefoundry/ml/autogen/client/models/list_models_response_dto.py +84 -0
  154. truefoundry/ml/autogen/client/models/list_run_artifacts_response_dto.py +84 -0
  155. truefoundry/ml/autogen/client/models/list_run_logs_response_dto.py +82 -0
  156. truefoundry/ml/autogen/client/models/list_seed_experiments_response_dto.py +81 -0
  157. truefoundry/ml/autogen/client/models/log_batch_request_dto.py +106 -0
  158. truefoundry/ml/autogen/client/models/log_metric_request_dto.py +80 -0
  159. truefoundry/ml/autogen/client/models/log_param_request_dto.py +76 -0
  160. truefoundry/ml/autogen/client/models/method.py +37 -0
  161. truefoundry/ml/autogen/client/models/metric_collection_dto.py +82 -0
  162. truefoundry/ml/autogen/client/models/metric_dto.py +76 -0
  163. truefoundry/ml/autogen/client/models/mime_type.py +37 -0
  164. truefoundry/ml/autogen/client/models/model_configuration.py +103 -0
  165. truefoundry/ml/autogen/client/models/model_dto.py +122 -0
  166. truefoundry/ml/autogen/client/models/model_response_dto.py +75 -0
  167. truefoundry/ml/autogen/client/models/model_schema_dto.py +85 -0
  168. truefoundry/ml/autogen/client/models/model_version_dto.py +170 -0
  169. truefoundry/ml/autogen/client/models/model_version_response_dto.py +75 -0
  170. truefoundry/ml/autogen/client/models/multi_part_upload_dto.py +107 -0
  171. truefoundry/ml/autogen/client/models/multi_part_upload_response_dto.py +79 -0
  172. truefoundry/ml/autogen/client/models/multi_part_upload_storage_provider.py +34 -0
  173. truefoundry/ml/autogen/client/models/notify_artifact_version_failure_dto.py +65 -0
  174. truefoundry/ml/autogen/client/models/openapi_spec.py +152 -0
  175. truefoundry/ml/autogen/client/models/param_dto.py +66 -0
  176. truefoundry/ml/autogen/client/models/parameters.py +84 -0
  177. truefoundry/ml/autogen/client/models/prediction_type.py +34 -0
  178. truefoundry/ml/autogen/client/models/resolve_agent_app_response_dto.py +75 -0
  179. truefoundry/ml/autogen/client/models/restore_run_request_dto.py +65 -0
  180. truefoundry/ml/autogen/client/models/run_data_dto.py +104 -0
  181. truefoundry/ml/autogen/client/models/run_dto.py +84 -0
  182. truefoundry/ml/autogen/client/models/run_info_dto.py +105 -0
  183. truefoundry/ml/autogen/client/models/run_log_dto.py +90 -0
  184. truefoundry/ml/autogen/client/models/run_log_input_dto.py +80 -0
  185. truefoundry/ml/autogen/client/models/run_response_dto.py +75 -0
  186. truefoundry/ml/autogen/client/models/run_tag_dto.py +66 -0
  187. truefoundry/ml/autogen/client/models/search_runs_request_dto.py +94 -0
  188. truefoundry/ml/autogen/client/models/search_runs_response_dto.py +84 -0
  189. truefoundry/ml/autogen/client/models/set_experiment_tag_request_dto.py +73 -0
  190. truefoundry/ml/autogen/client/models/set_tag_request_dto.py +76 -0
  191. truefoundry/ml/autogen/client/models/signed_url_dto.py +69 -0
  192. truefoundry/ml/autogen/client/models/stop.py +152 -0
  193. truefoundry/ml/autogen/client/models/store_run_logs_request_dto.py +83 -0
  194. truefoundry/ml/autogen/client/models/system_message.py +89 -0
  195. truefoundry/ml/autogen/client/models/text.py +153 -0
  196. truefoundry/ml/autogen/client/models/text_content_part.py +84 -0
  197. truefoundry/ml/autogen/client/models/update_artifact_version_request_dto.py +74 -0
  198. truefoundry/ml/autogen/client/models/update_dataset_request_dto.py +74 -0
  199. truefoundry/ml/autogen/client/models/update_experiment_request_dto.py +74 -0
  200. truefoundry/ml/autogen/client/models/update_model_version_request_dto.py +93 -0
  201. truefoundry/ml/autogen/client/models/update_run_request_dto.py +78 -0
  202. truefoundry/ml/autogen/client/models/update_run_response_dto.py +75 -0
  203. truefoundry/ml/autogen/client/models/url.py +153 -0
  204. truefoundry/ml/autogen/client/models/user_message.py +89 -0
  205. truefoundry/ml/autogen/client/models/validation_error.py +87 -0
  206. truefoundry/ml/autogen/client/models/validation_error_loc_inner.py +154 -0
  207. truefoundry/ml/autogen/client/rest.py +426 -0
  208. truefoundry/ml/autogen/client_README.md +320 -0
  209. truefoundry/ml/cli/__init__.py +0 -0
  210. truefoundry/ml/cli/cli.py +18 -0
  211. truefoundry/ml/cli/commands/__init__.py +3 -0
  212. truefoundry/ml/cli/commands/download.py +87 -0
  213. truefoundry/ml/clients/__init__.py +0 -0
  214. truefoundry/ml/clients/entities.py +8 -0
  215. truefoundry/ml/clients/servicefoundry_client.py +45 -0
  216. truefoundry/ml/clients/utils.py +122 -0
  217. truefoundry/ml/constants.py +84 -0
  218. truefoundry/ml/entities.py +62 -0
  219. truefoundry/ml/enums.py +70 -0
  220. truefoundry/ml/env_vars.py +9 -0
  221. truefoundry/ml/exceptions.py +8 -0
  222. truefoundry/ml/git_info.py +60 -0
  223. truefoundry/ml/internal_namespace.py +52 -0
  224. truefoundry/ml/log_types/__init__.py +4 -0
  225. truefoundry/ml/log_types/artifacts/artifact.py +431 -0
  226. truefoundry/ml/log_types/artifacts/constants.py +33 -0
  227. truefoundry/ml/log_types/artifacts/dataset.py +384 -0
  228. truefoundry/ml/log_types/artifacts/general_artifact.py +110 -0
  229. truefoundry/ml/log_types/artifacts/model.py +611 -0
  230. truefoundry/ml/log_types/artifacts/model_extras.py +48 -0
  231. truefoundry/ml/log_types/artifacts/utils.py +161 -0
  232. truefoundry/ml/log_types/image/__init__.py +3 -0
  233. truefoundry/ml/log_types/image/constants.py +8 -0
  234. truefoundry/ml/log_types/image/image.py +357 -0
  235. truefoundry/ml/log_types/image/image_normalizer.py +102 -0
  236. truefoundry/ml/log_types/image/types.py +68 -0
  237. truefoundry/ml/log_types/plot.py +281 -0
  238. truefoundry/ml/log_types/pydantic_base.py +10 -0
  239. truefoundry/ml/log_types/utils.py +12 -0
  240. truefoundry/ml/logger.py +17 -0
  241. truefoundry/ml/mlfoundry_api.py +1575 -0
  242. truefoundry/ml/mlfoundry_run.py +1203 -0
  243. truefoundry/ml/run_utils.py +93 -0
  244. truefoundry/ml/session.py +168 -0
  245. truefoundry/ml/validation_utils.py +346 -0
  246. truefoundry/pydantic_v1.py +6 -2
  247. truefoundry/workflow/__init__.py +16 -1
  248. {truefoundry-0.3.4.dist-info → truefoundry-0.4.0.dist-info}/METADATA +21 -14
  249. truefoundry-0.4.0.dist-info/RECORD +344 -0
  250. truefoundry/deploy/lib/clients/utils.py +0 -41
  251. truefoundry-0.3.4.dist-info/RECORD +0 -136
  252. {truefoundry-0.3.4.dist-info → truefoundry-0.4.0.dist-info}/WHEEL +0 -0
  253. {truefoundry-0.3.4.dist-info → truefoundry-0.4.0.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,72 @@
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, StrictStr, conlist
22
+
23
+
24
+ class BodyGetSearchRunsGet(BaseModel):
25
+ """
26
+ BodyGetSearchRunsGet
27
+ """
28
+
29
+ experiment_ids: Optional[conlist(StrictStr)] = None
30
+ order_by: Optional[conlist(StrictStr)] = None
31
+ __properties = ["experiment_ids", "order_by"]
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) -> BodyGetSearchRunsGet:
49
+ """Create an instance of BodyGetSearchRunsGet 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) -> BodyGetSearchRunsGet:
59
+ """Create an instance of BodyGetSearchRunsGet from a dict"""
60
+ if obj is None:
61
+ return None
62
+
63
+ if not isinstance(obj, dict):
64
+ return BodyGetSearchRunsGet.parse_obj(obj)
65
+
66
+ _obj = BodyGetSearchRunsGet.parse_obj(
67
+ {
68
+ "experiment_ids": obj.get("experiment_ids"),
69
+ "order_by": obj.get("order_by"),
70
+ }
71
+ )
72
+ return _obj
@@ -0,0 +1,156 @@
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.chat_prompt_messages_inner import (
22
+ ChatPromptMessagesInner,
23
+ )
24
+ from truefoundry.ml.autogen.client.models.model_configuration import ModelConfiguration
25
+ from truefoundry.pydantic_v1 import (
26
+ BaseModel,
27
+ Field,
28
+ StrictStr,
29
+ conlist,
30
+ constr,
31
+ validator,
32
+ )
33
+
34
+
35
+ class ChatPrompt(BaseModel):
36
+ """
37
+ Chat Prompt artifact. # noqa: E501
38
+ """
39
+
40
+ name: constr(strict=True) = Field(
41
+ default=...,
42
+ description="+label=Prompt Name +icon=fa-desktop:#326ce5 +message=Alphanumeric word, may contain '-' with a maximum length of 256 characters +sort=1000 +usage=Name of the Prompt. This uniquely identifies it in the workspace. +docs=The unique name for the prompt, consisting of alphanumeric characters and dashes, max length 100.",
43
+ )
44
+ description: Optional[constr(strict=True, max_length=512, min_length=1)] = Field(
45
+ default=None,
46
+ description="+label=Description +icon=fa-desktop:#326ce5 +message=Description in a maximum of 512 characters +sort=2000 +usage=Description of the prompt +docs=An optional description for the prompt, with a maximum length of 512 characters. +optional",
47
+ )
48
+ model_configuration: ModelConfiguration = Field(...)
49
+ metadata: Dict[str, StrictStr] = Field(
50
+ default=...,
51
+ description="+label=Metadata +icon=fa-info-circle:#326ce5 +message=Additional metadata for the prompt +sort=7000 +usage=Define additional metadata for the prompt +docs=Key-value pairs to store additional metadata related to the prompt.",
52
+ )
53
+ type: Optional[StrictStr] = "chat_prompt"
54
+ messages: conlist(ChatPromptMessagesInner) = Field(
55
+ default=...,
56
+ description="+sort=4000 +usage=Chat completion messages +label=Messages in the chat conversation +message=Chat completion messages +usage=List of messages in the chat conversation, must be non-empty +docs=Messages that define the chat conversation, including system, assistant, and user messages.",
57
+ )
58
+ variables: Optional[Dict[str, StrictStr]] = Field(
59
+ default=None,
60
+ description="+label=Variables +usage=Variables for the chat completion messages to be used in the prompt messages +sort=5000",
61
+ )
62
+ __properties = [
63
+ "name",
64
+ "description",
65
+ "model_configuration",
66
+ "metadata",
67
+ "type",
68
+ "messages",
69
+ "variables",
70
+ ]
71
+
72
+ @validator("name")
73
+ def name_validate_regular_expression(cls, value):
74
+ """Validates the regular expression"""
75
+ if not re.match(r"^[a-zA-Z][a-zA-Z0-9-_]{0,254}[a-zA-Z0-9]$", value):
76
+ raise ValueError(
77
+ r"must validate the regular expression /^[a-zA-Z][a-zA-Z0-9-_]{0,254}[a-zA-Z0-9]$/"
78
+ )
79
+ return value
80
+
81
+ @validator("type")
82
+ def type_validate_enum(cls, value):
83
+ """Validates the enum"""
84
+ if value is None:
85
+ return value
86
+
87
+ if value not in ("chat_prompt"):
88
+ raise ValueError("must be one of enum values ('chat_prompt')")
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) -> ChatPrompt:
107
+ """Create an instance of ChatPrompt 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 model_configuration
114
+ if self.model_configuration:
115
+ _dict["model_configuration"] = self.model_configuration.to_dict()
116
+ # override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of each item in messages (list)
117
+ _items = []
118
+ if self.messages:
119
+ for _item in self.messages:
120
+ if _item:
121
+ _items.append(_item.to_dict())
122
+ _dict["messages"] = _items
123
+ return _dict
124
+
125
+ @classmethod
126
+ def from_dict(cls, obj: dict) -> ChatPrompt:
127
+ """Create an instance of ChatPrompt from a dict"""
128
+ if obj is None:
129
+ return None
130
+
131
+ if not isinstance(obj, dict):
132
+ return ChatPrompt.parse_obj(obj)
133
+
134
+ _obj = ChatPrompt.parse_obj(
135
+ {
136
+ "name": obj.get("name"),
137
+ "description": obj.get("description"),
138
+ "model_configuration": ModelConfiguration.from_dict(
139
+ obj.get("model_configuration")
140
+ )
141
+ if obj.get("model_configuration") is not None
142
+ else None,
143
+ "metadata": obj.get("metadata"),
144
+ "type": obj.get("type")
145
+ if obj.get("type") is not None
146
+ else "chat_prompt",
147
+ "messages": [
148
+ ChatPromptMessagesInner.from_dict(_item)
149
+ for _item in obj.get("messages")
150
+ ]
151
+ if obj.get("messages") is not None
152
+ else None,
153
+ "variables": obj.get("variables"),
154
+ }
155
+ )
156
+ return _obj
@@ -0,0 +1,171 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re # noqa: F401
19
+ from typing import TYPE_CHECKING, Any, List, Optional, Union
20
+
21
+ from truefoundry.ml.autogen.client.models.assistant_message import AssistantMessage
22
+ from truefoundry.ml.autogen.client.models.system_message import SystemMessage
23
+ from truefoundry.ml.autogen.client.models.user_message import UserMessage
24
+ from truefoundry.pydantic_v1 import (
25
+ BaseModel,
26
+ Field,
27
+ ValidationError,
28
+ validator,
29
+ )
30
+
31
+ CHATPROMPTMESSAGESINNER_ANY_OF_SCHEMAS = [
32
+ "AssistantMessage",
33
+ "SystemMessage",
34
+ "UserMessage",
35
+ ]
36
+
37
+
38
+ class ChatPromptMessagesInner(BaseModel):
39
+ """
40
+ ChatPromptMessagesInner
41
+ """
42
+
43
+ # data type: SystemMessage
44
+ anyof_schema_1_validator: Optional[SystemMessage] = None
45
+ # data type: AssistantMessage
46
+ anyof_schema_2_validator: Optional[AssistantMessage] = None
47
+ # data type: UserMessage
48
+ anyof_schema_3_validator: Optional[UserMessage] = None
49
+ if TYPE_CHECKING:
50
+ actual_instance: Union[AssistantMessage, SystemMessage, UserMessage]
51
+ else:
52
+ actual_instance: Any
53
+ any_of_schemas: List[str] = Field(
54
+ CHATPROMPTMESSAGESINNER_ANY_OF_SCHEMAS, const=True
55
+ )
56
+
57
+ class Config:
58
+ validate_assignment = True
59
+
60
+ def __init__(self, *args, **kwargs) -> None:
61
+ if args:
62
+ if len(args) > 1:
63
+ raise ValueError(
64
+ "If a position argument is used, only 1 is allowed to set `actual_instance`"
65
+ )
66
+ if kwargs:
67
+ raise ValueError(
68
+ "If a position argument is used, keyword arguments cannot be used."
69
+ )
70
+ super().__init__(actual_instance=args[0])
71
+ else:
72
+ super().__init__(**kwargs)
73
+
74
+ @validator("actual_instance")
75
+ def actual_instance_must_validate_anyof(cls, v):
76
+ instance = ChatPromptMessagesInner.construct()
77
+ error_messages = []
78
+ # validate data type: SystemMessage
79
+ if not isinstance(v, SystemMessage):
80
+ error_messages.append(
81
+ f"Error! Input type `{type(v)}` is not `SystemMessage`"
82
+ )
83
+ else:
84
+ return v
85
+
86
+ # validate data type: AssistantMessage
87
+ if not isinstance(v, AssistantMessage):
88
+ error_messages.append(
89
+ f"Error! Input type `{type(v)}` is not `AssistantMessage`"
90
+ )
91
+ else:
92
+ return v
93
+
94
+ # validate data type: UserMessage
95
+ if not isinstance(v, UserMessage):
96
+ error_messages.append(f"Error! Input type `{type(v)}` is not `UserMessage`")
97
+ else:
98
+ return v
99
+
100
+ if error_messages:
101
+ # no match
102
+ raise ValueError(
103
+ "No match found when setting the actual_instance in ChatPromptMessagesInner with anyOf schemas: AssistantMessage, SystemMessage, UserMessage. Details: "
104
+ + ", ".join(error_messages)
105
+ )
106
+ else:
107
+ return v
108
+
109
+ @classmethod
110
+ def from_dict(cls, obj: dict) -> ChatPromptMessagesInner:
111
+ return cls.from_json(json.dumps(obj))
112
+
113
+ @classmethod
114
+ def from_json(cls, json_str: str) -> ChatPromptMessagesInner:
115
+ """Returns the object represented by the json string"""
116
+ instance = ChatPromptMessagesInner.construct()
117
+ error_messages = []
118
+ # anyof_schema_1_validator: Optional[SystemMessage] = None
119
+ try:
120
+ instance.actual_instance = SystemMessage.from_json(json_str)
121
+ return instance
122
+ except (ValidationError, ValueError) as e:
123
+ error_messages.append(str(e))
124
+ # anyof_schema_2_validator: Optional[AssistantMessage] = None
125
+ try:
126
+ instance.actual_instance = AssistantMessage.from_json(json_str)
127
+ return instance
128
+ except (ValidationError, ValueError) as e:
129
+ error_messages.append(str(e))
130
+ # anyof_schema_3_validator: Optional[UserMessage] = None
131
+ try:
132
+ instance.actual_instance = UserMessage.from_json(json_str)
133
+ return instance
134
+ except (ValidationError, ValueError) as e:
135
+ error_messages.append(str(e))
136
+
137
+ if error_messages:
138
+ # no match
139
+ raise ValueError(
140
+ "No match found when deserializing the JSON string into ChatPromptMessagesInner with anyOf schemas: AssistantMessage, SystemMessage, UserMessage. Details: "
141
+ + ", ".join(error_messages)
142
+ )
143
+ else:
144
+ return instance
145
+
146
+ def to_json(self) -> str:
147
+ """Returns the JSON representation of the actual instance"""
148
+ if self.actual_instance is None:
149
+ return "null"
150
+
151
+ to_json = getattr(self.actual_instance, "to_json", None)
152
+ if callable(to_json):
153
+ return self.actual_instance.to_json()
154
+ else:
155
+ return json.dumps(self.actual_instance)
156
+
157
+ def to_dict(self) -> dict:
158
+ """Returns the dict representation of the actual instance"""
159
+ if self.actual_instance is None:
160
+ return "null"
161
+
162
+ to_json = getattr(self.actual_instance, "to_json", None)
163
+ if callable(to_json):
164
+ return self.actual_instance.to_dict()
165
+ else:
166
+ # primitive type
167
+ return self.actual_instance
168
+
169
+ def to_str(self) -> str:
170
+ """Returns the string representation of the actual instance"""
171
+ return pprint.pformat(self.dict())
@@ -0,0 +1,73 @@
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, conlist
21
+
22
+
23
+ class ColumnsDto(BaseModel):
24
+ """
25
+ ColumnsDto
26
+ """
27
+
28
+ metric_names: conlist(StrictStr) = Field(...)
29
+ param_names: conlist(StrictStr) = Field(...)
30
+ tag_names: conlist(StrictStr) = Field(...)
31
+ __properties = ["metric_names", "param_names", "tag_names"]
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) -> ColumnsDto:
49
+ """Create an instance of ColumnsDto 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) -> ColumnsDto:
59
+ """Create an instance of ColumnsDto from a dict"""
60
+ if obj is None:
61
+ return None
62
+
63
+ if not isinstance(obj, dict):
64
+ return ColumnsDto.parse_obj(obj)
65
+
66
+ _obj = ColumnsDto.parse_obj(
67
+ {
68
+ "metric_names": obj.get("metric_names"),
69
+ "param_names": obj.get("param_names"),
70
+ "tag_names": obj.get("tag_names"),
71
+ }
72
+ )
73
+ return _obj
@@ -0,0 +1,153 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re # noqa: F401
19
+ from typing import TYPE_CHECKING, Any, List, Optional, Union
20
+
21
+ from truefoundry.ml.autogen.client.models.blob_storage_reference import (
22
+ BlobStorageReference,
23
+ )
24
+ from truefoundry.pydantic_v1 import (
25
+ BaseModel,
26
+ Field,
27
+ ValidationError,
28
+ constr,
29
+ validator,
30
+ )
31
+
32
+ CONTENT_ANY_OF_SCHEMAS = ["BlobStorageReference", "str"]
33
+
34
+
35
+ class Content(BaseModel):
36
+ """
37
+ +label=Content +usage=Text content for the assistant message
38
+ """
39
+
40
+ # data type: str
41
+ anyof_schema_1_validator: Optional[constr(strict=True)] = None
42
+ # data type: BlobStorageReference
43
+ anyof_schema_2_validator: Optional[BlobStorageReference] = None
44
+ if TYPE_CHECKING:
45
+ actual_instance: Union[BlobStorageReference, str]
46
+ else:
47
+ actual_instance: Any
48
+ any_of_schemas: List[str] = Field(CONTENT_ANY_OF_SCHEMAS, const=True)
49
+
50
+ class Config:
51
+ validate_assignment = True
52
+
53
+ def __init__(self, *args, **kwargs) -> None:
54
+ if args:
55
+ if len(args) > 1:
56
+ raise ValueError(
57
+ "If a position argument is used, only 1 is allowed to set `actual_instance`"
58
+ )
59
+ if kwargs:
60
+ raise ValueError(
61
+ "If a position argument is used, keyword arguments cannot be used."
62
+ )
63
+ super().__init__(actual_instance=args[0])
64
+ else:
65
+ super().__init__(**kwargs)
66
+
67
+ @validator("actual_instance")
68
+ def actual_instance_must_validate_anyof(cls, v):
69
+ instance = Content.construct()
70
+ error_messages = []
71
+ # validate data type: str
72
+ try:
73
+ instance.anyof_schema_1_validator = v
74
+ return v
75
+ except (ValidationError, ValueError) as e:
76
+ error_messages.append(str(e))
77
+ # validate data type: BlobStorageReference
78
+ if not isinstance(v, BlobStorageReference):
79
+ error_messages.append(
80
+ f"Error! Input type `{type(v)}` is not `BlobStorageReference`"
81
+ )
82
+ else:
83
+ return v
84
+
85
+ if error_messages:
86
+ # no match
87
+ raise ValueError(
88
+ "No match found when setting the actual_instance in Content with anyOf schemas: BlobStorageReference, str. Details: "
89
+ + ", ".join(error_messages)
90
+ )
91
+ else:
92
+ return v
93
+
94
+ @classmethod
95
+ def from_dict(cls, obj: dict) -> Content:
96
+ return cls.from_json(json.dumps(obj))
97
+
98
+ @classmethod
99
+ def from_json(cls, json_str: str) -> Content:
100
+ """Returns the object represented by the json string"""
101
+ instance = Content.construct()
102
+ error_messages = []
103
+ # deserialize data into str
104
+ try:
105
+ # validation
106
+ instance.anyof_schema_1_validator = json.loads(json_str)
107
+ # assign value to actual_instance
108
+ instance.actual_instance = instance.anyof_schema_1_validator
109
+ return instance
110
+ except (ValidationError, ValueError) as e:
111
+ error_messages.append(str(e))
112
+ # anyof_schema_2_validator: Optional[BlobStorageReference] = None
113
+ try:
114
+ instance.actual_instance = BlobStorageReference.from_json(json_str)
115
+ return instance
116
+ except (ValidationError, ValueError) as e:
117
+ error_messages.append(str(e))
118
+
119
+ if error_messages:
120
+ # no match
121
+ raise ValueError(
122
+ "No match found when deserializing the JSON string into Content with anyOf schemas: BlobStorageReference, str. Details: "
123
+ + ", ".join(error_messages)
124
+ )
125
+ else:
126
+ return instance
127
+
128
+ def to_json(self) -> str:
129
+ """Returns the JSON representation of the actual instance"""
130
+ if self.actual_instance is None:
131
+ return "null"
132
+
133
+ to_json = getattr(self.actual_instance, "to_json", None)
134
+ if callable(to_json):
135
+ return self.actual_instance.to_json()
136
+ else:
137
+ return json.dumps(self.actual_instance)
138
+
139
+ def to_dict(self) -> dict:
140
+ """Returns the dict representation of the actual instance"""
141
+ if self.actual_instance is None:
142
+ return "null"
143
+
144
+ to_json = getattr(self.actual_instance, "to_json", None)
145
+ if callable(to_json):
146
+ return self.actual_instance.to_dict()
147
+ else:
148
+ # primitive type
149
+ return self.actual_instance
150
+
151
+ def to_str(self) -> str:
152
+ """Returns the string representation of the actual instance"""
153
+ return pprint.pformat(self.dict())