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/jobs.py
CHANGED
|
@@ -8,11 +8,11 @@ from mistralai.types import OptionalNullable, UNSET
|
|
|
8
8
|
from mistralai.utils import get_security_from_env
|
|
9
9
|
from typing import List, Optional, Union
|
|
10
10
|
|
|
11
|
+
|
|
11
12
|
class Jobs(BaseSDK):
|
|
12
|
-
|
|
13
|
-
|
|
14
13
|
def list(
|
|
15
|
-
self,
|
|
14
|
+
self,
|
|
15
|
+
*,
|
|
16
16
|
page: Optional[int] = 0,
|
|
17
17
|
page_size: Optional[int] = 100,
|
|
18
18
|
model: OptionalNullable[str] = UNSET,
|
|
@@ -47,10 +47,10 @@ class Jobs(BaseSDK):
|
|
|
47
47
|
url_variables = None
|
|
48
48
|
if timeout_ms is None:
|
|
49
49
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
if server_url is not None:
|
|
52
52
|
base_url = server_url
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
request = models.JobsAPIRoutesFineTuningGetFineTuningJobsRequest(
|
|
55
55
|
page=page,
|
|
56
56
|
page_size=page_size,
|
|
@@ -62,7 +62,7 @@ class Jobs(BaseSDK):
|
|
|
62
62
|
wandb_name=wandb_name,
|
|
63
63
|
suffix=suffix,
|
|
64
64
|
)
|
|
65
|
-
|
|
65
|
+
|
|
66
66
|
req = self.build_request(
|
|
67
67
|
method="GET",
|
|
68
68
|
path="/v1/fine_tuning/jobs",
|
|
@@ -77,40 +77,46 @@ class Jobs(BaseSDK):
|
|
|
77
77
|
security=self.sdk_configuration.security,
|
|
78
78
|
timeout_ms=timeout_ms,
|
|
79
79
|
)
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
if retries == UNSET:
|
|
82
82
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
83
83
|
retries = self.sdk_configuration.retry_config
|
|
84
84
|
|
|
85
85
|
retry_config = None
|
|
86
86
|
if isinstance(retries, utils.RetryConfig):
|
|
87
|
-
retry_config = (retries, [
|
|
88
|
-
|
|
89
|
-
"500",
|
|
90
|
-
"502",
|
|
91
|
-
"503",
|
|
92
|
-
"504"
|
|
93
|
-
])
|
|
94
|
-
|
|
87
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
88
|
+
|
|
95
89
|
http_res = self.do_request(
|
|
96
|
-
hook_ctx=HookContext(
|
|
90
|
+
hook_ctx=HookContext(
|
|
91
|
+
operation_id="jobs_api_routes_fine_tuning_get_fine_tuning_jobs",
|
|
92
|
+
oauth2_scopes=[],
|
|
93
|
+
security_source=get_security_from_env(
|
|
94
|
+
self.sdk_configuration.security, models.Security
|
|
95
|
+
),
|
|
96
|
+
),
|
|
97
97
|
request=req,
|
|
98
|
-
error_status_codes=["4XX","5XX"],
|
|
99
|
-
retry_config=retry_config
|
|
98
|
+
error_status_codes=["4XX", "5XX"],
|
|
99
|
+
retry_config=retry_config,
|
|
100
100
|
)
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
if utils.match_response(http_res, "200", "application/json"):
|
|
103
103
|
return utils.unmarshal_json(http_res.text, Optional[models.JobsOut])
|
|
104
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
105
|
-
raise models.SDKError(
|
|
106
|
-
|
|
104
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
105
|
+
raise models.SDKError(
|
|
106
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
107
|
+
)
|
|
108
|
+
|
|
107
109
|
content_type = http_res.headers.get("Content-Type")
|
|
108
|
-
raise models.SDKError(
|
|
110
|
+
raise models.SDKError(
|
|
111
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
112
|
+
http_res.status_code,
|
|
113
|
+
http_res.text,
|
|
114
|
+
http_res,
|
|
115
|
+
)
|
|
109
116
|
|
|
110
|
-
|
|
111
|
-
|
|
112
117
|
async def list_async(
|
|
113
|
-
self,
|
|
118
|
+
self,
|
|
119
|
+
*,
|
|
114
120
|
page: Optional[int] = 0,
|
|
115
121
|
page_size: Optional[int] = 100,
|
|
116
122
|
model: OptionalNullable[str] = UNSET,
|
|
@@ -145,10 +151,10 @@ class Jobs(BaseSDK):
|
|
|
145
151
|
url_variables = None
|
|
146
152
|
if timeout_ms is None:
|
|
147
153
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
148
|
-
|
|
154
|
+
|
|
149
155
|
if server_url is not None:
|
|
150
156
|
base_url = server_url
|
|
151
|
-
|
|
157
|
+
|
|
152
158
|
request = models.JobsAPIRoutesFineTuningGetFineTuningJobsRequest(
|
|
153
159
|
page=page,
|
|
154
160
|
page_size=page_size,
|
|
@@ -160,8 +166,8 @@ class Jobs(BaseSDK):
|
|
|
160
166
|
wandb_name=wandb_name,
|
|
161
167
|
suffix=suffix,
|
|
162
168
|
)
|
|
163
|
-
|
|
164
|
-
req = self.
|
|
169
|
+
|
|
170
|
+
req = self.build_request_async(
|
|
165
171
|
method="GET",
|
|
166
172
|
path="/v1/fine_tuning/jobs",
|
|
167
173
|
base_url=base_url,
|
|
@@ -175,47 +181,65 @@ class Jobs(BaseSDK):
|
|
|
175
181
|
security=self.sdk_configuration.security,
|
|
176
182
|
timeout_ms=timeout_ms,
|
|
177
183
|
)
|
|
178
|
-
|
|
184
|
+
|
|
179
185
|
if retries == UNSET:
|
|
180
186
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
181
187
|
retries = self.sdk_configuration.retry_config
|
|
182
188
|
|
|
183
189
|
retry_config = None
|
|
184
190
|
if isinstance(retries, utils.RetryConfig):
|
|
185
|
-
retry_config = (retries, [
|
|
186
|
-
|
|
187
|
-
"500",
|
|
188
|
-
"502",
|
|
189
|
-
"503",
|
|
190
|
-
"504"
|
|
191
|
-
])
|
|
192
|
-
|
|
191
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
192
|
+
|
|
193
193
|
http_res = await self.do_request_async(
|
|
194
|
-
hook_ctx=HookContext(
|
|
194
|
+
hook_ctx=HookContext(
|
|
195
|
+
operation_id="jobs_api_routes_fine_tuning_get_fine_tuning_jobs",
|
|
196
|
+
oauth2_scopes=[],
|
|
197
|
+
security_source=get_security_from_env(
|
|
198
|
+
self.sdk_configuration.security, models.Security
|
|
199
|
+
),
|
|
200
|
+
),
|
|
195
201
|
request=req,
|
|
196
|
-
error_status_codes=["4XX","5XX"],
|
|
197
|
-
retry_config=retry_config
|
|
202
|
+
error_status_codes=["4XX", "5XX"],
|
|
203
|
+
retry_config=retry_config,
|
|
198
204
|
)
|
|
199
|
-
|
|
205
|
+
|
|
200
206
|
if utils.match_response(http_res, "200", "application/json"):
|
|
201
207
|
return utils.unmarshal_json(http_res.text, Optional[models.JobsOut])
|
|
202
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
203
|
-
raise models.SDKError(
|
|
204
|
-
|
|
208
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
209
|
+
raise models.SDKError(
|
|
210
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
211
|
+
)
|
|
212
|
+
|
|
205
213
|
content_type = http_res.headers.get("Content-Type")
|
|
206
|
-
raise models.SDKError(
|
|
214
|
+
raise models.SDKError(
|
|
215
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
216
|
+
http_res.status_code,
|
|
217
|
+
http_res.text,
|
|
218
|
+
http_res,
|
|
219
|
+
)
|
|
207
220
|
|
|
208
|
-
|
|
209
|
-
|
|
210
221
|
def create(
|
|
211
|
-
self,
|
|
222
|
+
self,
|
|
223
|
+
*,
|
|
212
224
|
model: models.FineTuneableModel,
|
|
213
|
-
hyperparameters: Union[
|
|
214
|
-
|
|
225
|
+
hyperparameters: Union[
|
|
226
|
+
models.TrainingParametersIn, models.TrainingParametersInTypedDict
|
|
227
|
+
],
|
|
228
|
+
training_files: Optional[
|
|
229
|
+
Union[List[models.TrainingFile], List[models.TrainingFileTypedDict]]
|
|
230
|
+
] = None,
|
|
215
231
|
validation_files: OptionalNullable[List[str]] = UNSET,
|
|
216
232
|
suffix: OptionalNullable[str] = UNSET,
|
|
217
|
-
integrations: OptionalNullable[
|
|
218
|
-
|
|
233
|
+
integrations: OptionalNullable[
|
|
234
|
+
Union[
|
|
235
|
+
List[models.JobInIntegrations], List[models.JobInIntegrationsTypedDict]
|
|
236
|
+
]
|
|
237
|
+
] = UNSET,
|
|
238
|
+
repositories: Optional[
|
|
239
|
+
Union[
|
|
240
|
+
List[models.JobInRepositories], List[models.JobInRepositoriesTypedDict]
|
|
241
|
+
]
|
|
242
|
+
] = None,
|
|
219
243
|
auto_start: Optional[bool] = None,
|
|
220
244
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
221
245
|
server_url: Optional[str] = None,
|
|
@@ -227,11 +251,11 @@ class Jobs(BaseSDK):
|
|
|
227
251
|
|
|
228
252
|
:param model: The name of the model to fine-tune.
|
|
229
253
|
:param hyperparameters: The fine-tuning hyperparameter settings used in a fine-tune job.
|
|
230
|
-
:param training_files:
|
|
254
|
+
:param training_files:
|
|
231
255
|
:param validation_files: A list containing the IDs of uploaded files that contain validation data. If you provide these files, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in `checkpoints` when getting the status of a running fine-tuning job. The same data should not be present in both train and validation files.
|
|
232
256
|
:param suffix: A string that will be added to your fine-tuning model name. For example, a suffix of \"my-great-model\" would produce a model name like `ft:open-mistral-7b:my-great-model:xxx...`
|
|
233
257
|
:param integrations: A list of integrations to enable for your fine-tuning job.
|
|
234
|
-
:param repositories:
|
|
258
|
+
:param repositories:
|
|
235
259
|
:param auto_start: This field will be required in a future release.
|
|
236
260
|
:param retries: Override the default retry configuration for this method
|
|
237
261
|
:param server_url: Override the default server URL for this method
|
|
@@ -241,21 +265,29 @@ class Jobs(BaseSDK):
|
|
|
241
265
|
url_variables = None
|
|
242
266
|
if timeout_ms is None:
|
|
243
267
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
244
|
-
|
|
268
|
+
|
|
245
269
|
if server_url is not None:
|
|
246
270
|
base_url = server_url
|
|
247
|
-
|
|
271
|
+
|
|
248
272
|
request = models.JobIn(
|
|
249
273
|
model=model,
|
|
250
|
-
training_files=utils.get_pydantic_model(
|
|
274
|
+
training_files=utils.get_pydantic_model(
|
|
275
|
+
training_files, Optional[List[models.TrainingFile]]
|
|
276
|
+
),
|
|
251
277
|
validation_files=validation_files,
|
|
252
|
-
hyperparameters=utils.get_pydantic_model(
|
|
278
|
+
hyperparameters=utils.get_pydantic_model(
|
|
279
|
+
hyperparameters, models.TrainingParametersIn
|
|
280
|
+
),
|
|
253
281
|
suffix=suffix,
|
|
254
|
-
integrations=utils.get_pydantic_model(
|
|
255
|
-
|
|
282
|
+
integrations=utils.get_pydantic_model(
|
|
283
|
+
integrations, OptionalNullable[List[models.JobInIntegrations]]
|
|
284
|
+
),
|
|
285
|
+
repositories=utils.get_pydantic_model(
|
|
286
|
+
repositories, Optional[List[models.JobInRepositories]]
|
|
287
|
+
),
|
|
256
288
|
auto_start=auto_start,
|
|
257
289
|
)
|
|
258
|
-
|
|
290
|
+
|
|
259
291
|
req = self.build_request(
|
|
260
292
|
method="POST",
|
|
261
293
|
path="/v1/fine_tuning/jobs",
|
|
@@ -268,50 +300,73 @@ class Jobs(BaseSDK):
|
|
|
268
300
|
user_agent_header="user-agent",
|
|
269
301
|
accept_header_value="application/json",
|
|
270
302
|
security=self.sdk_configuration.security,
|
|
271
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
303
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
304
|
+
request, False, False, "json", models.JobIn
|
|
305
|
+
),
|
|
272
306
|
timeout_ms=timeout_ms,
|
|
273
307
|
)
|
|
274
|
-
|
|
308
|
+
|
|
275
309
|
if retries == UNSET:
|
|
276
310
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
277
311
|
retries = self.sdk_configuration.retry_config
|
|
278
312
|
|
|
279
313
|
retry_config = None
|
|
280
314
|
if isinstance(retries, utils.RetryConfig):
|
|
281
|
-
retry_config = (retries, [
|
|
282
|
-
|
|
283
|
-
"500",
|
|
284
|
-
"502",
|
|
285
|
-
"503",
|
|
286
|
-
"504"
|
|
287
|
-
])
|
|
288
|
-
|
|
315
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
316
|
+
|
|
289
317
|
http_res = self.do_request(
|
|
290
|
-
hook_ctx=HookContext(
|
|
318
|
+
hook_ctx=HookContext(
|
|
319
|
+
operation_id="jobs_api_routes_fine_tuning_create_fine_tuning_job",
|
|
320
|
+
oauth2_scopes=[],
|
|
321
|
+
security_source=get_security_from_env(
|
|
322
|
+
self.sdk_configuration.security, models.Security
|
|
323
|
+
),
|
|
324
|
+
),
|
|
291
325
|
request=req,
|
|
292
|
-
error_status_codes=["4XX","5XX"],
|
|
293
|
-
retry_config=retry_config
|
|
326
|
+
error_status_codes=["4XX", "5XX"],
|
|
327
|
+
retry_config=retry_config,
|
|
294
328
|
)
|
|
295
|
-
|
|
329
|
+
|
|
296
330
|
if utils.match_response(http_res, "200", "application/json"):
|
|
297
|
-
return utils.unmarshal_json(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
331
|
+
return utils.unmarshal_json(
|
|
332
|
+
http_res.text,
|
|
333
|
+
Optional[models.JobsAPIRoutesFineTuningCreateFineTuningJobResponse],
|
|
334
|
+
)
|
|
335
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
336
|
+
raise models.SDKError(
|
|
337
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
338
|
+
)
|
|
339
|
+
|
|
301
340
|
content_type = http_res.headers.get("Content-Type")
|
|
302
|
-
raise models.SDKError(
|
|
341
|
+
raise models.SDKError(
|
|
342
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
343
|
+
http_res.status_code,
|
|
344
|
+
http_res.text,
|
|
345
|
+
http_res,
|
|
346
|
+
)
|
|
303
347
|
|
|
304
|
-
|
|
305
|
-
|
|
306
348
|
async def create_async(
|
|
307
|
-
self,
|
|
349
|
+
self,
|
|
350
|
+
*,
|
|
308
351
|
model: models.FineTuneableModel,
|
|
309
|
-
hyperparameters: Union[
|
|
310
|
-
|
|
352
|
+
hyperparameters: Union[
|
|
353
|
+
models.TrainingParametersIn, models.TrainingParametersInTypedDict
|
|
354
|
+
],
|
|
355
|
+
training_files: Optional[
|
|
356
|
+
Union[List[models.TrainingFile], List[models.TrainingFileTypedDict]]
|
|
357
|
+
] = None,
|
|
311
358
|
validation_files: OptionalNullable[List[str]] = UNSET,
|
|
312
359
|
suffix: OptionalNullable[str] = UNSET,
|
|
313
|
-
integrations: OptionalNullable[
|
|
314
|
-
|
|
360
|
+
integrations: OptionalNullable[
|
|
361
|
+
Union[
|
|
362
|
+
List[models.JobInIntegrations], List[models.JobInIntegrationsTypedDict]
|
|
363
|
+
]
|
|
364
|
+
] = UNSET,
|
|
365
|
+
repositories: Optional[
|
|
366
|
+
Union[
|
|
367
|
+
List[models.JobInRepositories], List[models.JobInRepositoriesTypedDict]
|
|
368
|
+
]
|
|
369
|
+
] = None,
|
|
315
370
|
auto_start: Optional[bool] = None,
|
|
316
371
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
317
372
|
server_url: Optional[str] = None,
|
|
@@ -323,11 +378,11 @@ class Jobs(BaseSDK):
|
|
|
323
378
|
|
|
324
379
|
:param model: The name of the model to fine-tune.
|
|
325
380
|
:param hyperparameters: The fine-tuning hyperparameter settings used in a fine-tune job.
|
|
326
|
-
:param training_files:
|
|
381
|
+
:param training_files:
|
|
327
382
|
:param validation_files: A list containing the IDs of uploaded files that contain validation data. If you provide these files, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in `checkpoints` when getting the status of a running fine-tuning job. The same data should not be present in both train and validation files.
|
|
328
383
|
:param suffix: A string that will be added to your fine-tuning model name. For example, a suffix of \"my-great-model\" would produce a model name like `ft:open-mistral-7b:my-great-model:xxx...`
|
|
329
384
|
:param integrations: A list of integrations to enable for your fine-tuning job.
|
|
330
|
-
:param repositories:
|
|
385
|
+
:param repositories:
|
|
331
386
|
:param auto_start: This field will be required in a future release.
|
|
332
387
|
:param retries: Override the default retry configuration for this method
|
|
333
388
|
:param server_url: Override the default server URL for this method
|
|
@@ -337,22 +392,30 @@ class Jobs(BaseSDK):
|
|
|
337
392
|
url_variables = None
|
|
338
393
|
if timeout_ms is None:
|
|
339
394
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
340
|
-
|
|
395
|
+
|
|
341
396
|
if server_url is not None:
|
|
342
397
|
base_url = server_url
|
|
343
|
-
|
|
398
|
+
|
|
344
399
|
request = models.JobIn(
|
|
345
400
|
model=model,
|
|
346
|
-
training_files=utils.get_pydantic_model(
|
|
401
|
+
training_files=utils.get_pydantic_model(
|
|
402
|
+
training_files, Optional[List[models.TrainingFile]]
|
|
403
|
+
),
|
|
347
404
|
validation_files=validation_files,
|
|
348
|
-
hyperparameters=utils.get_pydantic_model(
|
|
405
|
+
hyperparameters=utils.get_pydantic_model(
|
|
406
|
+
hyperparameters, models.TrainingParametersIn
|
|
407
|
+
),
|
|
349
408
|
suffix=suffix,
|
|
350
|
-
integrations=utils.get_pydantic_model(
|
|
351
|
-
|
|
409
|
+
integrations=utils.get_pydantic_model(
|
|
410
|
+
integrations, OptionalNullable[List[models.JobInIntegrations]]
|
|
411
|
+
),
|
|
412
|
+
repositories=utils.get_pydantic_model(
|
|
413
|
+
repositories, Optional[List[models.JobInRepositories]]
|
|
414
|
+
),
|
|
352
415
|
auto_start=auto_start,
|
|
353
416
|
)
|
|
354
|
-
|
|
355
|
-
req = self.
|
|
417
|
+
|
|
418
|
+
req = self.build_request_async(
|
|
356
419
|
method="POST",
|
|
357
420
|
path="/v1/fine_tuning/jobs",
|
|
358
421
|
base_url=base_url,
|
|
@@ -364,43 +427,54 @@ class Jobs(BaseSDK):
|
|
|
364
427
|
user_agent_header="user-agent",
|
|
365
428
|
accept_header_value="application/json",
|
|
366
429
|
security=self.sdk_configuration.security,
|
|
367
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
430
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
431
|
+
request, False, False, "json", models.JobIn
|
|
432
|
+
),
|
|
368
433
|
timeout_ms=timeout_ms,
|
|
369
434
|
)
|
|
370
|
-
|
|
435
|
+
|
|
371
436
|
if retries == UNSET:
|
|
372
437
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
373
438
|
retries = self.sdk_configuration.retry_config
|
|
374
439
|
|
|
375
440
|
retry_config = None
|
|
376
441
|
if isinstance(retries, utils.RetryConfig):
|
|
377
|
-
retry_config = (retries, [
|
|
378
|
-
|
|
379
|
-
"500",
|
|
380
|
-
"502",
|
|
381
|
-
"503",
|
|
382
|
-
"504"
|
|
383
|
-
])
|
|
384
|
-
|
|
442
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
443
|
+
|
|
385
444
|
http_res = await self.do_request_async(
|
|
386
|
-
hook_ctx=HookContext(
|
|
445
|
+
hook_ctx=HookContext(
|
|
446
|
+
operation_id="jobs_api_routes_fine_tuning_create_fine_tuning_job",
|
|
447
|
+
oauth2_scopes=[],
|
|
448
|
+
security_source=get_security_from_env(
|
|
449
|
+
self.sdk_configuration.security, models.Security
|
|
450
|
+
),
|
|
451
|
+
),
|
|
387
452
|
request=req,
|
|
388
|
-
error_status_codes=["4XX","5XX"],
|
|
389
|
-
retry_config=retry_config
|
|
453
|
+
error_status_codes=["4XX", "5XX"],
|
|
454
|
+
retry_config=retry_config,
|
|
390
455
|
)
|
|
391
|
-
|
|
456
|
+
|
|
392
457
|
if utils.match_response(http_res, "200", "application/json"):
|
|
393
|
-
return utils.unmarshal_json(
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
458
|
+
return utils.unmarshal_json(
|
|
459
|
+
http_res.text,
|
|
460
|
+
Optional[models.JobsAPIRoutesFineTuningCreateFineTuningJobResponse],
|
|
461
|
+
)
|
|
462
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
463
|
+
raise models.SDKError(
|
|
464
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
465
|
+
)
|
|
466
|
+
|
|
397
467
|
content_type = http_res.headers.get("Content-Type")
|
|
398
|
-
raise models.SDKError(
|
|
468
|
+
raise models.SDKError(
|
|
469
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
470
|
+
http_res.status_code,
|
|
471
|
+
http_res.text,
|
|
472
|
+
http_res,
|
|
473
|
+
)
|
|
399
474
|
|
|
400
|
-
|
|
401
|
-
|
|
402
475
|
def get(
|
|
403
|
-
self,
|
|
476
|
+
self,
|
|
477
|
+
*,
|
|
404
478
|
job_id: str,
|
|
405
479
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
406
480
|
server_url: Optional[str] = None,
|
|
@@ -419,14 +493,14 @@ class Jobs(BaseSDK):
|
|
|
419
493
|
url_variables = None
|
|
420
494
|
if timeout_ms is None:
|
|
421
495
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
422
|
-
|
|
496
|
+
|
|
423
497
|
if server_url is not None:
|
|
424
498
|
base_url = server_url
|
|
425
|
-
|
|
499
|
+
|
|
426
500
|
request = models.JobsAPIRoutesFineTuningGetFineTuningJobRequest(
|
|
427
501
|
job_id=job_id,
|
|
428
502
|
)
|
|
429
|
-
|
|
503
|
+
|
|
430
504
|
req = self.build_request(
|
|
431
505
|
method="GET",
|
|
432
506
|
path="/v1/fine_tuning/jobs/{job_id}",
|
|
@@ -441,40 +515,46 @@ class Jobs(BaseSDK):
|
|
|
441
515
|
security=self.sdk_configuration.security,
|
|
442
516
|
timeout_ms=timeout_ms,
|
|
443
517
|
)
|
|
444
|
-
|
|
518
|
+
|
|
445
519
|
if retries == UNSET:
|
|
446
520
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
447
521
|
retries = self.sdk_configuration.retry_config
|
|
448
522
|
|
|
449
523
|
retry_config = None
|
|
450
524
|
if isinstance(retries, utils.RetryConfig):
|
|
451
|
-
retry_config = (retries, [
|
|
452
|
-
|
|
453
|
-
"500",
|
|
454
|
-
"502",
|
|
455
|
-
"503",
|
|
456
|
-
"504"
|
|
457
|
-
])
|
|
458
|
-
|
|
525
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
526
|
+
|
|
459
527
|
http_res = self.do_request(
|
|
460
|
-
hook_ctx=HookContext(
|
|
528
|
+
hook_ctx=HookContext(
|
|
529
|
+
operation_id="jobs_api_routes_fine_tuning_get_fine_tuning_job",
|
|
530
|
+
oauth2_scopes=[],
|
|
531
|
+
security_source=get_security_from_env(
|
|
532
|
+
self.sdk_configuration.security, models.Security
|
|
533
|
+
),
|
|
534
|
+
),
|
|
461
535
|
request=req,
|
|
462
|
-
error_status_codes=["4XX","5XX"],
|
|
463
|
-
retry_config=retry_config
|
|
536
|
+
error_status_codes=["4XX", "5XX"],
|
|
537
|
+
retry_config=retry_config,
|
|
464
538
|
)
|
|
465
|
-
|
|
539
|
+
|
|
466
540
|
if utils.match_response(http_res, "200", "application/json"):
|
|
467
541
|
return utils.unmarshal_json(http_res.text, Optional[models.DetailedJobOut])
|
|
468
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
469
|
-
raise models.SDKError(
|
|
470
|
-
|
|
542
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
543
|
+
raise models.SDKError(
|
|
544
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
545
|
+
)
|
|
546
|
+
|
|
471
547
|
content_type = http_res.headers.get("Content-Type")
|
|
472
|
-
raise models.SDKError(
|
|
548
|
+
raise models.SDKError(
|
|
549
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
550
|
+
http_res.status_code,
|
|
551
|
+
http_res.text,
|
|
552
|
+
http_res,
|
|
553
|
+
)
|
|
473
554
|
|
|
474
|
-
|
|
475
|
-
|
|
476
555
|
async def get_async(
|
|
477
|
-
self,
|
|
556
|
+
self,
|
|
557
|
+
*,
|
|
478
558
|
job_id: str,
|
|
479
559
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
480
560
|
server_url: Optional[str] = None,
|
|
@@ -493,15 +573,15 @@ class Jobs(BaseSDK):
|
|
|
493
573
|
url_variables = None
|
|
494
574
|
if timeout_ms is None:
|
|
495
575
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
496
|
-
|
|
576
|
+
|
|
497
577
|
if server_url is not None:
|
|
498
578
|
base_url = server_url
|
|
499
|
-
|
|
579
|
+
|
|
500
580
|
request = models.JobsAPIRoutesFineTuningGetFineTuningJobRequest(
|
|
501
581
|
job_id=job_id,
|
|
502
582
|
)
|
|
503
|
-
|
|
504
|
-
req = self.
|
|
583
|
+
|
|
584
|
+
req = self.build_request_async(
|
|
505
585
|
method="GET",
|
|
506
586
|
path="/v1/fine_tuning/jobs/{job_id}",
|
|
507
587
|
base_url=base_url,
|
|
@@ -515,40 +595,46 @@ class Jobs(BaseSDK):
|
|
|
515
595
|
security=self.sdk_configuration.security,
|
|
516
596
|
timeout_ms=timeout_ms,
|
|
517
597
|
)
|
|
518
|
-
|
|
598
|
+
|
|
519
599
|
if retries == UNSET:
|
|
520
600
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
521
601
|
retries = self.sdk_configuration.retry_config
|
|
522
602
|
|
|
523
603
|
retry_config = None
|
|
524
604
|
if isinstance(retries, utils.RetryConfig):
|
|
525
|
-
retry_config = (retries, [
|
|
526
|
-
|
|
527
|
-
"500",
|
|
528
|
-
"502",
|
|
529
|
-
"503",
|
|
530
|
-
"504"
|
|
531
|
-
])
|
|
532
|
-
|
|
605
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
606
|
+
|
|
533
607
|
http_res = await self.do_request_async(
|
|
534
|
-
hook_ctx=HookContext(
|
|
608
|
+
hook_ctx=HookContext(
|
|
609
|
+
operation_id="jobs_api_routes_fine_tuning_get_fine_tuning_job",
|
|
610
|
+
oauth2_scopes=[],
|
|
611
|
+
security_source=get_security_from_env(
|
|
612
|
+
self.sdk_configuration.security, models.Security
|
|
613
|
+
),
|
|
614
|
+
),
|
|
535
615
|
request=req,
|
|
536
|
-
error_status_codes=["4XX","5XX"],
|
|
537
|
-
retry_config=retry_config
|
|
616
|
+
error_status_codes=["4XX", "5XX"],
|
|
617
|
+
retry_config=retry_config,
|
|
538
618
|
)
|
|
539
|
-
|
|
619
|
+
|
|
540
620
|
if utils.match_response(http_res, "200", "application/json"):
|
|
541
621
|
return utils.unmarshal_json(http_res.text, Optional[models.DetailedJobOut])
|
|
542
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
543
|
-
raise models.SDKError(
|
|
544
|
-
|
|
622
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
623
|
+
raise models.SDKError(
|
|
624
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
625
|
+
)
|
|
626
|
+
|
|
545
627
|
content_type = http_res.headers.get("Content-Type")
|
|
546
|
-
raise models.SDKError(
|
|
628
|
+
raise models.SDKError(
|
|
629
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
630
|
+
http_res.status_code,
|
|
631
|
+
http_res.text,
|
|
632
|
+
http_res,
|
|
633
|
+
)
|
|
547
634
|
|
|
548
|
-
|
|
549
|
-
|
|
550
635
|
def cancel(
|
|
551
|
-
self,
|
|
636
|
+
self,
|
|
637
|
+
*,
|
|
552
638
|
job_id: str,
|
|
553
639
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
554
640
|
server_url: Optional[str] = None,
|
|
@@ -567,14 +653,14 @@ class Jobs(BaseSDK):
|
|
|
567
653
|
url_variables = None
|
|
568
654
|
if timeout_ms is None:
|
|
569
655
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
570
|
-
|
|
656
|
+
|
|
571
657
|
if server_url is not None:
|
|
572
658
|
base_url = server_url
|
|
573
|
-
|
|
659
|
+
|
|
574
660
|
request = models.JobsAPIRoutesFineTuningCancelFineTuningJobRequest(
|
|
575
661
|
job_id=job_id,
|
|
576
662
|
)
|
|
577
|
-
|
|
663
|
+
|
|
578
664
|
req = self.build_request(
|
|
579
665
|
method="POST",
|
|
580
666
|
path="/v1/fine_tuning/jobs/{job_id}/cancel",
|
|
@@ -589,40 +675,46 @@ class Jobs(BaseSDK):
|
|
|
589
675
|
security=self.sdk_configuration.security,
|
|
590
676
|
timeout_ms=timeout_ms,
|
|
591
677
|
)
|
|
592
|
-
|
|
678
|
+
|
|
593
679
|
if retries == UNSET:
|
|
594
680
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
595
681
|
retries = self.sdk_configuration.retry_config
|
|
596
682
|
|
|
597
683
|
retry_config = None
|
|
598
684
|
if isinstance(retries, utils.RetryConfig):
|
|
599
|
-
retry_config = (retries, [
|
|
600
|
-
|
|
601
|
-
"500",
|
|
602
|
-
"502",
|
|
603
|
-
"503",
|
|
604
|
-
"504"
|
|
605
|
-
])
|
|
606
|
-
|
|
685
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
686
|
+
|
|
607
687
|
http_res = self.do_request(
|
|
608
|
-
hook_ctx=HookContext(
|
|
688
|
+
hook_ctx=HookContext(
|
|
689
|
+
operation_id="jobs_api_routes_fine_tuning_cancel_fine_tuning_job",
|
|
690
|
+
oauth2_scopes=[],
|
|
691
|
+
security_source=get_security_from_env(
|
|
692
|
+
self.sdk_configuration.security, models.Security
|
|
693
|
+
),
|
|
694
|
+
),
|
|
609
695
|
request=req,
|
|
610
|
-
error_status_codes=["4XX","5XX"],
|
|
611
|
-
retry_config=retry_config
|
|
696
|
+
error_status_codes=["4XX", "5XX"],
|
|
697
|
+
retry_config=retry_config,
|
|
612
698
|
)
|
|
613
|
-
|
|
699
|
+
|
|
614
700
|
if utils.match_response(http_res, "200", "application/json"):
|
|
615
701
|
return utils.unmarshal_json(http_res.text, Optional[models.DetailedJobOut])
|
|
616
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
617
|
-
raise models.SDKError(
|
|
618
|
-
|
|
702
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
703
|
+
raise models.SDKError(
|
|
704
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
705
|
+
)
|
|
706
|
+
|
|
619
707
|
content_type = http_res.headers.get("Content-Type")
|
|
620
|
-
raise models.SDKError(
|
|
708
|
+
raise models.SDKError(
|
|
709
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
710
|
+
http_res.status_code,
|
|
711
|
+
http_res.text,
|
|
712
|
+
http_res,
|
|
713
|
+
)
|
|
621
714
|
|
|
622
|
-
|
|
623
|
-
|
|
624
715
|
async def cancel_async(
|
|
625
|
-
self,
|
|
716
|
+
self,
|
|
717
|
+
*,
|
|
626
718
|
job_id: str,
|
|
627
719
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
628
720
|
server_url: Optional[str] = None,
|
|
@@ -641,15 +733,15 @@ class Jobs(BaseSDK):
|
|
|
641
733
|
url_variables = None
|
|
642
734
|
if timeout_ms is None:
|
|
643
735
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
644
|
-
|
|
736
|
+
|
|
645
737
|
if server_url is not None:
|
|
646
738
|
base_url = server_url
|
|
647
|
-
|
|
739
|
+
|
|
648
740
|
request = models.JobsAPIRoutesFineTuningCancelFineTuningJobRequest(
|
|
649
741
|
job_id=job_id,
|
|
650
742
|
)
|
|
651
|
-
|
|
652
|
-
req = self.
|
|
743
|
+
|
|
744
|
+
req = self.build_request_async(
|
|
653
745
|
method="POST",
|
|
654
746
|
path="/v1/fine_tuning/jobs/{job_id}/cancel",
|
|
655
747
|
base_url=base_url,
|
|
@@ -663,40 +755,46 @@ class Jobs(BaseSDK):
|
|
|
663
755
|
security=self.sdk_configuration.security,
|
|
664
756
|
timeout_ms=timeout_ms,
|
|
665
757
|
)
|
|
666
|
-
|
|
758
|
+
|
|
667
759
|
if retries == UNSET:
|
|
668
760
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
669
761
|
retries = self.sdk_configuration.retry_config
|
|
670
762
|
|
|
671
763
|
retry_config = None
|
|
672
764
|
if isinstance(retries, utils.RetryConfig):
|
|
673
|
-
retry_config = (retries, [
|
|
674
|
-
|
|
675
|
-
"500",
|
|
676
|
-
"502",
|
|
677
|
-
"503",
|
|
678
|
-
"504"
|
|
679
|
-
])
|
|
680
|
-
|
|
765
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
766
|
+
|
|
681
767
|
http_res = await self.do_request_async(
|
|
682
|
-
hook_ctx=HookContext(
|
|
768
|
+
hook_ctx=HookContext(
|
|
769
|
+
operation_id="jobs_api_routes_fine_tuning_cancel_fine_tuning_job",
|
|
770
|
+
oauth2_scopes=[],
|
|
771
|
+
security_source=get_security_from_env(
|
|
772
|
+
self.sdk_configuration.security, models.Security
|
|
773
|
+
),
|
|
774
|
+
),
|
|
683
775
|
request=req,
|
|
684
|
-
error_status_codes=["4XX","5XX"],
|
|
685
|
-
retry_config=retry_config
|
|
776
|
+
error_status_codes=["4XX", "5XX"],
|
|
777
|
+
retry_config=retry_config,
|
|
686
778
|
)
|
|
687
|
-
|
|
779
|
+
|
|
688
780
|
if utils.match_response(http_res, "200", "application/json"):
|
|
689
781
|
return utils.unmarshal_json(http_res.text, Optional[models.DetailedJobOut])
|
|
690
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
691
|
-
raise models.SDKError(
|
|
692
|
-
|
|
782
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
783
|
+
raise models.SDKError(
|
|
784
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
785
|
+
)
|
|
786
|
+
|
|
693
787
|
content_type = http_res.headers.get("Content-Type")
|
|
694
|
-
raise models.SDKError(
|
|
788
|
+
raise models.SDKError(
|
|
789
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
790
|
+
http_res.status_code,
|
|
791
|
+
http_res.text,
|
|
792
|
+
http_res,
|
|
793
|
+
)
|
|
695
794
|
|
|
696
|
-
|
|
697
|
-
|
|
698
795
|
def start(
|
|
699
|
-
self,
|
|
796
|
+
self,
|
|
797
|
+
*,
|
|
700
798
|
job_id: str,
|
|
701
799
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
702
800
|
server_url: Optional[str] = None,
|
|
@@ -706,7 +804,7 @@ class Jobs(BaseSDK):
|
|
|
706
804
|
|
|
707
805
|
Request the start of a validated fine tuning job.
|
|
708
806
|
|
|
709
|
-
:param job_id:
|
|
807
|
+
:param job_id:
|
|
710
808
|
:param retries: Override the default retry configuration for this method
|
|
711
809
|
:param server_url: Override the default server URL for this method
|
|
712
810
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -715,14 +813,14 @@ class Jobs(BaseSDK):
|
|
|
715
813
|
url_variables = None
|
|
716
814
|
if timeout_ms is None:
|
|
717
815
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
718
|
-
|
|
816
|
+
|
|
719
817
|
if server_url is not None:
|
|
720
818
|
base_url = server_url
|
|
721
|
-
|
|
819
|
+
|
|
722
820
|
request = models.JobsAPIRoutesFineTuningStartFineTuningJobRequest(
|
|
723
821
|
job_id=job_id,
|
|
724
822
|
)
|
|
725
|
-
|
|
823
|
+
|
|
726
824
|
req = self.build_request(
|
|
727
825
|
method="POST",
|
|
728
826
|
path="/v1/fine_tuning/jobs/{job_id}/start",
|
|
@@ -737,40 +835,46 @@ class Jobs(BaseSDK):
|
|
|
737
835
|
security=self.sdk_configuration.security,
|
|
738
836
|
timeout_ms=timeout_ms,
|
|
739
837
|
)
|
|
740
|
-
|
|
838
|
+
|
|
741
839
|
if retries == UNSET:
|
|
742
840
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
743
841
|
retries = self.sdk_configuration.retry_config
|
|
744
842
|
|
|
745
843
|
retry_config = None
|
|
746
844
|
if isinstance(retries, utils.RetryConfig):
|
|
747
|
-
retry_config = (retries, [
|
|
748
|
-
|
|
749
|
-
"500",
|
|
750
|
-
"502",
|
|
751
|
-
"503",
|
|
752
|
-
"504"
|
|
753
|
-
])
|
|
754
|
-
|
|
845
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
846
|
+
|
|
755
847
|
http_res = self.do_request(
|
|
756
|
-
hook_ctx=HookContext(
|
|
848
|
+
hook_ctx=HookContext(
|
|
849
|
+
operation_id="jobs_api_routes_fine_tuning_start_fine_tuning_job",
|
|
850
|
+
oauth2_scopes=[],
|
|
851
|
+
security_source=get_security_from_env(
|
|
852
|
+
self.sdk_configuration.security, models.Security
|
|
853
|
+
),
|
|
854
|
+
),
|
|
757
855
|
request=req,
|
|
758
|
-
error_status_codes=["4XX","5XX"],
|
|
759
|
-
retry_config=retry_config
|
|
856
|
+
error_status_codes=["4XX", "5XX"],
|
|
857
|
+
retry_config=retry_config,
|
|
760
858
|
)
|
|
761
|
-
|
|
859
|
+
|
|
762
860
|
if utils.match_response(http_res, "200", "application/json"):
|
|
763
861
|
return utils.unmarshal_json(http_res.text, Optional[models.DetailedJobOut])
|
|
764
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
765
|
-
raise models.SDKError(
|
|
766
|
-
|
|
862
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
863
|
+
raise models.SDKError(
|
|
864
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
865
|
+
)
|
|
866
|
+
|
|
767
867
|
content_type = http_res.headers.get("Content-Type")
|
|
768
|
-
raise models.SDKError(
|
|
868
|
+
raise models.SDKError(
|
|
869
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
870
|
+
http_res.status_code,
|
|
871
|
+
http_res.text,
|
|
872
|
+
http_res,
|
|
873
|
+
)
|
|
769
874
|
|
|
770
|
-
|
|
771
|
-
|
|
772
875
|
async def start_async(
|
|
773
|
-
self,
|
|
876
|
+
self,
|
|
877
|
+
*,
|
|
774
878
|
job_id: str,
|
|
775
879
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
776
880
|
server_url: Optional[str] = None,
|
|
@@ -780,7 +884,7 @@ class Jobs(BaseSDK):
|
|
|
780
884
|
|
|
781
885
|
Request the start of a validated fine tuning job.
|
|
782
886
|
|
|
783
|
-
:param job_id:
|
|
887
|
+
:param job_id:
|
|
784
888
|
:param retries: Override the default retry configuration for this method
|
|
785
889
|
:param server_url: Override the default server URL for this method
|
|
786
890
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -789,15 +893,15 @@ class Jobs(BaseSDK):
|
|
|
789
893
|
url_variables = None
|
|
790
894
|
if timeout_ms is None:
|
|
791
895
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
792
|
-
|
|
896
|
+
|
|
793
897
|
if server_url is not None:
|
|
794
898
|
base_url = server_url
|
|
795
|
-
|
|
899
|
+
|
|
796
900
|
request = models.JobsAPIRoutesFineTuningStartFineTuningJobRequest(
|
|
797
901
|
job_id=job_id,
|
|
798
902
|
)
|
|
799
|
-
|
|
800
|
-
req = self.
|
|
903
|
+
|
|
904
|
+
req = self.build_request_async(
|
|
801
905
|
method="POST",
|
|
802
906
|
path="/v1/fine_tuning/jobs/{job_id}/start",
|
|
803
907
|
base_url=base_url,
|
|
@@ -811,34 +915,39 @@ class Jobs(BaseSDK):
|
|
|
811
915
|
security=self.sdk_configuration.security,
|
|
812
916
|
timeout_ms=timeout_ms,
|
|
813
917
|
)
|
|
814
|
-
|
|
918
|
+
|
|
815
919
|
if retries == UNSET:
|
|
816
920
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
817
921
|
retries = self.sdk_configuration.retry_config
|
|
818
922
|
|
|
819
923
|
retry_config = None
|
|
820
924
|
if isinstance(retries, utils.RetryConfig):
|
|
821
|
-
retry_config = (retries, [
|
|
822
|
-
|
|
823
|
-
"500",
|
|
824
|
-
"502",
|
|
825
|
-
"503",
|
|
826
|
-
"504"
|
|
827
|
-
])
|
|
828
|
-
|
|
925
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
926
|
+
|
|
829
927
|
http_res = await self.do_request_async(
|
|
830
|
-
hook_ctx=HookContext(
|
|
928
|
+
hook_ctx=HookContext(
|
|
929
|
+
operation_id="jobs_api_routes_fine_tuning_start_fine_tuning_job",
|
|
930
|
+
oauth2_scopes=[],
|
|
931
|
+
security_source=get_security_from_env(
|
|
932
|
+
self.sdk_configuration.security, models.Security
|
|
933
|
+
),
|
|
934
|
+
),
|
|
831
935
|
request=req,
|
|
832
|
-
error_status_codes=["4XX","5XX"],
|
|
833
|
-
retry_config=retry_config
|
|
936
|
+
error_status_codes=["4XX", "5XX"],
|
|
937
|
+
retry_config=retry_config,
|
|
834
938
|
)
|
|
835
|
-
|
|
939
|
+
|
|
836
940
|
if utils.match_response(http_res, "200", "application/json"):
|
|
837
941
|
return utils.unmarshal_json(http_res.text, Optional[models.DetailedJobOut])
|
|
838
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
839
|
-
raise models.SDKError(
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
raise models.SDKError(f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, http_res.text, http_res)
|
|
942
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
943
|
+
raise models.SDKError(
|
|
944
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
945
|
+
)
|
|
843
946
|
|
|
844
|
-
|
|
947
|
+
content_type = http_res.headers.get("Content-Type")
|
|
948
|
+
raise models.SDKError(
|
|
949
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
950
|
+
http_res.status_code,
|
|
951
|
+
http_res.text,
|
|
952
|
+
http_res,
|
|
953
|
+
)
|