mistralai 1.9.1__py3-none-any.whl → 1.9.3__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.
Files changed (85) hide show
  1. mistralai/_version.py +2 -2
  2. mistralai/accesses.py +672 -0
  3. mistralai/audio.py +18 -0
  4. mistralai/beta.py +4 -0
  5. mistralai/documents.py +2136 -0
  6. mistralai/files.py +2 -2
  7. mistralai/libraries.py +1041 -0
  8. mistralai/mistral_jobs.py +14 -2
  9. mistralai/models/__init__.py +360 -9
  10. mistralai/models/audiochunk.py +20 -0
  11. mistralai/models/audiotranscriptionrequest.py +97 -0
  12. mistralai/models/audiotranscriptionrequeststream.py +97 -0
  13. mistralai/models/basemodelcard.py +5 -2
  14. mistralai/models/batchjobin.py +7 -4
  15. mistralai/models/batchjobout.py +10 -3
  16. mistralai/models/classifierftmodelout.py +6 -0
  17. mistralai/models/completionargs.py +3 -2
  18. mistralai/models/completionftmodelout.py +6 -0
  19. mistralai/models/contentchunk.py +6 -0
  20. mistralai/models/conversationevents.py +6 -0
  21. mistralai/models/conversationhistory.py +4 -4
  22. mistralai/models/documentout.py +105 -0
  23. mistralai/models/documenttextcontent.py +13 -0
  24. mistralai/models/documentupdatein.py +44 -0
  25. mistralai/models/entitytype.py +9 -0
  26. mistralai/models/file.py +33 -0
  27. mistralai/models/files_api_routes_upload_fileop.py +2 -27
  28. mistralai/models/fileschema.py +8 -2
  29. mistralai/models/ftmodelcard.py +5 -3
  30. mistralai/models/inputentries.py +4 -4
  31. mistralai/models/jobs_api_routes_batch_get_batch_jobsop.py +8 -1
  32. mistralai/models/libraries_delete_v1op.py +16 -0
  33. mistralai/models/libraries_documents_delete_v1op.py +21 -0
  34. mistralai/models/libraries_documents_get_extracted_text_signed_url_v1op.py +21 -0
  35. mistralai/models/libraries_documents_get_signed_url_v1op.py +21 -0
  36. mistralai/models/libraries_documents_get_status_v1op.py +21 -0
  37. mistralai/models/libraries_documents_get_text_content_v1op.py +21 -0
  38. mistralai/models/libraries_documents_get_v1op.py +21 -0
  39. mistralai/models/libraries_documents_list_v1op.py +78 -0
  40. mistralai/models/libraries_documents_reprocess_v1op.py +21 -0
  41. mistralai/models/libraries_documents_update_v1op.py +28 -0
  42. mistralai/models/libraries_documents_upload_v1op.py +56 -0
  43. mistralai/models/libraries_get_v1op.py +16 -0
  44. mistralai/models/libraries_share_create_v1op.py +22 -0
  45. mistralai/models/libraries_share_delete_v1op.py +23 -0
  46. mistralai/models/libraries_share_list_v1op.py +16 -0
  47. mistralai/models/libraries_update_v1op.py +23 -0
  48. mistralai/models/libraryin.py +50 -0
  49. mistralai/models/libraryinupdate.py +47 -0
  50. mistralai/models/libraryout.py +107 -0
  51. mistralai/models/listdocumentout.py +19 -0
  52. mistralai/models/listlibraryout.py +15 -0
  53. mistralai/models/listsharingout.py +15 -0
  54. mistralai/models/messageinputentry.py +14 -4
  55. mistralai/models/paginationinfo.py +25 -0
  56. mistralai/models/processingstatusout.py +16 -0
  57. mistralai/models/retrievefileout.py +8 -2
  58. mistralai/models/shareenum.py +8 -0
  59. mistralai/models/sharingdelete.py +26 -0
  60. mistralai/models/sharingin.py +30 -0
  61. mistralai/models/sharingout.py +59 -0
  62. mistralai/models/ssetypes.py +1 -0
  63. mistralai/models/thinkchunk.py +35 -0
  64. mistralai/models/timestampgranularity.py +7 -0
  65. mistralai/models/toolcall.py +43 -1
  66. mistralai/models/toolexecutiondeltaevent.py +34 -0
  67. mistralai/models/toolexecutionentry.py +3 -0
  68. mistralai/models/toolexecutionstartedevent.py +3 -0
  69. mistralai/models/toolreferencechunk.py +7 -4
  70. mistralai/models/transcriptionresponse.py +79 -0
  71. mistralai/models/transcriptionsegmentchunk.py +41 -0
  72. mistralai/models/transcriptionstreamdone.py +85 -0
  73. mistralai/models/transcriptionstreamevents.py +58 -0
  74. mistralai/models/transcriptionstreameventtypes.py +12 -0
  75. mistralai/models/transcriptionstreamlanguage.py +35 -0
  76. mistralai/models/transcriptionstreamsegmentdelta.py +41 -0
  77. mistralai/models/transcriptionstreamtextdelta.py +35 -0
  78. mistralai/models/uploadfileout.py +8 -2
  79. mistralai/models/usageinfo.py +65 -8
  80. mistralai/sdk.py +3 -0
  81. mistralai/transcriptions.py +480 -0
  82. {mistralai-1.9.1.dist-info → mistralai-1.9.3.dist-info}/METADATA +37 -2
  83. {mistralai-1.9.1.dist-info → mistralai-1.9.3.dist-info}/RECORD +85 -33
  84. {mistralai-1.9.1.dist-info → mistralai-1.9.3.dist-info}/LICENSE +0 -0
  85. {mistralai-1.9.1.dist-info → mistralai-1.9.3.dist-info}/WHEEL +0 -0
