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