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/files.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 Optional, Union
|
|
9
9
|
|
|
10
|
+
|
|
10
11
|
class Files(BaseSDK):
|
|
11
12
|
r"""Files API"""
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
def upload(
|
|
15
|
-
self,
|
|
15
|
+
self,
|
|
16
|
+
*,
|
|
16
17
|
file: Union[models.File, models.FileTypedDict],
|
|
17
18
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
18
19
|
server_url: Optional[str] = None,
|
|
@@ -35,14 +36,14 @@ class Files(BaseSDK):
|
|
|
35
36
|
url_variables = None
|
|
36
37
|
if timeout_ms is None:
|
|
37
38
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
38
|
-
|
|
39
|
+
|
|
39
40
|
if server_url is not None:
|
|
40
41
|
base_url = server_url
|
|
41
|
-
|
|
42
|
+
|
|
42
43
|
request = models.FilesAPIRoutesUploadFileMultiPartBodyParams(
|
|
43
44
|
file=utils.get_pydantic_model(file, models.File),
|
|
44
45
|
)
|
|
45
|
-
|
|
46
|
+
|
|
46
47
|
req = self.build_request(
|
|
47
48
|
method="POST",
|
|
48
49
|
path="/v1/files",
|
|
@@ -55,43 +56,55 @@ class Files(BaseSDK):
|
|
|
55
56
|
user_agent_header="user-agent",
|
|
56
57
|
accept_header_value="application/json",
|
|
57
58
|
security=self.sdk_configuration.security,
|
|
58
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
59
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
60
|
+
request,
|
|
61
|
+
False,
|
|
62
|
+
False,
|
|
63
|
+
"multipart",
|
|
64
|
+
models.FilesAPIRoutesUploadFileMultiPartBodyParams,
|
|
65
|
+
),
|
|
59
66
|
timeout_ms=timeout_ms,
|
|
60
67
|
)
|
|
61
|
-
|
|
68
|
+
|
|
62
69
|
if retries == UNSET:
|
|
63
70
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
64
71
|
retries = self.sdk_configuration.retry_config
|
|
65
72
|
|
|
66
73
|
retry_config = None
|
|
67
74
|
if isinstance(retries, utils.RetryConfig):
|
|
68
|
-
retry_config = (retries, [
|
|
69
|
-
|
|
70
|
-
"500",
|
|
71
|
-
"502",
|
|
72
|
-
"503",
|
|
73
|
-
"504"
|
|
74
|
-
])
|
|
75
|
-
|
|
75
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
76
|
+
|
|
76
77
|
http_res = self.do_request(
|
|
77
|
-
hook_ctx=HookContext(
|
|
78
|
+
hook_ctx=HookContext(
|
|
79
|
+
operation_id="files_api_routes_upload_file",
|
|
80
|
+
oauth2_scopes=[],
|
|
81
|
+
security_source=get_security_from_env(
|
|
82
|
+
self.sdk_configuration.security, models.Security
|
|
83
|
+
),
|
|
84
|
+
),
|
|
78
85
|
request=req,
|
|
79
|
-
error_status_codes=["4XX","5XX"],
|
|
80
|
-
retry_config=retry_config
|
|
86
|
+
error_status_codes=["4XX", "5XX"],
|
|
87
|
+
retry_config=retry_config,
|
|
81
88
|
)
|
|
82
|
-
|
|
89
|
+
|
|
83
90
|
if utils.match_response(http_res, "200", "application/json"):
|
|
84
91
|
return utils.unmarshal_json(http_res.text, Optional[models.UploadFileOut])
|
|
85
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
86
|
-
raise models.SDKError(
|
|
87
|
-
|
|
92
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
93
|
+
raise models.SDKError(
|
|
94
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
95
|
+
)
|
|
96
|
+
|
|
88
97
|
content_type = http_res.headers.get("Content-Type")
|
|
89
|
-
raise models.SDKError(
|
|
98
|
+
raise models.SDKError(
|
|
99
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
100
|
+
http_res.status_code,
|
|
101
|
+
http_res.text,
|
|
102
|
+
http_res,
|
|
103
|
+
)
|
|
90
104
|
|
|
91
|
-
|
|
92
|
-
|
|
93
105
|
async def upload_async(
|
|
94
|
-
self,
|
|
106
|
+
self,
|
|
107
|
+
*,
|
|
95
108
|
file: Union[models.File, models.FileTypedDict],
|
|
96
109
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
97
110
|
server_url: Optional[str] = None,
|
|
@@ -114,15 +127,15 @@ class Files(BaseSDK):
|
|
|
114
127
|
url_variables = None
|
|
115
128
|
if timeout_ms is None:
|
|
116
129
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
117
|
-
|
|
130
|
+
|
|
118
131
|
if server_url is not None:
|
|
119
132
|
base_url = server_url
|
|
120
|
-
|
|
133
|
+
|
|
121
134
|
request = models.FilesAPIRoutesUploadFileMultiPartBodyParams(
|
|
122
135
|
file=utils.get_pydantic_model(file, models.File),
|
|
123
136
|
)
|
|
124
|
-
|
|
125
|
-
req = self.
|
|
137
|
+
|
|
138
|
+
req = self.build_request_async(
|
|
126
139
|
method="POST",
|
|
127
140
|
path="/v1/files",
|
|
128
141
|
base_url=base_url,
|
|
@@ -134,43 +147,55 @@ class Files(BaseSDK):
|
|
|
134
147
|
user_agent_header="user-agent",
|
|
135
148
|
accept_header_value="application/json",
|
|
136
149
|
security=self.sdk_configuration.security,
|
|
137
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
150
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
151
|
+
request,
|
|
152
|
+
False,
|
|
153
|
+
False,
|
|
154
|
+
"multipart",
|
|
155
|
+
models.FilesAPIRoutesUploadFileMultiPartBodyParams,
|
|
156
|
+
),
|
|
138
157
|
timeout_ms=timeout_ms,
|
|
139
158
|
)
|
|
140
|
-
|
|
159
|
+
|
|
141
160
|
if retries == UNSET:
|
|
142
161
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
143
162
|
retries = self.sdk_configuration.retry_config
|
|
144
163
|
|
|
145
164
|
retry_config = None
|
|
146
165
|
if isinstance(retries, utils.RetryConfig):
|
|
147
|
-
retry_config = (retries, [
|
|
148
|
-
|
|
149
|
-
"500",
|
|
150
|
-
"502",
|
|
151
|
-
"503",
|
|
152
|
-
"504"
|
|
153
|
-
])
|
|
154
|
-
|
|
166
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
167
|
+
|
|
155
168
|
http_res = await self.do_request_async(
|
|
156
|
-
hook_ctx=HookContext(
|
|
169
|
+
hook_ctx=HookContext(
|
|
170
|
+
operation_id="files_api_routes_upload_file",
|
|
171
|
+
oauth2_scopes=[],
|
|
172
|
+
security_source=get_security_from_env(
|
|
173
|
+
self.sdk_configuration.security, models.Security
|
|
174
|
+
),
|
|
175
|
+
),
|
|
157
176
|
request=req,
|
|
158
|
-
error_status_codes=["4XX","5XX"],
|
|
159
|
-
retry_config=retry_config
|
|
177
|
+
error_status_codes=["4XX", "5XX"],
|
|
178
|
+
retry_config=retry_config,
|
|
160
179
|
)
|
|
161
|
-
|
|
180
|
+
|
|
162
181
|
if utils.match_response(http_res, "200", "application/json"):
|
|
163
182
|
return utils.unmarshal_json(http_res.text, Optional[models.UploadFileOut])
|
|
164
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
165
|
-
raise models.SDKError(
|
|
166
|
-
|
|
183
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
184
|
+
raise models.SDKError(
|
|
185
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
186
|
+
)
|
|
187
|
+
|
|
167
188
|
content_type = http_res.headers.get("Content-Type")
|
|
168
|
-
raise models.SDKError(
|
|
189
|
+
raise models.SDKError(
|
|
190
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
191
|
+
http_res.status_code,
|
|
192
|
+
http_res.text,
|
|
193
|
+
http_res,
|
|
194
|
+
)
|
|
169
195
|
|
|
170
|
-
|
|
171
|
-
|
|
172
196
|
def list(
|
|
173
|
-
self,
|
|
197
|
+
self,
|
|
198
|
+
*,
|
|
174
199
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
175
200
|
server_url: Optional[str] = None,
|
|
176
201
|
timeout_ms: Optional[int] = None,
|
|
@@ -187,7 +212,7 @@ class Files(BaseSDK):
|
|
|
187
212
|
url_variables = None
|
|
188
213
|
if timeout_ms is None:
|
|
189
214
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
190
|
-
|
|
215
|
+
|
|
191
216
|
if server_url is not None:
|
|
192
217
|
base_url = server_url
|
|
193
218
|
req = self.build_request(
|
|
@@ -204,40 +229,46 @@ class Files(BaseSDK):
|
|
|
204
229
|
security=self.sdk_configuration.security,
|
|
205
230
|
timeout_ms=timeout_ms,
|
|
206
231
|
)
|
|
207
|
-
|
|
232
|
+
|
|
208
233
|
if retries == UNSET:
|
|
209
234
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
210
235
|
retries = self.sdk_configuration.retry_config
|
|
211
236
|
|
|
212
237
|
retry_config = None
|
|
213
238
|
if isinstance(retries, utils.RetryConfig):
|
|
214
|
-
retry_config = (retries, [
|
|
215
|
-
|
|
216
|
-
"500",
|
|
217
|
-
"502",
|
|
218
|
-
"503",
|
|
219
|
-
"504"
|
|
220
|
-
])
|
|
221
|
-
|
|
239
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
240
|
+
|
|
222
241
|
http_res = self.do_request(
|
|
223
|
-
hook_ctx=HookContext(
|
|
242
|
+
hook_ctx=HookContext(
|
|
243
|
+
operation_id="files_api_routes_list_files",
|
|
244
|
+
oauth2_scopes=[],
|
|
245
|
+
security_source=get_security_from_env(
|
|
246
|
+
self.sdk_configuration.security, models.Security
|
|
247
|
+
),
|
|
248
|
+
),
|
|
224
249
|
request=req,
|
|
225
|
-
error_status_codes=["4XX","5XX"],
|
|
226
|
-
retry_config=retry_config
|
|
250
|
+
error_status_codes=["4XX", "5XX"],
|
|
251
|
+
retry_config=retry_config,
|
|
227
252
|
)
|
|
228
|
-
|
|
253
|
+
|
|
229
254
|
if utils.match_response(http_res, "200", "application/json"):
|
|
230
255
|
return utils.unmarshal_json(http_res.text, Optional[models.ListFilesOut])
|
|
231
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
232
|
-
raise models.SDKError(
|
|
233
|
-
|
|
256
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
257
|
+
raise models.SDKError(
|
|
258
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
259
|
+
)
|
|
260
|
+
|
|
234
261
|
content_type = http_res.headers.get("Content-Type")
|
|
235
|
-
raise models.SDKError(
|
|
262
|
+
raise models.SDKError(
|
|
263
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
264
|
+
http_res.status_code,
|
|
265
|
+
http_res.text,
|
|
266
|
+
http_res,
|
|
267
|
+
)
|
|
236
268
|
|
|
237
|
-
|
|
238
|
-
|
|
239
269
|
async def list_async(
|
|
240
|
-
self,
|
|
270
|
+
self,
|
|
271
|
+
*,
|
|
241
272
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
242
273
|
server_url: Optional[str] = None,
|
|
243
274
|
timeout_ms: Optional[int] = None,
|
|
@@ -254,10 +285,10 @@ class Files(BaseSDK):
|
|
|
254
285
|
url_variables = None
|
|
255
286
|
if timeout_ms is None:
|
|
256
287
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
257
|
-
|
|
288
|
+
|
|
258
289
|
if server_url is not None:
|
|
259
290
|
base_url = server_url
|
|
260
|
-
req = self.
|
|
291
|
+
req = self.build_request_async(
|
|
261
292
|
method="GET",
|
|
262
293
|
path="/v1/files",
|
|
263
294
|
base_url=base_url,
|
|
@@ -271,40 +302,46 @@ class Files(BaseSDK):
|
|
|
271
302
|
security=self.sdk_configuration.security,
|
|
272
303
|
timeout_ms=timeout_ms,
|
|
273
304
|
)
|
|
274
|
-
|
|
305
|
+
|
|
275
306
|
if retries == UNSET:
|
|
276
307
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
277
308
|
retries = self.sdk_configuration.retry_config
|
|
278
309
|
|
|
279
310
|
retry_config = None
|
|
280
311
|
if isinstance(retries, utils.RetryConfig):
|
|
281
|
-
retry_config = (retries, [
|
|
282
|
-
|
|
283
|
-
"500",
|
|
284
|
-
"502",
|
|
285
|
-
"503",
|
|
286
|
-
"504"
|
|
287
|
-
])
|
|
288
|
-
|
|
312
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
313
|
+
|
|
289
314
|
http_res = await self.do_request_async(
|
|
290
|
-
hook_ctx=HookContext(
|
|
315
|
+
hook_ctx=HookContext(
|
|
316
|
+
operation_id="files_api_routes_list_files",
|
|
317
|
+
oauth2_scopes=[],
|
|
318
|
+
security_source=get_security_from_env(
|
|
319
|
+
self.sdk_configuration.security, models.Security
|
|
320
|
+
),
|
|
321
|
+
),
|
|
291
322
|
request=req,
|
|
292
|
-
error_status_codes=["4XX","5XX"],
|
|
293
|
-
retry_config=retry_config
|
|
323
|
+
error_status_codes=["4XX", "5XX"],
|
|
324
|
+
retry_config=retry_config,
|
|
294
325
|
)
|
|
295
|
-
|
|
326
|
+
|
|
296
327
|
if utils.match_response(http_res, "200", "application/json"):
|
|
297
328
|
return utils.unmarshal_json(http_res.text, Optional[models.ListFilesOut])
|
|
298
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
299
|
-
raise models.SDKError(
|
|
300
|
-
|
|
329
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
330
|
+
raise models.SDKError(
|
|
331
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
332
|
+
)
|
|
333
|
+
|
|
301
334
|
content_type = http_res.headers.get("Content-Type")
|
|
302
|
-
raise models.SDKError(
|
|
335
|
+
raise models.SDKError(
|
|
336
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
337
|
+
http_res.status_code,
|
|
338
|
+
http_res.text,
|
|
339
|
+
http_res,
|
|
340
|
+
)
|
|
303
341
|
|
|
304
|
-
|
|
305
|
-
|
|
306
342
|
def retrieve(
|
|
307
|
-
self,
|
|
343
|
+
self,
|
|
344
|
+
*,
|
|
308
345
|
file_id: str,
|
|
309
346
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
310
347
|
server_url: Optional[str] = None,
|
|
@@ -314,7 +351,7 @@ class Files(BaseSDK):
|
|
|
314
351
|
|
|
315
352
|
Returns information about a specific file.
|
|
316
353
|
|
|
317
|
-
:param file_id:
|
|
354
|
+
:param file_id:
|
|
318
355
|
:param retries: Override the default retry configuration for this method
|
|
319
356
|
:param server_url: Override the default server URL for this method
|
|
320
357
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -323,14 +360,14 @@ class Files(BaseSDK):
|
|
|
323
360
|
url_variables = None
|
|
324
361
|
if timeout_ms is None:
|
|
325
362
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
326
|
-
|
|
363
|
+
|
|
327
364
|
if server_url is not None:
|
|
328
365
|
base_url = server_url
|
|
329
|
-
|
|
366
|
+
|
|
330
367
|
request = models.FilesAPIRoutesRetrieveFileRequest(
|
|
331
368
|
file_id=file_id,
|
|
332
369
|
)
|
|
333
|
-
|
|
370
|
+
|
|
334
371
|
req = self.build_request(
|
|
335
372
|
method="GET",
|
|
336
373
|
path="/v1/files/{file_id}",
|
|
@@ -345,40 +382,46 @@ class Files(BaseSDK):
|
|
|
345
382
|
security=self.sdk_configuration.security,
|
|
346
383
|
timeout_ms=timeout_ms,
|
|
347
384
|
)
|
|
348
|
-
|
|
385
|
+
|
|
349
386
|
if retries == UNSET:
|
|
350
387
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
351
388
|
retries = self.sdk_configuration.retry_config
|
|
352
389
|
|
|
353
390
|
retry_config = None
|
|
354
391
|
if isinstance(retries, utils.RetryConfig):
|
|
355
|
-
retry_config = (retries, [
|
|
356
|
-
|
|
357
|
-
"500",
|
|
358
|
-
"502",
|
|
359
|
-
"503",
|
|
360
|
-
"504"
|
|
361
|
-
])
|
|
362
|
-
|
|
392
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
393
|
+
|
|
363
394
|
http_res = self.do_request(
|
|
364
|
-
hook_ctx=HookContext(
|
|
395
|
+
hook_ctx=HookContext(
|
|
396
|
+
operation_id="files_api_routes_retrieve_file",
|
|
397
|
+
oauth2_scopes=[],
|
|
398
|
+
security_source=get_security_from_env(
|
|
399
|
+
self.sdk_configuration.security, models.Security
|
|
400
|
+
),
|
|
401
|
+
),
|
|
365
402
|
request=req,
|
|
366
|
-
error_status_codes=["4XX","5XX"],
|
|
367
|
-
retry_config=retry_config
|
|
403
|
+
error_status_codes=["4XX", "5XX"],
|
|
404
|
+
retry_config=retry_config,
|
|
368
405
|
)
|
|
369
|
-
|
|
406
|
+
|
|
370
407
|
if utils.match_response(http_res, "200", "application/json"):
|
|
371
408
|
return utils.unmarshal_json(http_res.text, Optional[models.RetrieveFileOut])
|
|
372
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
373
|
-
raise models.SDKError(
|
|
374
|
-
|
|
409
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
410
|
+
raise models.SDKError(
|
|
411
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
412
|
+
)
|
|
413
|
+
|
|
375
414
|
content_type = http_res.headers.get("Content-Type")
|
|
376
|
-
raise models.SDKError(
|
|
415
|
+
raise models.SDKError(
|
|
416
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
417
|
+
http_res.status_code,
|
|
418
|
+
http_res.text,
|
|
419
|
+
http_res,
|
|
420
|
+
)
|
|
377
421
|
|
|
378
|
-
|
|
379
|
-
|
|
380
422
|
async def retrieve_async(
|
|
381
|
-
self,
|
|
423
|
+
self,
|
|
424
|
+
*,
|
|
382
425
|
file_id: str,
|
|
383
426
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
384
427
|
server_url: Optional[str] = None,
|
|
@@ -388,7 +431,7 @@ class Files(BaseSDK):
|
|
|
388
431
|
|
|
389
432
|
Returns information about a specific file.
|
|
390
433
|
|
|
391
|
-
:param file_id:
|
|
434
|
+
:param file_id:
|
|
392
435
|
:param retries: Override the default retry configuration for this method
|
|
393
436
|
:param server_url: Override the default server URL for this method
|
|
394
437
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -397,15 +440,15 @@ class Files(BaseSDK):
|
|
|
397
440
|
url_variables = None
|
|
398
441
|
if timeout_ms is None:
|
|
399
442
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
400
|
-
|
|
443
|
+
|
|
401
444
|
if server_url is not None:
|
|
402
445
|
base_url = server_url
|
|
403
|
-
|
|
446
|
+
|
|
404
447
|
request = models.FilesAPIRoutesRetrieveFileRequest(
|
|
405
448
|
file_id=file_id,
|
|
406
449
|
)
|
|
407
|
-
|
|
408
|
-
req = self.
|
|
450
|
+
|
|
451
|
+
req = self.build_request_async(
|
|
409
452
|
method="GET",
|
|
410
453
|
path="/v1/files/{file_id}",
|
|
411
454
|
base_url=base_url,
|
|
@@ -419,40 +462,46 @@ class Files(BaseSDK):
|
|
|
419
462
|
security=self.sdk_configuration.security,
|
|
420
463
|
timeout_ms=timeout_ms,
|
|
421
464
|
)
|
|
422
|
-
|
|
465
|
+
|
|
423
466
|
if retries == UNSET:
|
|
424
467
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
425
468
|
retries = self.sdk_configuration.retry_config
|
|
426
469
|
|
|
427
470
|
retry_config = None
|
|
428
471
|
if isinstance(retries, utils.RetryConfig):
|
|
429
|
-
retry_config = (retries, [
|
|
430
|
-
|
|
431
|
-
"500",
|
|
432
|
-
"502",
|
|
433
|
-
"503",
|
|
434
|
-
"504"
|
|
435
|
-
])
|
|
436
|
-
|
|
472
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
473
|
+
|
|
437
474
|
http_res = await self.do_request_async(
|
|
438
|
-
hook_ctx=HookContext(
|
|
475
|
+
hook_ctx=HookContext(
|
|
476
|
+
operation_id="files_api_routes_retrieve_file",
|
|
477
|
+
oauth2_scopes=[],
|
|
478
|
+
security_source=get_security_from_env(
|
|
479
|
+
self.sdk_configuration.security, models.Security
|
|
480
|
+
),
|
|
481
|
+
),
|
|
439
482
|
request=req,
|
|
440
|
-
error_status_codes=["4XX","5XX"],
|
|
441
|
-
retry_config=retry_config
|
|
483
|
+
error_status_codes=["4XX", "5XX"],
|
|
484
|
+
retry_config=retry_config,
|
|
442
485
|
)
|
|
443
|
-
|
|
486
|
+
|
|
444
487
|
if utils.match_response(http_res, "200", "application/json"):
|
|
445
488
|
return utils.unmarshal_json(http_res.text, Optional[models.RetrieveFileOut])
|
|
446
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
447
|
-
raise models.SDKError(
|
|
448
|
-
|
|
489
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
490
|
+
raise models.SDKError(
|
|
491
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
492
|
+
)
|
|
493
|
+
|
|
449
494
|
content_type = http_res.headers.get("Content-Type")
|
|
450
|
-
raise models.SDKError(
|
|
495
|
+
raise models.SDKError(
|
|
496
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
497
|
+
http_res.status_code,
|
|
498
|
+
http_res.text,
|
|
499
|
+
http_res,
|
|
500
|
+
)
|
|
451
501
|
|
|
452
|
-
|
|
453
|
-
|
|
454
502
|
def delete(
|
|
455
|
-
self,
|
|
503
|
+
self,
|
|
504
|
+
*,
|
|
456
505
|
file_id: str,
|
|
457
506
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
458
507
|
server_url: Optional[str] = None,
|
|
@@ -462,7 +511,7 @@ class Files(BaseSDK):
|
|
|
462
511
|
|
|
463
512
|
Delete a file.
|
|
464
513
|
|
|
465
|
-
:param file_id:
|
|
514
|
+
:param file_id:
|
|
466
515
|
:param retries: Override the default retry configuration for this method
|
|
467
516
|
:param server_url: Override the default server URL for this method
|
|
468
517
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -471,14 +520,14 @@ class Files(BaseSDK):
|
|
|
471
520
|
url_variables = None
|
|
472
521
|
if timeout_ms is None:
|
|
473
522
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
474
|
-
|
|
523
|
+
|
|
475
524
|
if server_url is not None:
|
|
476
525
|
base_url = server_url
|
|
477
|
-
|
|
526
|
+
|
|
478
527
|
request = models.FilesAPIRoutesDeleteFileRequest(
|
|
479
528
|
file_id=file_id,
|
|
480
529
|
)
|
|
481
|
-
|
|
530
|
+
|
|
482
531
|
req = self.build_request(
|
|
483
532
|
method="DELETE",
|
|
484
533
|
path="/v1/files/{file_id}",
|
|
@@ -493,40 +542,46 @@ class Files(BaseSDK):
|
|
|
493
542
|
security=self.sdk_configuration.security,
|
|
494
543
|
timeout_ms=timeout_ms,
|
|
495
544
|
)
|
|
496
|
-
|
|
545
|
+
|
|
497
546
|
if retries == UNSET:
|
|
498
547
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
499
548
|
retries = self.sdk_configuration.retry_config
|
|
500
549
|
|
|
501
550
|
retry_config = None
|
|
502
551
|
if isinstance(retries, utils.RetryConfig):
|
|
503
|
-
retry_config = (retries, [
|
|
504
|
-
|
|
505
|
-
"500",
|
|
506
|
-
"502",
|
|
507
|
-
"503",
|
|
508
|
-
"504"
|
|
509
|
-
])
|
|
510
|
-
|
|
552
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
553
|
+
|
|
511
554
|
http_res = self.do_request(
|
|
512
|
-
hook_ctx=HookContext(
|
|
555
|
+
hook_ctx=HookContext(
|
|
556
|
+
operation_id="files_api_routes_delete_file",
|
|
557
|
+
oauth2_scopes=[],
|
|
558
|
+
security_source=get_security_from_env(
|
|
559
|
+
self.sdk_configuration.security, models.Security
|
|
560
|
+
),
|
|
561
|
+
),
|
|
513
562
|
request=req,
|
|
514
|
-
error_status_codes=["4XX","5XX"],
|
|
515
|
-
retry_config=retry_config
|
|
563
|
+
error_status_codes=["4XX", "5XX"],
|
|
564
|
+
retry_config=retry_config,
|
|
516
565
|
)
|
|
517
|
-
|
|
566
|
+
|
|
518
567
|
if utils.match_response(http_res, "200", "application/json"):
|
|
519
568
|
return utils.unmarshal_json(http_res.text, Optional[models.DeleteFileOut])
|
|
520
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
521
|
-
raise models.SDKError(
|
|
522
|
-
|
|
569
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
570
|
+
raise models.SDKError(
|
|
571
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
572
|
+
)
|
|
573
|
+
|
|
523
574
|
content_type = http_res.headers.get("Content-Type")
|
|
524
|
-
raise models.SDKError(
|
|
575
|
+
raise models.SDKError(
|
|
576
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
577
|
+
http_res.status_code,
|
|
578
|
+
http_res.text,
|
|
579
|
+
http_res,
|
|
580
|
+
)
|
|
525
581
|
|
|
526
|
-
|
|
527
|
-
|
|
528
582
|
async def delete_async(
|
|
529
|
-
self,
|
|
583
|
+
self,
|
|
584
|
+
*,
|
|
530
585
|
file_id: str,
|
|
531
586
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
532
587
|
server_url: Optional[str] = None,
|
|
@@ -536,7 +591,7 @@ class Files(BaseSDK):
|
|
|
536
591
|
|
|
537
592
|
Delete a file.
|
|
538
593
|
|
|
539
|
-
:param file_id:
|
|
594
|
+
:param file_id:
|
|
540
595
|
:param retries: Override the default retry configuration for this method
|
|
541
596
|
:param server_url: Override the default server URL for this method
|
|
542
597
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -545,15 +600,15 @@ class Files(BaseSDK):
|
|
|
545
600
|
url_variables = None
|
|
546
601
|
if timeout_ms is None:
|
|
547
602
|
timeout_ms = self.sdk_configuration.timeout_ms
|
|
548
|
-
|
|
603
|
+
|
|
549
604
|
if server_url is not None:
|
|
550
605
|
base_url = server_url
|
|
551
|
-
|
|
606
|
+
|
|
552
607
|
request = models.FilesAPIRoutesDeleteFileRequest(
|
|
553
608
|
file_id=file_id,
|
|
554
609
|
)
|
|
555
|
-
|
|
556
|
-
req = self.
|
|
610
|
+
|
|
611
|
+
req = self.build_request_async(
|
|
557
612
|
method="DELETE",
|
|
558
613
|
path="/v1/files/{file_id}",
|
|
559
614
|
base_url=base_url,
|
|
@@ -567,34 +622,39 @@ class Files(BaseSDK):
|
|
|
567
622
|
security=self.sdk_configuration.security,
|
|
568
623
|
timeout_ms=timeout_ms,
|
|
569
624
|
)
|
|
570
|
-
|
|
625
|
+
|
|
571
626
|
if retries == UNSET:
|
|
572
627
|
if self.sdk_configuration.retry_config is not UNSET:
|
|
573
628
|
retries = self.sdk_configuration.retry_config
|
|
574
629
|
|
|
575
630
|
retry_config = None
|
|
576
631
|
if isinstance(retries, utils.RetryConfig):
|
|
577
|
-
retry_config = (retries, [
|
|
578
|
-
|
|
579
|
-
"500",
|
|
580
|
-
"502",
|
|
581
|
-
"503",
|
|
582
|
-
"504"
|
|
583
|
-
])
|
|
584
|
-
|
|
632
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
633
|
+
|
|
585
634
|
http_res = await self.do_request_async(
|
|
586
|
-
hook_ctx=HookContext(
|
|
635
|
+
hook_ctx=HookContext(
|
|
636
|
+
operation_id="files_api_routes_delete_file",
|
|
637
|
+
oauth2_scopes=[],
|
|
638
|
+
security_source=get_security_from_env(
|
|
639
|
+
self.sdk_configuration.security, models.Security
|
|
640
|
+
),
|
|
641
|
+
),
|
|
587
642
|
request=req,
|
|
588
|
-
error_status_codes=["4XX","5XX"],
|
|
589
|
-
retry_config=retry_config
|
|
643
|
+
error_status_codes=["4XX", "5XX"],
|
|
644
|
+
retry_config=retry_config,
|
|
590
645
|
)
|
|
591
|
-
|
|
646
|
+
|
|
592
647
|
if utils.match_response(http_res, "200", "application/json"):
|
|
593
648
|
return utils.unmarshal_json(http_res.text, Optional[models.DeleteFileOut])
|
|
594
|
-
if utils.match_response(http_res, ["4XX","5XX"], "*"):
|
|
595
|
-
raise models.SDKError(
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
raise models.SDKError(f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, http_res.text, http_res)
|
|
649
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
650
|
+
raise models.SDKError(
|
|
651
|
+
"API error occurred", http_res.status_code, http_res.text, http_res
|
|
652
|
+
)
|
|
599
653
|
|
|
600
|
-
|
|
654
|
+
content_type = http_res.headers.get("Content-Type")
|
|
655
|
+
raise models.SDKError(
|
|
656
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
657
|
+
http_res.status_code,
|
|
658
|
+
http_res.text,
|
|
659
|
+
http_res,
|
|
660
|
+
)
|