mistralai 0.4.2__py3-none-any.whl → 0.5.5a50__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.
- mistralai/__init__.py +5 -0
- mistralai/_hooks/__init__.py +5 -0
- mistralai/_hooks/custom_user_agent.py +16 -0
- mistralai/_hooks/deprecation_warning.py +26 -0
- mistralai/_hooks/registration.py +17 -0
- mistralai/_hooks/sdkhooks.py +57 -0
- mistralai/_hooks/types.py +76 -0
- mistralai/async_client.py +5 -413
- mistralai/basesdk.py +216 -0
- mistralai/chat.py +475 -0
- mistralai/client.py +5 -414
- mistralai/embeddings.py +182 -0
- mistralai/files.py +600 -84
- mistralai/fim.py +439 -0
- mistralai/fine_tuning.py +855 -0
- mistralai/httpclient.py +78 -0
- mistralai/models/__init__.py +80 -0
- mistralai/models/archiveftmodelout.py +19 -0
- mistralai/models/assistantmessage.py +58 -0
- mistralai/models/chatcompletionchoice.py +33 -0
- mistralai/models/chatcompletionrequest.py +114 -0
- mistralai/models/chatcompletionresponse.py +27 -0
- mistralai/models/chatcompletionstreamrequest.py +112 -0
- mistralai/models/checkpointout.py +25 -0
- mistralai/models/completionchunk.py +27 -0
- mistralai/models/completionevent.py +15 -0
- mistralai/models/completionresponsestreamchoice.py +53 -0
- mistralai/models/contentchunk.py +17 -0
- mistralai/models/delete_model_v1_models_model_id_deleteop.py +16 -0
- mistralai/models/deletefileout.py +24 -0
- mistralai/models/deletemodelout.py +25 -0
- mistralai/models/deltamessage.py +52 -0
- mistralai/models/detailedjobout.py +96 -0
- mistralai/models/embeddingrequest.py +66 -0
- mistralai/models/embeddingresponse.py +24 -0
- mistralai/models/embeddingresponsedata.py +19 -0
- mistralai/models/eventout.py +55 -0
- mistralai/models/files_api_routes_delete_fileop.py +16 -0
- mistralai/models/files_api_routes_retrieve_fileop.py +16 -0
- mistralai/models/files_api_routes_upload_fileop.py +51 -0
- mistralai/models/fileschema.py +76 -0
- mistralai/models/fimcompletionrequest.py +99 -0
- mistralai/models/fimcompletionresponse.py +27 -0
- mistralai/models/fimcompletionstreamrequest.py +97 -0
- mistralai/models/finetuneablemodel.py +8 -0
- mistralai/models/ftmodelcapabilitiesout.py +21 -0
- mistralai/models/ftmodelout.py +70 -0
- mistralai/models/function.py +19 -0
- mistralai/models/functioncall.py +16 -0
- mistralai/models/githubrepositoryin.py +57 -0
- mistralai/models/githubrepositoryout.py +57 -0
- mistralai/models/httpvalidationerror.py +23 -0
- mistralai/models/jobin.py +78 -0
- mistralai/models/jobmetadataout.py +59 -0
- mistralai/models/jobout.py +112 -0
- mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +16 -0
- mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +18 -0
- mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +73 -0
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +18 -0
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +86 -0
- mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +16 -0
- mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +16 -0
- mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +19 -0
- mistralai/models/jobsout.py +20 -0
- mistralai/models/legacyjobmetadataout.py +85 -0
- mistralai/models/listfilesout.py +17 -0
- mistralai/models/metricout.py +55 -0
- mistralai/models/modelcapabilities.py +21 -0
- mistralai/models/modelcard.py +71 -0
- mistralai/models/modellist.py +18 -0
- mistralai/models/responseformat.py +18 -0
- mistralai/models/retrieve_model_v1_models_model_id_getop.py +16 -0
- mistralai/models/retrievefileout.py +76 -0
- mistralai/models/sampletype.py +7 -0
- mistralai/models/sdkerror.py +22 -0
- mistralai/models/security.py +16 -0
- mistralai/models/source.py +7 -0
- mistralai/models/systemmessage.py +26 -0
- mistralai/models/textchunk.py +17 -0
- mistralai/models/tool.py +18 -0
- mistralai/models/toolcall.py +20 -0
- mistralai/models/toolmessage.py +55 -0
- mistralai/models/trainingfile.py +17 -0
- mistralai/models/trainingparameters.py +53 -0
- mistralai/models/trainingparametersin.py +61 -0
- mistralai/models/unarchiveftmodelout.py +19 -0
- mistralai/models/updateftmodelin.py +49 -0
- mistralai/models/uploadfileout.py +76 -0
- mistralai/models/usageinfo.py +18 -0
- mistralai/models/usermessage.py +26 -0
- mistralai/models/validationerror.py +24 -0
- mistralai/models/wandbintegration.py +61 -0
- mistralai/models/wandbintegrationout.py +57 -0
- mistralai/models_.py +928 -0
- mistralai/py.typed +1 -0
- mistralai/sdk.py +111 -0
- mistralai/sdkconfiguration.py +53 -0
- mistralai/types/__init__.py +21 -0
- mistralai/types/basemodel.py +35 -0
- mistralai/utils/__init__.py +82 -0
- mistralai/utils/annotations.py +19 -0
- mistralai/utils/enums.py +34 -0
- mistralai/utils/eventstreaming.py +179 -0
- mistralai/utils/forms.py +207 -0
- mistralai/utils/headers.py +136 -0
- mistralai/utils/metadata.py +118 -0
- mistralai/utils/queryparams.py +203 -0
- mistralai/utils/requestbodies.py +66 -0
- mistralai/utils/retries.py +216 -0
- mistralai/utils/security.py +182 -0
- mistralai/utils/serializers.py +181 -0
- mistralai/utils/url.py +150 -0
- mistralai/utils/values.py +128 -0
- {mistralai-0.4.2.dist-info → mistralai-0.5.5a50.dist-info}/LICENSE +1 -1
- mistralai-0.5.5a50.dist-info/METADATA +626 -0
- mistralai-0.5.5a50.dist-info/RECORD +228 -0
- mistralai_azure/__init__.py +5 -0
- mistralai_azure/_hooks/__init__.py +5 -0
- mistralai_azure/_hooks/custom_user_agent.py +16 -0
- mistralai_azure/_hooks/registration.py +15 -0
- mistralai_azure/_hooks/sdkhooks.py +57 -0
- mistralai_azure/_hooks/types.py +76 -0
- mistralai_azure/basesdk.py +215 -0
- mistralai_azure/chat.py +475 -0
- mistralai_azure/httpclient.py +78 -0
- mistralai_azure/models/__init__.py +28 -0
- mistralai_azure/models/assistantmessage.py +58 -0
- mistralai_azure/models/chatcompletionchoice.py +33 -0
- mistralai_azure/models/chatcompletionrequest.py +114 -0
- mistralai_azure/models/chatcompletionresponse.py +27 -0
- mistralai_azure/models/chatcompletionstreamrequest.py +112 -0
- mistralai_azure/models/completionchunk.py +27 -0
- mistralai_azure/models/completionevent.py +15 -0
- mistralai_azure/models/completionresponsestreamchoice.py +53 -0
- mistralai_azure/models/contentchunk.py +17 -0
- mistralai_azure/models/deltamessage.py +52 -0
- mistralai_azure/models/function.py +19 -0
- mistralai_azure/models/functioncall.py +16 -0
- mistralai_azure/models/httpvalidationerror.py +23 -0
- mistralai_azure/models/responseformat.py +18 -0
- mistralai_azure/models/sdkerror.py +22 -0
- mistralai_azure/models/security.py +16 -0
- mistralai_azure/models/systemmessage.py +26 -0
- mistralai_azure/models/textchunk.py +17 -0
- mistralai_azure/models/tool.py +18 -0
- mistralai_azure/models/toolcall.py +20 -0
- mistralai_azure/models/toolmessage.py +55 -0
- mistralai_azure/models/usageinfo.py +18 -0
- mistralai_azure/models/usermessage.py +26 -0
- mistralai_azure/models/validationerror.py +24 -0
- mistralai_azure/py.typed +1 -0
- mistralai_azure/sdk.py +102 -0
- mistralai_azure/sdkconfiguration.py +53 -0
- mistralai_azure/types/__init__.py +21 -0
- mistralai_azure/types/basemodel.py +35 -0
- mistralai_azure/utils/__init__.py +80 -0
- mistralai_azure/utils/annotations.py +19 -0
- mistralai_azure/utils/enums.py +34 -0
- mistralai_azure/utils/eventstreaming.py +179 -0
- mistralai_azure/utils/forms.py +207 -0
- mistralai_azure/utils/headers.py +136 -0
- mistralai_azure/utils/metadata.py +118 -0
- mistralai_azure/utils/queryparams.py +203 -0
- mistralai_azure/utils/requestbodies.py +66 -0
- mistralai_azure/utils/retries.py +216 -0
- mistralai_azure/utils/security.py +168 -0
- mistralai_azure/utils/serializers.py +181 -0
- mistralai_azure/utils/url.py +150 -0
- mistralai_azure/utils/values.py +128 -0
- mistralai_gcp/__init__.py +5 -0
- mistralai_gcp/_hooks/__init__.py +5 -0
- mistralai_gcp/_hooks/custom_user_agent.py +16 -0
- mistralai_gcp/_hooks/registration.py +15 -0
- mistralai_gcp/_hooks/sdkhooks.py +57 -0
- mistralai_gcp/_hooks/types.py +76 -0
- mistralai_gcp/basesdk.py +215 -0
- mistralai_gcp/chat.py +463 -0
- mistralai_gcp/fim.py +439 -0
- mistralai_gcp/httpclient.py +78 -0
- mistralai_gcp/models/__init__.py +31 -0
- mistralai_gcp/models/assistantmessage.py +58 -0
- mistralai_gcp/models/chatcompletionchoice.py +33 -0
- mistralai_gcp/models/chatcompletionrequest.py +110 -0
- mistralai_gcp/models/chatcompletionresponse.py +27 -0
- mistralai_gcp/models/chatcompletionstreamrequest.py +108 -0
- mistralai_gcp/models/completionchunk.py +27 -0
- mistralai_gcp/models/completionevent.py +15 -0
- mistralai_gcp/models/completionresponsestreamchoice.py +53 -0
- mistralai_gcp/models/contentchunk.py +17 -0
- mistralai_gcp/models/deltamessage.py +52 -0
- mistralai_gcp/models/fimcompletionrequest.py +99 -0
- mistralai_gcp/models/fimcompletionresponse.py +27 -0
- mistralai_gcp/models/fimcompletionstreamrequest.py +97 -0
- mistralai_gcp/models/function.py +19 -0
- mistralai_gcp/models/functioncall.py +16 -0
- mistralai_gcp/models/httpvalidationerror.py +23 -0
- mistralai_gcp/models/responseformat.py +18 -0
- mistralai_gcp/models/sdkerror.py +22 -0
- mistralai_gcp/models/security.py +16 -0
- mistralai_gcp/models/systemmessage.py +26 -0
- mistralai_gcp/models/textchunk.py +17 -0
- mistralai_gcp/models/tool.py +18 -0
- mistralai_gcp/models/toolcall.py +20 -0
- mistralai_gcp/models/toolmessage.py +55 -0
- mistralai_gcp/models/usageinfo.py +18 -0
- mistralai_gcp/models/usermessage.py +26 -0
- mistralai_gcp/models/validationerror.py +24 -0
- mistralai_gcp/py.typed +1 -0
- mistralai_gcp/sdk.py +165 -0
- mistralai_gcp/sdkconfiguration.py +53 -0
- mistralai_gcp/types/__init__.py +21 -0
- mistralai_gcp/types/basemodel.py +35 -0
- mistralai_gcp/utils/__init__.py +80 -0
- mistralai_gcp/utils/annotations.py +19 -0
- mistralai_gcp/utils/enums.py +34 -0
- mistralai_gcp/utils/eventstreaming.py +179 -0
- mistralai_gcp/utils/forms.py +207 -0
- mistralai_gcp/utils/headers.py +136 -0
- mistralai_gcp/utils/metadata.py +118 -0
- mistralai_gcp/utils/queryparams.py +203 -0
- mistralai_gcp/utils/requestbodies.py +66 -0
- mistralai_gcp/utils/retries.py +216 -0
- mistralai_gcp/utils/security.py +168 -0
- mistralai_gcp/utils/serializers.py +181 -0
- mistralai_gcp/utils/url.py +150 -0
- mistralai_gcp/utils/values.py +128 -0
- py.typed +1 -0
- mistralai/client_base.py +0 -211
- mistralai/constants.py +0 -5
- mistralai/exceptions.py +0 -54
- mistralai/jobs.py +0 -172
- mistralai/models/chat_completion.py +0 -93
- mistralai/models/common.py +0 -9
- mistralai/models/embeddings.py +0 -19
- mistralai/models/files.py +0 -23
- mistralai/models/jobs.py +0 -100
- mistralai/models/models.py +0 -39
- mistralai-0.4.2.dist-info/METADATA +0 -82
- mistralai-0.4.2.dist-info/RECORD +0 -20
- {mistralai-0.4.2.dist-info → mistralai-0.5.5a50.dist-info}/WHEEL +0 -0
mistralai/models_.py
ADDED
|
@@ -0,0 +1,928 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .basesdk import BaseSDK
|
|
4
|
+
from mistralai import models
|
|
5
|
+
from mistralai._hooks import HookContext
|
|
6
|
+
from mistralai.types import OptionalNullable, UNSET
|
|
7
|
+
import mistralai.utils as utils
|
|
8
|
+
from typing import Any, Optional
|
|
9
|
+
|
|
10
|
+
class Models(BaseSDK):
|
|
11
|
+
r"""Model Management API"""
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def list(
|
|
15
|
+
self, *,
|
|
16
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
17
|
+
server_url: Optional[str] = None,
|
|
18
|
+
timeout_ms: Optional[int] = None,
|
|
19
|
+
) -> Optional[models.ModelList]:
|
|
20
|
+
r"""List Models
|
|
21
|
+
|
|
22
|
+
List all models available to the user.
|
|
23
|
+
|
|
24
|
+
:param retries: Override the default retry configuration for this method
|
|
25
|
+
:param server_url: Override the default server URL for this method
|
|
26
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
27
|
+
"""
|
|
28
|
+
base_url = None
|
|
29
|
+
url_variables = None
|
|
30
|
+
if timeout_ms is None:
|
|
31
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
32
|
+
|
|
33
|
+
if server_url is not None:
|
|
34
|
+
base_url = server_url
|
|
35
|
+
req = self.build_request(
|
|
36
|
+
method="GET",
|
|
37
|
+
path="/v1/models",
|
|
38
|
+
base_url=base_url,
|
|
39
|
+
url_variables=url_variables,
|
|
40
|
+
request=None,
|
|
41
|
+
request_body_required=False,
|
|
42
|
+
request_has_path_params=False,
|
|
43
|
+
request_has_query_params=True,
|
|
44
|
+
user_agent_header="user-agent",
|
|
45
|
+
accept_header_value="application/json",
|
|
46
|
+
security=self.sdk_configuration.security,
|
|
47
|
+
timeout_ms=timeout_ms,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
if retries == UNSET:
|
|
51
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
52
|
+
retries = self.sdk_configuration.retry_config
|
|
53
|
+
|
|
54
|
+
retry_config = None
|
|
55
|
+
if isinstance(retries, utils.RetryConfig):
|
|
56
|
+
retry_config = (retries, [
|
|
57
|
+
"429",
|
|
58
|
+
"500",
|
|
59
|
+
"502",
|
|
60
|
+
"503",
|
|
61
|
+
"504"
|
|
62
|
+
])
|
|
63
|
+
|
|
64
|
+
http_res = self.do_request(
|
|
65
|
+
hook_ctx=HookContext(operation_id="list_models_v1_models_get", oauth2_scopes=[], security_source=self.sdk_configuration.security),
|
|
66
|
+
request=req,
|
|
67
|
+
error_status_codes=["422","4XX","5XX"],
|
|
68
|
+
retry_config=retry_config
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
data: Any = None
|
|
72
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
73
|
+
return utils.unmarshal_json(http_res.text, Optional[models.ModelList])
|
|
74
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
75
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
76
|
+
raise models.HTTPValidationError(data=data)
|
|
77
|
+
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
78
|
+
raise models.SDKError("API error occurred", http_res.status_code, http_res.text, http_res)
|
|
79
|
+
|
|
80
|
+
content_type = http_res.headers.get("Content-Type")
|
|
81
|
+
raise models.SDKError(f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, http_res.text, http_res)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
async def list_async(
|
|
86
|
+
self, *,
|
|
87
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
88
|
+
server_url: Optional[str] = None,
|
|
89
|
+
timeout_ms: Optional[int] = None,
|
|
90
|
+
) -> Optional[models.ModelList]:
|
|
91
|
+
r"""List Models
|
|
92
|
+
|
|
93
|
+
List all models available to the user.
|
|
94
|
+
|
|
95
|
+
:param retries: Override the default retry configuration for this method
|
|
96
|
+
:param server_url: Override the default server URL for this method
|
|
97
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
98
|
+
"""
|
|
99
|
+
base_url = None
|
|
100
|
+
url_variables = None
|
|
101
|
+
if timeout_ms is None:
|
|
102
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
103
|
+
|
|
104
|
+
if server_url is not None:
|
|
105
|
+
base_url = server_url
|
|
106
|
+
req = self.build_request(
|
|
107
|
+
method="GET",
|
|
108
|
+
path="/v1/models",
|
|
109
|
+
base_url=base_url,
|
|
110
|
+
url_variables=url_variables,
|
|
111
|
+
request=None,
|
|
112
|
+
request_body_required=False,
|
|
113
|
+
request_has_path_params=False,
|
|
114
|
+
request_has_query_params=True,
|
|
115
|
+
user_agent_header="user-agent",
|
|
116
|
+
accept_header_value="application/json",
|
|
117
|
+
security=self.sdk_configuration.security,
|
|
118
|
+
timeout_ms=timeout_ms,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
if retries == UNSET:
|
|
122
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
123
|
+
retries = self.sdk_configuration.retry_config
|
|
124
|
+
|
|
125
|
+
retry_config = None
|
|
126
|
+
if isinstance(retries, utils.RetryConfig):
|
|
127
|
+
retry_config = (retries, [
|
|
128
|
+
"429",
|
|
129
|
+
"500",
|
|
130
|
+
"502",
|
|
131
|
+
"503",
|
|
132
|
+
"504"
|
|
133
|
+
])
|
|
134
|
+
|
|
135
|
+
http_res = await self.do_request_async(
|
|
136
|
+
hook_ctx=HookContext(operation_id="list_models_v1_models_get", oauth2_scopes=[], security_source=self.sdk_configuration.security),
|
|
137
|
+
request=req,
|
|
138
|
+
error_status_codes=["422","4XX","5XX"],
|
|
139
|
+
retry_config=retry_config
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
data: Any = None
|
|
143
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
144
|
+
return utils.unmarshal_json(http_res.text, Optional[models.ModelList])
|
|
145
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
146
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
147
|
+
raise models.HTTPValidationError(data=data)
|
|
148
|
+
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
149
|
+
raise models.SDKError("API error occurred", http_res.status_code, http_res.text, http_res)
|
|
150
|
+
|
|
151
|
+
content_type = http_res.headers.get("Content-Type")
|
|
152
|
+
raise models.SDKError(f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, http_res.text, http_res)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def retrieve(
|
|
157
|
+
self, *,
|
|
158
|
+
model_id: str,
|
|
159
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
160
|
+
server_url: Optional[str] = None,
|
|
161
|
+
timeout_ms: Optional[int] = None,
|
|
162
|
+
) -> Optional[models.ModelCard]:
|
|
163
|
+
r"""Retrieve Model
|
|
164
|
+
|
|
165
|
+
Retrieve a model information.
|
|
166
|
+
|
|
167
|
+
:param model_id:
|
|
168
|
+
:param retries: Override the default retry configuration for this method
|
|
169
|
+
:param server_url: Override the default server URL for this method
|
|
170
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
171
|
+
"""
|
|
172
|
+
base_url = None
|
|
173
|
+
url_variables = None
|
|
174
|
+
if timeout_ms is None:
|
|
175
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
176
|
+
|
|
177
|
+
if server_url is not None:
|
|
178
|
+
base_url = server_url
|
|
179
|
+
|
|
180
|
+
request = models.RetrieveModelV1ModelsModelIDGetRequest(
|
|
181
|
+
model_id=model_id,
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
req = self.build_request(
|
|
185
|
+
method="GET",
|
|
186
|
+
path="/v1/models/{model_id}",
|
|
187
|
+
base_url=base_url,
|
|
188
|
+
url_variables=url_variables,
|
|
189
|
+
request=request,
|
|
190
|
+
request_body_required=False,
|
|
191
|
+
request_has_path_params=True,
|
|
192
|
+
request_has_query_params=True,
|
|
193
|
+
user_agent_header="user-agent",
|
|
194
|
+
accept_header_value="application/json",
|
|
195
|
+
security=self.sdk_configuration.security,
|
|
196
|
+
timeout_ms=timeout_ms,
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
if retries == UNSET:
|
|
200
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
201
|
+
retries = self.sdk_configuration.retry_config
|
|
202
|
+
|
|
203
|
+
retry_config = None
|
|
204
|
+
if isinstance(retries, utils.RetryConfig):
|
|
205
|
+
retry_config = (retries, [
|
|
206
|
+
"429",
|
|
207
|
+
"500",
|
|
208
|
+
"502",
|
|
209
|
+
"503",
|
|
210
|
+
"504"
|
|
211
|
+
])
|
|
212
|
+
|
|
213
|
+
http_res = self.do_request(
|
|
214
|
+
hook_ctx=HookContext(operation_id="retrieve_model_v1_models__model_id__get", oauth2_scopes=[], security_source=self.sdk_configuration.security),
|
|
215
|
+
request=req,
|
|
216
|
+
error_status_codes=["422","4XX","5XX"],
|
|
217
|
+
retry_config=retry_config
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
data: Any = None
|
|
221
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
222
|
+
return utils.unmarshal_json(http_res.text, Optional[models.ModelCard])
|
|
223
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
224
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
225
|
+
raise models.HTTPValidationError(data=data)
|
|
226
|
+
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
227
|
+
raise models.SDKError("API error occurred", http_res.status_code, http_res.text, http_res)
|
|
228
|
+
|
|
229
|
+
content_type = http_res.headers.get("Content-Type")
|
|
230
|
+
raise models.SDKError(f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, http_res.text, http_res)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
async def retrieve_async(
|
|
235
|
+
self, *,
|
|
236
|
+
model_id: str,
|
|
237
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
238
|
+
server_url: Optional[str] = None,
|
|
239
|
+
timeout_ms: Optional[int] = None,
|
|
240
|
+
) -> Optional[models.ModelCard]:
|
|
241
|
+
r"""Retrieve Model
|
|
242
|
+
|
|
243
|
+
Retrieve a model information.
|
|
244
|
+
|
|
245
|
+
:param model_id:
|
|
246
|
+
:param retries: Override the default retry configuration for this method
|
|
247
|
+
:param server_url: Override the default server URL for this method
|
|
248
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
249
|
+
"""
|
|
250
|
+
base_url = None
|
|
251
|
+
url_variables = None
|
|
252
|
+
if timeout_ms is None:
|
|
253
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
254
|
+
|
|
255
|
+
if server_url is not None:
|
|
256
|
+
base_url = server_url
|
|
257
|
+
|
|
258
|
+
request = models.RetrieveModelV1ModelsModelIDGetRequest(
|
|
259
|
+
model_id=model_id,
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
req = self.build_request(
|
|
263
|
+
method="GET",
|
|
264
|
+
path="/v1/models/{model_id}",
|
|
265
|
+
base_url=base_url,
|
|
266
|
+
url_variables=url_variables,
|
|
267
|
+
request=request,
|
|
268
|
+
request_body_required=False,
|
|
269
|
+
request_has_path_params=True,
|
|
270
|
+
request_has_query_params=True,
|
|
271
|
+
user_agent_header="user-agent",
|
|
272
|
+
accept_header_value="application/json",
|
|
273
|
+
security=self.sdk_configuration.security,
|
|
274
|
+
timeout_ms=timeout_ms,
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
if retries == UNSET:
|
|
278
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
279
|
+
retries = self.sdk_configuration.retry_config
|
|
280
|
+
|
|
281
|
+
retry_config = None
|
|
282
|
+
if isinstance(retries, utils.RetryConfig):
|
|
283
|
+
retry_config = (retries, [
|
|
284
|
+
"429",
|
|
285
|
+
"500",
|
|
286
|
+
"502",
|
|
287
|
+
"503",
|
|
288
|
+
"504"
|
|
289
|
+
])
|
|
290
|
+
|
|
291
|
+
http_res = await self.do_request_async(
|
|
292
|
+
hook_ctx=HookContext(operation_id="retrieve_model_v1_models__model_id__get", oauth2_scopes=[], security_source=self.sdk_configuration.security),
|
|
293
|
+
request=req,
|
|
294
|
+
error_status_codes=["422","4XX","5XX"],
|
|
295
|
+
retry_config=retry_config
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
data: Any = None
|
|
299
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
300
|
+
return utils.unmarshal_json(http_res.text, Optional[models.ModelCard])
|
|
301
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
302
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
303
|
+
raise models.HTTPValidationError(data=data)
|
|
304
|
+
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
305
|
+
raise models.SDKError("API error occurred", http_res.status_code, http_res.text, http_res)
|
|
306
|
+
|
|
307
|
+
content_type = http_res.headers.get("Content-Type")
|
|
308
|
+
raise models.SDKError(f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, http_res.text, http_res)
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def delete(
|
|
313
|
+
self, *,
|
|
314
|
+
model_id: str,
|
|
315
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
316
|
+
server_url: Optional[str] = None,
|
|
317
|
+
timeout_ms: Optional[int] = None,
|
|
318
|
+
) -> Optional[models.DeleteModelOut]:
|
|
319
|
+
r"""Delete Model
|
|
320
|
+
|
|
321
|
+
Delete a fine-tuned model.
|
|
322
|
+
|
|
323
|
+
:param model_id:
|
|
324
|
+
:param retries: Override the default retry configuration for this method
|
|
325
|
+
:param server_url: Override the default server URL for this method
|
|
326
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
327
|
+
"""
|
|
328
|
+
base_url = None
|
|
329
|
+
url_variables = None
|
|
330
|
+
if timeout_ms is None:
|
|
331
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
332
|
+
|
|
333
|
+
if server_url is not None:
|
|
334
|
+
base_url = server_url
|
|
335
|
+
|
|
336
|
+
request = models.DeleteModelV1ModelsModelIDDeleteRequest(
|
|
337
|
+
model_id=model_id,
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
req = self.build_request(
|
|
341
|
+
method="DELETE",
|
|
342
|
+
path="/v1/models/{model_id}",
|
|
343
|
+
base_url=base_url,
|
|
344
|
+
url_variables=url_variables,
|
|
345
|
+
request=request,
|
|
346
|
+
request_body_required=False,
|
|
347
|
+
request_has_path_params=True,
|
|
348
|
+
request_has_query_params=True,
|
|
349
|
+
user_agent_header="user-agent",
|
|
350
|
+
accept_header_value="application/json",
|
|
351
|
+
security=self.sdk_configuration.security,
|
|
352
|
+
timeout_ms=timeout_ms,
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
if retries == UNSET:
|
|
356
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
357
|
+
retries = self.sdk_configuration.retry_config
|
|
358
|
+
|
|
359
|
+
retry_config = None
|
|
360
|
+
if isinstance(retries, utils.RetryConfig):
|
|
361
|
+
retry_config = (retries, [
|
|
362
|
+
"429",
|
|
363
|
+
"500",
|
|
364
|
+
"502",
|
|
365
|
+
"503",
|
|
366
|
+
"504"
|
|
367
|
+
])
|
|
368
|
+
|
|
369
|
+
http_res = self.do_request(
|
|
370
|
+
hook_ctx=HookContext(operation_id="delete_model_v1_models__model_id__delete", oauth2_scopes=[], security_source=self.sdk_configuration.security),
|
|
371
|
+
request=req,
|
|
372
|
+
error_status_codes=["422","4XX","5XX"],
|
|
373
|
+
retry_config=retry_config
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
data: Any = None
|
|
377
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
378
|
+
return utils.unmarshal_json(http_res.text, Optional[models.DeleteModelOut])
|
|
379
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
380
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
381
|
+
raise models.HTTPValidationError(data=data)
|
|
382
|
+
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
383
|
+
raise models.SDKError("API error occurred", http_res.status_code, http_res.text, http_res)
|
|
384
|
+
|
|
385
|
+
content_type = http_res.headers.get("Content-Type")
|
|
386
|
+
raise models.SDKError(f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, http_res.text, http_res)
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
async def delete_async(
|
|
391
|
+
self, *,
|
|
392
|
+
model_id: str,
|
|
393
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
394
|
+
server_url: Optional[str] = None,
|
|
395
|
+
timeout_ms: Optional[int] = None,
|
|
396
|
+
) -> Optional[models.DeleteModelOut]:
|
|
397
|
+
r"""Delete Model
|
|
398
|
+
|
|
399
|
+
Delete a fine-tuned model.
|
|
400
|
+
|
|
401
|
+
:param model_id:
|
|
402
|
+
:param retries: Override the default retry configuration for this method
|
|
403
|
+
:param server_url: Override the default server URL for this method
|
|
404
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
405
|
+
"""
|
|
406
|
+
base_url = None
|
|
407
|
+
url_variables = None
|
|
408
|
+
if timeout_ms is None:
|
|
409
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
410
|
+
|
|
411
|
+
if server_url is not None:
|
|
412
|
+
base_url = server_url
|
|
413
|
+
|
|
414
|
+
request = models.DeleteModelV1ModelsModelIDDeleteRequest(
|
|
415
|
+
model_id=model_id,
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
req = self.build_request(
|
|
419
|
+
method="DELETE",
|
|
420
|
+
path="/v1/models/{model_id}",
|
|
421
|
+
base_url=base_url,
|
|
422
|
+
url_variables=url_variables,
|
|
423
|
+
request=request,
|
|
424
|
+
request_body_required=False,
|
|
425
|
+
request_has_path_params=True,
|
|
426
|
+
request_has_query_params=True,
|
|
427
|
+
user_agent_header="user-agent",
|
|
428
|
+
accept_header_value="application/json",
|
|
429
|
+
security=self.sdk_configuration.security,
|
|
430
|
+
timeout_ms=timeout_ms,
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
if retries == UNSET:
|
|
434
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
435
|
+
retries = self.sdk_configuration.retry_config
|
|
436
|
+
|
|
437
|
+
retry_config = None
|
|
438
|
+
if isinstance(retries, utils.RetryConfig):
|
|
439
|
+
retry_config = (retries, [
|
|
440
|
+
"429",
|
|
441
|
+
"500",
|
|
442
|
+
"502",
|
|
443
|
+
"503",
|
|
444
|
+
"504"
|
|
445
|
+
])
|
|
446
|
+
|
|
447
|
+
http_res = await self.do_request_async(
|
|
448
|
+
hook_ctx=HookContext(operation_id="delete_model_v1_models__model_id__delete", oauth2_scopes=[], security_source=self.sdk_configuration.security),
|
|
449
|
+
request=req,
|
|
450
|
+
error_status_codes=["422","4XX","5XX"],
|
|
451
|
+
retry_config=retry_config
|
|
452
|
+
)
|
|
453
|
+
|
|
454
|
+
data: Any = None
|
|
455
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
456
|
+
return utils.unmarshal_json(http_res.text, Optional[models.DeleteModelOut])
|
|
457
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
458
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
459
|
+
raise models.HTTPValidationError(data=data)
|
|
460
|
+
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
461
|
+
raise models.SDKError("API error occurred", http_res.status_code, http_res.text, http_res)
|
|
462
|
+
|
|
463
|
+
content_type = http_res.headers.get("Content-Type")
|
|
464
|
+
raise models.SDKError(f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, http_res.text, http_res)
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
def update(
|
|
469
|
+
self, *,
|
|
470
|
+
model_id: str,
|
|
471
|
+
name: OptionalNullable[str] = UNSET,
|
|
472
|
+
description: OptionalNullable[str] = UNSET,
|
|
473
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
474
|
+
server_url: Optional[str] = None,
|
|
475
|
+
timeout_ms: Optional[int] = None,
|
|
476
|
+
) -> Optional[models.FTModelOut]:
|
|
477
|
+
r"""Update Fine Tuned Model
|
|
478
|
+
|
|
479
|
+
Update a model name or description.
|
|
480
|
+
|
|
481
|
+
:param model_id:
|
|
482
|
+
:param name:
|
|
483
|
+
:param description:
|
|
484
|
+
:param retries: Override the default retry configuration for this method
|
|
485
|
+
:param server_url: Override the default server URL for this method
|
|
486
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
487
|
+
"""
|
|
488
|
+
base_url = None
|
|
489
|
+
url_variables = None
|
|
490
|
+
if timeout_ms is None:
|
|
491
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
492
|
+
|
|
493
|
+
if server_url is not None:
|
|
494
|
+
base_url = server_url
|
|
495
|
+
|
|
496
|
+
request = models.JobsAPIRoutesFineTuningUpdateFineTunedModelRequest(
|
|
497
|
+
model_id=model_id,
|
|
498
|
+
update_ft_model_in=models.UpdateFTModelIn(
|
|
499
|
+
name=name,
|
|
500
|
+
description=description,
|
|
501
|
+
),
|
|
502
|
+
)
|
|
503
|
+
|
|
504
|
+
req = self.build_request(
|
|
505
|
+
method="PATCH",
|
|
506
|
+
path="/v1/fine_tuning/models/{model_id}",
|
|
507
|
+
base_url=base_url,
|
|
508
|
+
url_variables=url_variables,
|
|
509
|
+
request=request,
|
|
510
|
+
request_body_required=True,
|
|
511
|
+
request_has_path_params=True,
|
|
512
|
+
request_has_query_params=True,
|
|
513
|
+
user_agent_header="user-agent",
|
|
514
|
+
accept_header_value="application/json",
|
|
515
|
+
security=self.sdk_configuration.security,
|
|
516
|
+
get_serialized_body=lambda: utils.serialize_request_body(request.update_ft_model_in, False, False, "json", models.UpdateFTModelIn),
|
|
517
|
+
timeout_ms=timeout_ms,
|
|
518
|
+
)
|
|
519
|
+
|
|
520
|
+
if retries == UNSET:
|
|
521
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
522
|
+
retries = self.sdk_configuration.retry_config
|
|
523
|
+
|
|
524
|
+
retry_config = None
|
|
525
|
+
if isinstance(retries, utils.RetryConfig):
|
|
526
|
+
retry_config = (retries, [
|
|
527
|
+
"429",
|
|
528
|
+
"500",
|
|
529
|
+
"502",
|
|
530
|
+
"503",
|
|
531
|
+
"504"
|
|
532
|
+
])
|
|
533
|
+
|
|
534
|
+
http_res = self.do_request(
|
|
535
|
+
hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_update_fine_tuned_model", oauth2_scopes=[], security_source=self.sdk_configuration.security),
|
|
536
|
+
request=req,
|
|
537
|
+
error_status_codes=["4XX","5XX"],
|
|
538
|
+
retry_config=retry_config
|
|
539
|
+
)
|
|
540
|
+
|
|
541
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
542
|
+
return utils.unmarshal_json(http_res.text, Optional[models.FTModelOut])
|
|
543
|
+
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
544
|
+
raise models.SDKError("API error occurred", http_res.status_code, http_res.text, http_res)
|
|
545
|
+
|
|
546
|
+
content_type = http_res.headers.get("Content-Type")
|
|
547
|
+
raise models.SDKError(f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, http_res.text, http_res)
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
async def update_async(
|
|
552
|
+
self, *,
|
|
553
|
+
model_id: str,
|
|
554
|
+
name: OptionalNullable[str] = UNSET,
|
|
555
|
+
description: OptionalNullable[str] = UNSET,
|
|
556
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
557
|
+
server_url: Optional[str] = None,
|
|
558
|
+
timeout_ms: Optional[int] = None,
|
|
559
|
+
) -> Optional[models.FTModelOut]:
|
|
560
|
+
r"""Update Fine Tuned Model
|
|
561
|
+
|
|
562
|
+
Update a model name or description.
|
|
563
|
+
|
|
564
|
+
:param model_id:
|
|
565
|
+
:param name:
|
|
566
|
+
:param description:
|
|
567
|
+
:param retries: Override the default retry configuration for this method
|
|
568
|
+
:param server_url: Override the default server URL for this method
|
|
569
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
570
|
+
"""
|
|
571
|
+
base_url = None
|
|
572
|
+
url_variables = None
|
|
573
|
+
if timeout_ms is None:
|
|
574
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
575
|
+
|
|
576
|
+
if server_url is not None:
|
|
577
|
+
base_url = server_url
|
|
578
|
+
|
|
579
|
+
request = models.JobsAPIRoutesFineTuningUpdateFineTunedModelRequest(
|
|
580
|
+
model_id=model_id,
|
|
581
|
+
update_ft_model_in=models.UpdateFTModelIn(
|
|
582
|
+
name=name,
|
|
583
|
+
description=description,
|
|
584
|
+
),
|
|
585
|
+
)
|
|
586
|
+
|
|
587
|
+
req = self.build_request(
|
|
588
|
+
method="PATCH",
|
|
589
|
+
path="/v1/fine_tuning/models/{model_id}",
|
|
590
|
+
base_url=base_url,
|
|
591
|
+
url_variables=url_variables,
|
|
592
|
+
request=request,
|
|
593
|
+
request_body_required=True,
|
|
594
|
+
request_has_path_params=True,
|
|
595
|
+
request_has_query_params=True,
|
|
596
|
+
user_agent_header="user-agent",
|
|
597
|
+
accept_header_value="application/json",
|
|
598
|
+
security=self.sdk_configuration.security,
|
|
599
|
+
get_serialized_body=lambda: utils.serialize_request_body(request.update_ft_model_in, False, False, "json", models.UpdateFTModelIn),
|
|
600
|
+
timeout_ms=timeout_ms,
|
|
601
|
+
)
|
|
602
|
+
|
|
603
|
+
if retries == UNSET:
|
|
604
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
605
|
+
retries = self.sdk_configuration.retry_config
|
|
606
|
+
|
|
607
|
+
retry_config = None
|
|
608
|
+
if isinstance(retries, utils.RetryConfig):
|
|
609
|
+
retry_config = (retries, [
|
|
610
|
+
"429",
|
|
611
|
+
"500",
|
|
612
|
+
"502",
|
|
613
|
+
"503",
|
|
614
|
+
"504"
|
|
615
|
+
])
|
|
616
|
+
|
|
617
|
+
http_res = await self.do_request_async(
|
|
618
|
+
hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_update_fine_tuned_model", oauth2_scopes=[], security_source=self.sdk_configuration.security),
|
|
619
|
+
request=req,
|
|
620
|
+
error_status_codes=["4XX","5XX"],
|
|
621
|
+
retry_config=retry_config
|
|
622
|
+
)
|
|
623
|
+
|
|
624
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
625
|
+
return utils.unmarshal_json(http_res.text, Optional[models.FTModelOut])
|
|
626
|
+
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
627
|
+
raise models.SDKError("API error occurred", http_res.status_code, http_res.text, http_res)
|
|
628
|
+
|
|
629
|
+
content_type = http_res.headers.get("Content-Type")
|
|
630
|
+
raise models.SDKError(f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, http_res.text, http_res)
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
def archive(
|
|
635
|
+
self, *,
|
|
636
|
+
model_id: str,
|
|
637
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
638
|
+
server_url: Optional[str] = None,
|
|
639
|
+
timeout_ms: Optional[int] = None,
|
|
640
|
+
) -> Optional[models.ArchiveFTModelOut]:
|
|
641
|
+
r"""Archive Fine Tuned Model
|
|
642
|
+
|
|
643
|
+
Archive a fine-tuned model.
|
|
644
|
+
|
|
645
|
+
:param model_id:
|
|
646
|
+
:param retries: Override the default retry configuration for this method
|
|
647
|
+
:param server_url: Override the default server URL for this method
|
|
648
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
649
|
+
"""
|
|
650
|
+
base_url = None
|
|
651
|
+
url_variables = None
|
|
652
|
+
if timeout_ms is None:
|
|
653
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
654
|
+
|
|
655
|
+
if server_url is not None:
|
|
656
|
+
base_url = server_url
|
|
657
|
+
|
|
658
|
+
request = models.JobsAPIRoutesFineTuningArchiveFineTunedModelRequest(
|
|
659
|
+
model_id=model_id,
|
|
660
|
+
)
|
|
661
|
+
|
|
662
|
+
req = self.build_request(
|
|
663
|
+
method="POST",
|
|
664
|
+
path="/v1/fine_tuning/models/{model_id}/archive",
|
|
665
|
+
base_url=base_url,
|
|
666
|
+
url_variables=url_variables,
|
|
667
|
+
request=request,
|
|
668
|
+
request_body_required=False,
|
|
669
|
+
request_has_path_params=True,
|
|
670
|
+
request_has_query_params=True,
|
|
671
|
+
user_agent_header="user-agent",
|
|
672
|
+
accept_header_value="application/json",
|
|
673
|
+
security=self.sdk_configuration.security,
|
|
674
|
+
timeout_ms=timeout_ms,
|
|
675
|
+
)
|
|
676
|
+
|
|
677
|
+
if retries == UNSET:
|
|
678
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
679
|
+
retries = self.sdk_configuration.retry_config
|
|
680
|
+
|
|
681
|
+
retry_config = None
|
|
682
|
+
if isinstance(retries, utils.RetryConfig):
|
|
683
|
+
retry_config = (retries, [
|
|
684
|
+
"429",
|
|
685
|
+
"500",
|
|
686
|
+
"502",
|
|
687
|
+
"503",
|
|
688
|
+
"504"
|
|
689
|
+
])
|
|
690
|
+
|
|
691
|
+
http_res = self.do_request(
|
|
692
|
+
hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_archive_fine_tuned_model", oauth2_scopes=[], security_source=self.sdk_configuration.security),
|
|
693
|
+
request=req,
|
|
694
|
+
error_status_codes=["4XX","5XX"],
|
|
695
|
+
retry_config=retry_config
|
|
696
|
+
)
|
|
697
|
+
|
|
698
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
699
|
+
return utils.unmarshal_json(http_res.text, Optional[models.ArchiveFTModelOut])
|
|
700
|
+
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
701
|
+
raise models.SDKError("API error occurred", http_res.status_code, http_res.text, http_res)
|
|
702
|
+
|
|
703
|
+
content_type = http_res.headers.get("Content-Type")
|
|
704
|
+
raise models.SDKError(f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, http_res.text, http_res)
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
async def archive_async(
|
|
709
|
+
self, *,
|
|
710
|
+
model_id: str,
|
|
711
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
712
|
+
server_url: Optional[str] = None,
|
|
713
|
+
timeout_ms: Optional[int] = None,
|
|
714
|
+
) -> Optional[models.ArchiveFTModelOut]:
|
|
715
|
+
r"""Archive Fine Tuned Model
|
|
716
|
+
|
|
717
|
+
Archive a fine-tuned model.
|
|
718
|
+
|
|
719
|
+
:param model_id:
|
|
720
|
+
:param retries: Override the default retry configuration for this method
|
|
721
|
+
:param server_url: Override the default server URL for this method
|
|
722
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
723
|
+
"""
|
|
724
|
+
base_url = None
|
|
725
|
+
url_variables = None
|
|
726
|
+
if timeout_ms is None:
|
|
727
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
728
|
+
|
|
729
|
+
if server_url is not None:
|
|
730
|
+
base_url = server_url
|
|
731
|
+
|
|
732
|
+
request = models.JobsAPIRoutesFineTuningArchiveFineTunedModelRequest(
|
|
733
|
+
model_id=model_id,
|
|
734
|
+
)
|
|
735
|
+
|
|
736
|
+
req = self.build_request(
|
|
737
|
+
method="POST",
|
|
738
|
+
path="/v1/fine_tuning/models/{model_id}/archive",
|
|
739
|
+
base_url=base_url,
|
|
740
|
+
url_variables=url_variables,
|
|
741
|
+
request=request,
|
|
742
|
+
request_body_required=False,
|
|
743
|
+
request_has_path_params=True,
|
|
744
|
+
request_has_query_params=True,
|
|
745
|
+
user_agent_header="user-agent",
|
|
746
|
+
accept_header_value="application/json",
|
|
747
|
+
security=self.sdk_configuration.security,
|
|
748
|
+
timeout_ms=timeout_ms,
|
|
749
|
+
)
|
|
750
|
+
|
|
751
|
+
if retries == UNSET:
|
|
752
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
753
|
+
retries = self.sdk_configuration.retry_config
|
|
754
|
+
|
|
755
|
+
retry_config = None
|
|
756
|
+
if isinstance(retries, utils.RetryConfig):
|
|
757
|
+
retry_config = (retries, [
|
|
758
|
+
"429",
|
|
759
|
+
"500",
|
|
760
|
+
"502",
|
|
761
|
+
"503",
|
|
762
|
+
"504"
|
|
763
|
+
])
|
|
764
|
+
|
|
765
|
+
http_res = await self.do_request_async(
|
|
766
|
+
hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_archive_fine_tuned_model", oauth2_scopes=[], security_source=self.sdk_configuration.security),
|
|
767
|
+
request=req,
|
|
768
|
+
error_status_codes=["4XX","5XX"],
|
|
769
|
+
retry_config=retry_config
|
|
770
|
+
)
|
|
771
|
+
|
|
772
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
773
|
+
return utils.unmarshal_json(http_res.text, Optional[models.ArchiveFTModelOut])
|
|
774
|
+
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
775
|
+
raise models.SDKError("API error occurred", http_res.status_code, http_res.text, http_res)
|
|
776
|
+
|
|
777
|
+
content_type = http_res.headers.get("Content-Type")
|
|
778
|
+
raise models.SDKError(f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, http_res.text, http_res)
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
def unarchive(
|
|
783
|
+
self, *,
|
|
784
|
+
model_id: str,
|
|
785
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
786
|
+
server_url: Optional[str] = None,
|
|
787
|
+
timeout_ms: Optional[int] = None,
|
|
788
|
+
) -> Optional[models.UnarchiveFTModelOut]:
|
|
789
|
+
r"""Unarchive Fine Tuned Model
|
|
790
|
+
|
|
791
|
+
Un-archive a fine-tuned model.
|
|
792
|
+
|
|
793
|
+
:param model_id:
|
|
794
|
+
:param retries: Override the default retry configuration for this method
|
|
795
|
+
:param server_url: Override the default server URL for this method
|
|
796
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
797
|
+
"""
|
|
798
|
+
base_url = None
|
|
799
|
+
url_variables = None
|
|
800
|
+
if timeout_ms is None:
|
|
801
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
802
|
+
|
|
803
|
+
if server_url is not None:
|
|
804
|
+
base_url = server_url
|
|
805
|
+
|
|
806
|
+
request = models.JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequest(
|
|
807
|
+
model_id=model_id,
|
|
808
|
+
)
|
|
809
|
+
|
|
810
|
+
req = self.build_request(
|
|
811
|
+
method="DELETE",
|
|
812
|
+
path="/v1/fine_tuning/models/{model_id}/archive",
|
|
813
|
+
base_url=base_url,
|
|
814
|
+
url_variables=url_variables,
|
|
815
|
+
request=request,
|
|
816
|
+
request_body_required=False,
|
|
817
|
+
request_has_path_params=True,
|
|
818
|
+
request_has_query_params=True,
|
|
819
|
+
user_agent_header="user-agent",
|
|
820
|
+
accept_header_value="application/json",
|
|
821
|
+
security=self.sdk_configuration.security,
|
|
822
|
+
timeout_ms=timeout_ms,
|
|
823
|
+
)
|
|
824
|
+
|
|
825
|
+
if retries == UNSET:
|
|
826
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
827
|
+
retries = self.sdk_configuration.retry_config
|
|
828
|
+
|
|
829
|
+
retry_config = None
|
|
830
|
+
if isinstance(retries, utils.RetryConfig):
|
|
831
|
+
retry_config = (retries, [
|
|
832
|
+
"429",
|
|
833
|
+
"500",
|
|
834
|
+
"502",
|
|
835
|
+
"503",
|
|
836
|
+
"504"
|
|
837
|
+
])
|
|
838
|
+
|
|
839
|
+
http_res = self.do_request(
|
|
840
|
+
hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_unarchive_fine_tuned_model", oauth2_scopes=[], security_source=self.sdk_configuration.security),
|
|
841
|
+
request=req,
|
|
842
|
+
error_status_codes=["4XX","5XX"],
|
|
843
|
+
retry_config=retry_config
|
|
844
|
+
)
|
|
845
|
+
|
|
846
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
847
|
+
return utils.unmarshal_json(http_res.text, Optional[models.UnarchiveFTModelOut])
|
|
848
|
+
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
849
|
+
raise models.SDKError("API error occurred", http_res.status_code, http_res.text, http_res)
|
|
850
|
+
|
|
851
|
+
content_type = http_res.headers.get("Content-Type")
|
|
852
|
+
raise models.SDKError(f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, http_res.text, http_res)
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
async def unarchive_async(
|
|
857
|
+
self, *,
|
|
858
|
+
model_id: str,
|
|
859
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
860
|
+
server_url: Optional[str] = None,
|
|
861
|
+
timeout_ms: Optional[int] = None,
|
|
862
|
+
) -> Optional[models.UnarchiveFTModelOut]:
|
|
863
|
+
r"""Unarchive Fine Tuned Model
|
|
864
|
+
|
|
865
|
+
Un-archive a fine-tuned model.
|
|
866
|
+
|
|
867
|
+
:param model_id:
|
|
868
|
+
:param retries: Override the default retry configuration for this method
|
|
869
|
+
:param server_url: Override the default server URL for this method
|
|
870
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
871
|
+
"""
|
|
872
|
+
base_url = None
|
|
873
|
+
url_variables = None
|
|
874
|
+
if timeout_ms is None:
|
|
875
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
876
|
+
|
|
877
|
+
if server_url is not None:
|
|
878
|
+
base_url = server_url
|
|
879
|
+
|
|
880
|
+
request = models.JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequest(
|
|
881
|
+
model_id=model_id,
|
|
882
|
+
)
|
|
883
|
+
|
|
884
|
+
req = self.build_request(
|
|
885
|
+
method="DELETE",
|
|
886
|
+
path="/v1/fine_tuning/models/{model_id}/archive",
|
|
887
|
+
base_url=base_url,
|
|
888
|
+
url_variables=url_variables,
|
|
889
|
+
request=request,
|
|
890
|
+
request_body_required=False,
|
|
891
|
+
request_has_path_params=True,
|
|
892
|
+
request_has_query_params=True,
|
|
893
|
+
user_agent_header="user-agent",
|
|
894
|
+
accept_header_value="application/json",
|
|
895
|
+
security=self.sdk_configuration.security,
|
|
896
|
+
timeout_ms=timeout_ms,
|
|
897
|
+
)
|
|
898
|
+
|
|
899
|
+
if retries == UNSET:
|
|
900
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
901
|
+
retries = self.sdk_configuration.retry_config
|
|
902
|
+
|
|
903
|
+
retry_config = None
|
|
904
|
+
if isinstance(retries, utils.RetryConfig):
|
|
905
|
+
retry_config = (retries, [
|
|
906
|
+
"429",
|
|
907
|
+
"500",
|
|
908
|
+
"502",
|
|
909
|
+
"503",
|
|
910
|
+
"504"
|
|
911
|
+
])
|
|
912
|
+
|
|
913
|
+
http_res = await self.do_request_async(
|
|
914
|
+
hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_unarchive_fine_tuned_model", oauth2_scopes=[], security_source=self.sdk_configuration.security),
|
|
915
|
+
request=req,
|
|
916
|
+
error_status_codes=["4XX","5XX"],
|
|
917
|
+
retry_config=retry_config
|
|
918
|
+
)
|
|
919
|
+
|
|
920
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
921
|
+
return utils.unmarshal_json(http_res.text, Optional[models.UnarchiveFTModelOut])
|
|
922
|
+
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
923
|
+
raise models.SDKError("API error occurred", http_res.status_code, http_res.text, http_res)
|
|
924
|
+
|
|
925
|
+
content_type = http_res.headers.get("Content-Type")
|
|
926
|
+
raise models.SDKError(f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, http_res.text, http_res)
|
|
927
|
+
|
|
928
|
+
|