@@ -0,0 +1,480 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from mistralai import models, utils
5
+ from mistralai._hooks import HookContext
6
+ from mistralai.types import OptionalNullable, UNSET
7
+ from mistralai.utils import eventstreaming, get_security_from_env
8
+ from typing import List, Mapping, Optional, Union
9
+
10
+
11
+ class Transcriptions(BaseSDK):
12
+ r"""API for audio transcription."""
13
+
14
+ def complete(
15
+ self,
16
+ *,
17
+ model: str,
18
+ file: Optional[Union[models.File, models.FileTypedDict]] = None,
19
+ file_url: OptionalNullable[str] = UNSET,
20
+ file_id: OptionalNullable[str] = UNSET,
21
+ language: OptionalNullable[str] = UNSET,
22
+ temperature: OptionalNullable[float] = UNSET,
23
+ timestamp_granularities: Optional[List[models.TimestampGranularity]] = None,
24
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
25
+ server_url: Optional[str] = None,
26
+ timeout_ms: Optional[int] = None,
27
+ http_headers: Optional[Mapping[str, str]] = None,
28
+ ) -> models.TranscriptionResponse:
29
+ r"""Create Transcription
30
+
31
+ :param model:
32
+ :param file:
33
+ :param file_url: Url of a file to be transcribed
34
+ :param file_id: ID of a file uploaded to /v1/files
35
+ :param language: Language of the audio, e.g. 'en'. Providing the language can boost accuracy.
36
+ :param temperature:
37
+ :param timestamp_granularities: Granularities of timestamps to include in the response.
38
+ :param retries: Override the default retry configuration for this method
39
+ :param server_url: Override the default server URL for this method
40
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
41
+ :param http_headers: Additional headers to set or replace on requests.
42
+ """
43
+ base_url = None
44
+ url_variables = None
45
+ if timeout_ms is None:
46
+ timeout_ms = self.sdk_configuration.timeout_ms
47
+
48
+ if server_url is not None:
49
+ base_url = server_url
50
+ else:
51
+ base_url = self._get_url(base_url, url_variables)
52
+
53
+ request = models.AudioTranscriptionRequest(
54
+ model=model,
55
+ file=utils.get_pydantic_model(file, Optional[models.File]),
56
+ file_url=file_url,
57
+ file_id=file_id,
58
+ language=language,
59
+ temperature=temperature,
60
+ timestamp_granularities=timestamp_granularities,
61
+ )
62
+
63
+ req = self._build_request(
64
+ method="POST",
65
+ path="/v1/audio/transcriptions",
66
+ base_url=base_url,
67
+ url_variables=url_variables,
68
+ request=request,
69
+ request_body_required=True,
70
+ request_has_path_params=False,
71
+ request_has_query_params=True,
72
+ user_agent_header="user-agent",
73
+ accept_header_value="application/json",
74
+ http_headers=http_headers,
75
+ security=self.sdk_configuration.security,
76
+ get_serialized_body=lambda: utils.serialize_request_body(
77
+ request, False, False, "multipart", models.AudioTranscriptionRequest
78
+ ),
79
+ timeout_ms=timeout_ms,
80
+ )
81
+
82
+ if retries == UNSET:
83
+ if self.sdk_configuration.retry_config is not UNSET:
84
+ retries = self.sdk_configuration.retry_config
85
+
86
+ retry_config = None
87
+ if isinstance(retries, utils.RetryConfig):
88
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
89
+
90
+ http_res = self.do_request(
91
+ hook_ctx=HookContext(
92
+ config=self.sdk_configuration,
93
+ base_url=base_url or "",
94
+ operation_id="audio_api_v1_transcriptions_post",
95
+ oauth2_scopes=[],
96
+ security_source=get_security_from_env(
97
+ self.sdk_configuration.security, models.Security
98
+ ),
99
+ ),
100
+ request=req,
101
+ error_status_codes=["4XX", "5XX"],
102
+ retry_config=retry_config,
103
+ )
104
+
105
+ if utils.match_response(http_res, "200", "application/json"):
106
+ return utils.unmarshal_json(http_res.text, models.TranscriptionResponse)
107
+ if utils.match_response(http_res, "4XX", "*"):
108
+ http_res_text = utils.stream_to_text(http_res)
109
+ raise models.SDKError(
110
+ "API error occurred", http_res.status_code, http_res_text, http_res
111
+ )
112
+ if utils.match_response(http_res, "5XX", "*"):
113
+ http_res_text = utils.stream_to_text(http_res)
114
+ raise models.SDKError(
115
+ "API error occurred", http_res.status_code, http_res_text, http_res
116
+ )
117
+
118
+ content_type = http_res.headers.get("Content-Type")
119
+ http_res_text = utils.stream_to_text(http_res)
120
+ raise models.SDKError(
121
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
122
+ http_res.status_code,
123
+ http_res_text,
124
+ http_res,
125
+ )
126
+
127
+ async def complete_async(
128
+ self,
129
+ *,
130
+ model: str,
131
+ file: Optional[Union[models.File, models.FileTypedDict]] = None,
132
+ file_url: OptionalNullable[str] = UNSET,
133
+ file_id: OptionalNullable[str] = UNSET,
134
+ language: OptionalNullable[str] = UNSET,
135
+ temperature: OptionalNullable[float] = UNSET,
136
+ timestamp_granularities: Optional[List[models.TimestampGranularity]] = None,
137
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
138
+ server_url: Optional[str] = None,
139
+ timeout_ms: Optional[int] = None,
140
+ http_headers: Optional[Mapping[str, str]] = None,
141
+ ) -> models.TranscriptionResponse:
142
+ r"""Create Transcription
143
+
144
+ :param model:
145
+ :param file:
146
+ :param file_url: Url of a file to be transcribed
147
+ :param file_id: ID of a file uploaded to /v1/files
148
+ :param language: Language of the audio, e.g. 'en'. Providing the language can boost accuracy.
149
+ :param temperature:
150
+ :param timestamp_granularities: Granularities of timestamps to include in the response.
151
+ :param retries: Override the default retry configuration for this method
152
+ :param server_url: Override the default server URL for this method
153
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
154
+ :param http_headers: Additional headers to set or replace on requests.
155
+ """
156
+ base_url = None
157
+ url_variables = None
158
+ if timeout_ms is None:
159
+ timeout_ms = self.sdk_configuration.timeout_ms
160
+
161
+ if server_url is not None:
162
+ base_url = server_url
163
+ else:
164
+ base_url = self._get_url(base_url, url_variables)
165
+
166
+ request = models.AudioTranscriptionRequest(
167
+ model=model,
168
+ file=utils.get_pydantic_model(file, Optional[models.File]),
169
+ file_url=file_url,
170
+ file_id=file_id,
171
+ language=language,
172
+ temperature=temperature,
173
+ timestamp_granularities=timestamp_granularities,
174
+ )
175
+
176
+ req = self._build_request_async(
177
+ method="POST",
178
+ path="/v1/audio/transcriptions",
179
+ base_url=base_url,
180
+ url_variables=url_variables,
181
+ request=request,
182
+ request_body_required=True,
183
+ request_has_path_params=False,
184
+ request_has_query_params=True,
185
+ user_agent_header="user-agent",
186
+ accept_header_value="application/json",
187
+ http_headers=http_headers,
188
+ security=self.sdk_configuration.security,
189
+ get_serialized_body=lambda: utils.serialize_request_body(
190
+ request, False, False, "multipart", models.AudioTranscriptionRequest
191
+ ),
192
+ timeout_ms=timeout_ms,
193
+ )
194
+
195
+ if retries == UNSET:
196
+ if self.sdk_configuration.retry_config is not UNSET:
197
+ retries = self.sdk_configuration.retry_config
198
+
199
+ retry_config = None
200
+ if isinstance(retries, utils.RetryConfig):
201
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
202
+
203
+ http_res = await self.do_request_async(
204
+ hook_ctx=HookContext(
205
+ config=self.sdk_configuration,
206
+ base_url=base_url or "",
207
+ operation_id="audio_api_v1_transcriptions_post",
208
+ oauth2_scopes=[],
209
+ security_source=get_security_from_env(
210
+ self.sdk_configuration.security, models.Security
211
+ ),
212
+ ),
213
+ request=req,
214
+ error_status_codes=["4XX", "5XX"],
215
+ retry_config=retry_config,
216
+ )
217
+
218
+ if utils.match_response(http_res, "200", "application/json"):
219
+ return utils.unmarshal_json(http_res.text, models.TranscriptionResponse)
220
+ if utils.match_response(http_res, "4XX", "*"):
221
+ http_res_text = await utils.stream_to_text_async(http_res)
222
+ raise models.SDKError(
223
+ "API error occurred", http_res.status_code, http_res_text, http_res
224
+ )
225
+ if utils.match_response(http_res, "5XX", "*"):
226
+ http_res_text = await utils.stream_to_text_async(http_res)
227
+ raise models.SDKError(
228
+ "API error occurred", http_res.status_code, http_res_text, http_res
229
+ )
230
+
231
+ content_type = http_res.headers.get("Content-Type")
232
+ http_res_text = await utils.stream_to_text_async(http_res)
233
+ raise models.SDKError(
234
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
235
+ http_res.status_code,
236
+ http_res_text,
237
+ http_res,
238
+ )
239
+
240
+ def stream(
241
+ self,
242
+ *,
243
+ model: str,
244
+ file: Optional[Union[models.File, models.FileTypedDict]] = None,
245
+ file_url: OptionalNullable[str] = UNSET,
246
+ file_id: OptionalNullable[str] = UNSET,
247
+ language: OptionalNullable[str] = UNSET,
248
+ temperature: OptionalNullable[float] = UNSET,
249
+ timestamp_granularities: Optional[List[models.TimestampGranularity]] = None,
250
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
251
+ server_url: Optional[str] = None,
252
+ timeout_ms: Optional[int] = None,
253
+ http_headers: Optional[Mapping[str, str]] = None,
254
+ ) -> eventstreaming.EventStream[models.TranscriptionStreamEvents]:
255
+ r"""Create streaming transcription (SSE)
256
+
257
+ :param model:
258
+ :param file:
259
+ :param file_url: Url of a file to be transcribed
260
+ :param file_id: ID of a file uploaded to /v1/files
261
+ :param language: Language of the audio, e.g. 'en'. Providing the language can boost accuracy.
262
+ :param temperature:
263
+ :param timestamp_granularities: Granularities of timestamps to include in the response.
264
+ :param retries: Override the default retry configuration for this method
265
+ :param server_url: Override the default server URL for this method
266
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
267
+ :param http_headers: Additional headers to set or replace on requests.
268
+ """
269
+ base_url = None
270
+ url_variables = None
271
+ if timeout_ms is None:
272
+ timeout_ms = self.sdk_configuration.timeout_ms
273
+
274
+ if server_url is not None:
275
+ base_url = server_url
276
+ else:
277
+ base_url = self._get_url(base_url, url_variables)
278
+
279
+ request = models.AudioTranscriptionRequestStream(
280
+ model=model,
281
+ file=utils.get_pydantic_model(file, Optional[models.File]),
282
+ file_url=file_url,
283
+ file_id=file_id,
284
+ language=language,
285
+ temperature=temperature,
286
+ timestamp_granularities=timestamp_granularities,
287
+ )
288
+
289
+ req = self._build_request(
290
+ method="POST",
291
+ path="/v1/audio/transcriptions#stream",
292
+ base_url=base_url,
293
+ url_variables=url_variables,
294
+ request=request,
295
+ request_body_required=True,
296
+ request_has_path_params=False,
297
+ request_has_query_params=True,
298
+ user_agent_header="user-agent",
299
+ accept_header_value="text/event-stream",
300
+ http_headers=http_headers,
301
+ security=self.sdk_configuration.security,
302
+ get_serialized_body=lambda: utils.serialize_request_body(
303
+ request,
304
+ False,
305
+ False,
306
+ "multipart",
307
+ models.AudioTranscriptionRequestStream,
308
+ ),
309
+ timeout_ms=timeout_ms,
310
+ )
311
+
312
+ if retries == UNSET:
313
+ if self.sdk_configuration.retry_config is not UNSET:
314
+ retries = self.sdk_configuration.retry_config
315
+
316
+ retry_config = None
317
+ if isinstance(retries, utils.RetryConfig):
318
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
319
+
320
+ http_res = self.do_request(
321
+ hook_ctx=HookContext(
322
+ config=self.sdk_configuration,
323
+ base_url=base_url or "",
324
+ operation_id="audio_api_v1_transcriptions_post_stream",
325
+ oauth2_scopes=[],
326
+ security_source=get_security_from_env(
327
+ self.sdk_configuration.security, models.Security
328
+ ),
329
+ ),
330
+ request=req,
331
+ error_status_codes=["4XX", "5XX"],
332
+ stream=True,
333
+ retry_config=retry_config,
334
+ )
335
+
336
+ if utils.match_response(http_res, "200", "text/event-stream"):
337
+ return eventstreaming.EventStream(
338
+ http_res,
339
+ lambda raw: utils.unmarshal_json(raw, models.TranscriptionStreamEvents),
340
+ )
341
+ if utils.match_response(http_res, "4XX", "*"):
342
+ http_res_text = utils.stream_to_text(http_res)
343
+ raise models.SDKError(
344
+ "API error occurred", http_res.status_code, http_res_text, http_res
345
+ )
346
+ if utils.match_response(http_res, "5XX", "*"):
347
+ http_res_text = utils.stream_to_text(http_res)
348
+ raise models.SDKError(
349
+ "API error occurred", http_res.status_code, http_res_text, http_res
350
+ )
351
+
352
+ content_type = http_res.headers.get("Content-Type")
353
+ http_res_text = utils.stream_to_text(http_res)
354
+ raise models.SDKError(
355
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
356
+ http_res.status_code,
357
+ http_res_text,
358
+ http_res,
359
+ )
360
+
361
+ async def stream_async(
362
+ self,
363
+ *,
364
+ model: str,
365
+ file: Optional[Union[models.File, models.FileTypedDict]] = None,
366
+ file_url: OptionalNullable[str] = UNSET,
367
+ file_id: OptionalNullable[str] = UNSET,
368
+ language: OptionalNullable[str] = UNSET,
369
+ temperature: OptionalNullable[float] = UNSET,
370
+ timestamp_granularities: Optional[List[models.TimestampGranularity]] = None,
371
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
372
+ server_url: Optional[str] = None,
373
+ timeout_ms: Optional[int] = None,
374
+ http_headers: Optional[Mapping[str, str]] = None,
375
+ ) -> eventstreaming.EventStreamAsync[models.TranscriptionStreamEvents]:
376
+ r"""Create streaming transcription (SSE)
377
+
378
+ :param model:
379
+ :param file:
380
+ :param file_url: Url of a file to be transcribed
381
+ :param file_id: ID of a file uploaded to /v1/files
382
+ :param language: Language of the audio, e.g. 'en'. Providing the language can boost accuracy.
383
+ :param temperature:
384
+ :param timestamp_granularities: Granularities of timestamps to include in the response.
385
+ :param retries: Override the default retry configuration for this method
386
+ :param server_url: Override the default server URL for this method
387
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
388
+ :param http_headers: Additional headers to set or replace on requests.
389
+ """
390
+ base_url = None
391
+ url_variables = None
392
+ if timeout_ms is None:
393
+ timeout_ms = self.sdk_configuration.timeout_ms
394
+
395
+ if server_url is not None:
396
+ base_url = server_url
397
+ else:
398
+ base_url = self._get_url(base_url, url_variables)
399
+
400
+ request = models.AudioTranscriptionRequestStream(
401
+ model=model,
402
+ file=utils.get_pydantic_model(file, Optional[models.File]),
403
+ file_url=file_url,
404
+ file_id=file_id,
405
+ language=language,
406
+ temperature=temperature,
407
+ timestamp_granularities=timestamp_granularities,
408
+ )
409
+
410
+ req = self._build_request_async(
411
+ method="POST",
412
+ path="/v1/audio/transcriptions#stream",
413
+ base_url=base_url,
414
+ url_variables=url_variables,
415
+ request=request,
416
+ request_body_required=True,
417
+ request_has_path_params=False,
418
+ request_has_query_params=True,
419
+ user_agent_header="user-agent",
420
+ accept_header_value="text/event-stream",
421
+ http_headers=http_headers,
422
+ security=self.sdk_configuration.security,
423
+ get_serialized_body=lambda: utils.serialize_request_body(
424
+ request,
425
+ False,
426
+ False,
427
+ "multipart",
428
+ models.AudioTranscriptionRequestStream,
429
+ ),
430
+ timeout_ms=timeout_ms,
431
+ )
432
+
433
+ if retries == UNSET:
434
+ if self.sdk_configuration.retry_config is not UNSET:
435
+ retries = self.sdk_configuration.retry_config
436
+
437
+ retry_config = None
438
+ if isinstance(retries, utils.RetryConfig):
439
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
440
+
441
+ http_res = await self.do_request_async(
442
+ hook_ctx=HookContext(
443
+ config=self.sdk_configuration,
444
+ base_url=base_url or "",
445
+ operation_id="audio_api_v1_transcriptions_post_stream",
446
+ oauth2_scopes=[],
447
+ security_source=get_security_from_env(
448
+ self.sdk_configuration.security, models.Security
449
+ ),
450
+ ),
451
+ request=req,
452
+ error_status_codes=["4XX", "5XX"],
453
+ stream=True,
454
+ retry_config=retry_config,
455
+ )
456
+
457
+ if utils.match_response(http_res, "200", "text/event-stream"):
458
+ return eventstreaming.EventStreamAsync(
459
+ http_res,
460
+ lambda raw: utils.unmarshal_json(raw, models.TranscriptionStreamEvents),
461
+ )
462
+ if utils.match_response(http_res, "4XX", "*"):
463
+ http_res_text = await utils.stream_to_text_async(http_res)
464
+ raise models.SDKError(
465
+ "API error occurred", http_res.status_code, http_res_text, http_res
466
+ )
467
+ if utils.match_response(http_res, "5XX", "*"):
468
+ http_res_text = await utils.stream_to_text_async(http_res)
469
+ raise models.SDKError(
470
+ "API error occurred", http_res.status_code, http_res_text, http_res
471
+ )
472
+
473
+ content_type = http_res.headers.get("Content-Type")
474
+ http_res_text = await utils.stream_to_text_async(http_res)
475
+ raise models.SDKError(
476
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
477
+ http_res.status_code,
478
+ http_res_text,
479
+ http_res,
480
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mistralai
3
- Version: 1.9.1
3
+ Version: 1.9.3
4
4
  Summary: Python Client SDK for the Mistral AI API.
5
5
  Author: Mistral
6
6
  Requires-Python: >=3.9
@@ -461,6 +461,14 @@ The documentation for the GCP SDK is available [here](https://github.com/mistral
461
461
  * [complete](https://github.com/mistralai/client-python/blob/master/docs/sdks/agents/README.md#complete) - Agents Completion
462
462
  * [stream](https://github.com/mistralai/client-python/blob/master/docs/sdks/agents/README.md#stream) - Stream Agents completion
463
463
 
464
+ ### [audio](https://github.com/mistralai/client-python/blob/master/docs/sdks/audio/README.md)
465
+
466
+
467
+ #### [audio.transcriptions](https://github.com/mistralai/client-python/blob/master/docs/sdks/transcriptions/README.md)
468
+
469
+ * [complete](https://github.com/mistralai/client-python/blob/master/docs/sdks/transcriptions/README.md#complete) - Create Transcription
470
+ * [stream](https://github.com/mistralai/client-python/blob/master/docs/sdks/transcriptions/README.md#stream) - Create streaming transcription (SSE)
471
+
464
472
  ### [batch](https://github.com/mistralai/client-python/blob/master/docs/sdks/batch/README.md)
465
473
 
466
474
 
@@ -495,6 +503,33 @@ The documentation for the GCP SDK is available [here](https://github.com/mistral
495
503
  * [append_stream](https://github.com/mistralai/client-python/blob/master/docs/sdks/conversations/README.md#append_stream) - Append new entries to an existing conversation.
496
504
  * [restart_stream](https://github.com/mistralai/client-python/blob/master/docs/sdks/conversations/README.md#restart_stream) - Restart a conversation starting from a given entry.
497
505
 
506
+ #### [beta.libraries](https://github.com/mistralai/client-python/blob/master/docs/sdks/libraries/README.md)
507
+
508
+ * [list](https://github.com/mistralai/client-python/blob/master/docs/sdks/libraries/README.md#list) - List all libraries you have access to.
509
+ * [create](https://github.com/mistralai/client-python/blob/master/docs/sdks/libraries/README.md#create) - Create a new Library.
510
+ * [get](https://github.com/mistralai/client-python/blob/master/docs/sdks/libraries/README.md#get) - Detailed information about a specific Library.
511
+ * [delete](https://github.com/mistralai/client-python/blob/master/docs/sdks/libraries/README.md#delete) - Delete a library and all of it's document.
512
+ * [update](https://github.com/mistralai/client-python/blob/master/docs/sdks/libraries/README.md#update) - Update a library.
513
+
514
+ #### [beta.libraries.accesses](https://github.com/mistralai/client-python/blob/master/docs/sdks/accesses/README.md)
515
+
516
+ * [list](https://github.com/mistralai/client-python/blob/master/docs/sdks/accesses/README.md#list) - List all of the access to this library.
517
+ * [update_or_create](https://github.com/mistralai/client-python/blob/master/docs/sdks/accesses/README.md#update_or_create) - Create or update an access level.
518
+ * [delete](https://github.com/mistralai/client-python/blob/master/docs/sdks/accesses/README.md#delete) - Delete an access level.
519
+
520
+ #### [beta.libraries.documents](https://github.com/mistralai/client-python/blob/master/docs/sdks/documents/README.md)
521
+
522
+ * [list](https://github.com/mistralai/client-python/blob/master/docs/sdks/documents/README.md#list) - List document in a given library.
523
+ * [upload](https://github.com/mistralai/client-python/blob/master/docs/sdks/documents/README.md#upload) - Upload a new document.
524
+ * [get](https://github.com/mistralai/client-python/blob/master/docs/sdks/documents/README.md#get) - Retrieve the metadata of a specific document.
525
+ * [update](https://github.com/mistralai/client-python/blob/master/docs/sdks/documents/README.md#update) - Update the metadata of a specific document.
526
+ * [delete](https://github.com/mistralai/client-python/blob/master/docs/sdks/documents/README.md#delete) - Delete a document.
527
+ * [text_content](https://github.com/mistralai/client-python/blob/master/docs/sdks/documents/README.md#text_content) - Retrieve the text content of a specific document.
528
+ * [status](https://github.com/mistralai/client-python/blob/master/docs/sdks/documents/README.md#status) - Retrieve the processing status of a specific document.
529
+ * [get_signed_url](https://github.com/mistralai/client-python/blob/master/docs/sdks/documents/README.md#get_signed_url) - Retrieve the signed URL of a specific document.
530
+ * [extracted_text_signed_url](https://github.com/mistralai/client-python/blob/master/docs/sdks/documents/README.md#extracted_text_signed_url) - Retrieve the signed URL of text extracted from a given document.
531
+ * [reprocess](https://github.com/mistralai/client-python/blob/master/docs/sdks/documents/README.md#reprocess) - Reprocess a document.
532
+
498
533
  ### [chat](https://github.com/mistralai/client-python/blob/master/docs/sdks/chat/README.md)
499
534
 
500
535
  * [complete](https://github.com/mistralai/client-python/blob/master/docs/sdks/chat/README.md#complete) - Chat Completion
@@ -614,7 +649,7 @@ with Mistral(
614
649
  api_key=os.getenv("MISTRAL_API_KEY", ""),
615
650
  ) as mistral:
616
651
 
617
- res = mistral.files.upload(file={
652
+ res = mistral.beta.libraries.documents.upload(library_id="a02150d9-5ee0-4877-b62c-28b1fcdf3b76", file={
618
653
  "file_name": "example.file",
619
654
  "content": open("example.file", "rb"),
620
655
  })