mistralai 1.9.10__py3-none-any.whl → 1.10.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.
Files changed (86) hide show
  1. mistralai/_hooks/registration.py +5 -0
  2. mistralai/_hooks/tracing.py +50 -0
  3. mistralai/_version.py +3 -3
  4. mistralai/accesses.py +51 -116
  5. mistralai/agents.py +58 -85
  6. mistralai/audio.py +8 -3
  7. mistralai/basesdk.py +15 -5
  8. mistralai/batch.py +6 -3
  9. mistralai/beta.py +10 -5
  10. mistralai/chat.py +70 -97
  11. mistralai/classifiers.py +57 -144
  12. mistralai/conversations.py +435 -412
  13. mistralai/documents.py +156 -359
  14. mistralai/embeddings.py +21 -42
  15. mistralai/extra/observability/__init__.py +15 -0
  16. mistralai/extra/observability/otel.py +393 -0
  17. mistralai/extra/run/tools.py +28 -16
  18. mistralai/files.py +53 -176
  19. mistralai/fim.py +46 -73
  20. mistralai/fine_tuning.py +6 -3
  21. mistralai/jobs.py +49 -158
  22. mistralai/libraries.py +71 -178
  23. mistralai/mistral_agents.py +298 -179
  24. mistralai/mistral_jobs.py +51 -138
  25. mistralai/models/__init__.py +94 -5
  26. mistralai/models/agent.py +15 -2
  27. mistralai/models/agentconversation.py +11 -3
  28. mistralai/models/agentcreationrequest.py +6 -2
  29. mistralai/models/agents_api_v1_agents_deleteop.py +16 -0
  30. mistralai/models/agents_api_v1_agents_getop.py +40 -3
  31. mistralai/models/agents_api_v1_agents_listop.py +72 -2
  32. mistralai/models/agents_api_v1_conversations_deleteop.py +18 -0
  33. mistralai/models/agents_api_v1_conversations_listop.py +39 -2
  34. mistralai/models/agentscompletionrequest.py +21 -6
  35. mistralai/models/agentscompletionstreamrequest.py +21 -6
  36. mistralai/models/agentupdaterequest.py +18 -2
  37. mistralai/models/audiotranscriptionrequest.py +2 -0
  38. mistralai/models/batchjobin.py +10 -0
  39. mistralai/models/chatcompletionrequest.py +22 -5
  40. mistralai/models/chatcompletionstreamrequest.py +22 -5
  41. mistralai/models/conversationrequest.py +15 -4
  42. mistralai/models/conversationrestartrequest.py +50 -2
  43. mistralai/models/conversationrestartstreamrequest.py +50 -2
  44. mistralai/models/conversationstreamrequest.py +15 -4
  45. mistralai/models/documentout.py +26 -10
  46. mistralai/models/documentupdatein.py +24 -3
  47. mistralai/models/embeddingrequest.py +8 -8
  48. mistralai/models/files_api_routes_list_filesop.py +7 -0
  49. mistralai/models/fimcompletionrequest.py +8 -9
  50. mistralai/models/fimcompletionstreamrequest.py +8 -9
  51. mistralai/models/httpvalidationerror.py +11 -6
  52. mistralai/models/libraries_documents_list_v1op.py +15 -2
  53. mistralai/models/libraryout.py +10 -7
  54. mistralai/models/listfilesout.py +35 -4
  55. mistralai/models/mistralerror.py +26 -0
  56. mistralai/models/modelcapabilities.py +13 -4
  57. mistralai/models/modelconversation.py +8 -2
  58. mistralai/models/no_response_error.py +13 -0
  59. mistralai/models/ocrpageobject.py +26 -5
  60. mistralai/models/ocrrequest.py +17 -1
  61. mistralai/models/ocrtableobject.py +31 -0
  62. mistralai/models/prediction.py +4 -0
  63. mistralai/models/requestsource.py +7 -0
  64. mistralai/models/responseformat.py +4 -2
  65. mistralai/models/responseformats.py +0 -1
  66. mistralai/models/responsevalidationerror.py +25 -0
  67. mistralai/models/sdkerror.py +30 -14
  68. mistralai/models/sharingdelete.py +36 -5
  69. mistralai/models/sharingin.py +36 -5
  70. mistralai/models/sharingout.py +3 -3
  71. mistralai/models/toolexecutiondeltaevent.py +13 -4
  72. mistralai/models/toolexecutiondoneevent.py +13 -4
  73. mistralai/models/toolexecutionentry.py +9 -4
  74. mistralai/models/toolexecutionstartedevent.py +13 -4
  75. mistralai/models_.py +67 -212
  76. mistralai/ocr.py +33 -36
  77. mistralai/sdk.py +15 -2
  78. mistralai/transcriptions.py +21 -60
  79. mistralai/utils/__init__.py +18 -5
  80. mistralai/utils/eventstreaming.py +10 -0
  81. mistralai/utils/serializers.py +3 -2
  82. mistralai/utils/unmarshal_json_response.py +24 -0
  83. {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info}/METADATA +89 -40
  84. {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info}/RECORD +86 -75
  85. {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info}/WHEEL +1 -1
  86. {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info/licenses}/LICENSE +0 -0
@@ -5,7 +5,8 @@ from mistralai import models, utils
5
5
  from mistralai._hooks import HookContext
6
6
  from mistralai.types import OptionalNullable, UNSET
7
7
  from mistralai.utils import get_security_from_env
8
- from typing import Any, List, Mapping, Optional, Union
8
+ from mistralai.utils.unmarshal_json_response import unmarshal_json_response
9
+ from typing import Any, Dict, List, Mapping, Optional, Union
9
10
 
10
11
 
11
12
  class MistralAgents(BaseSDK):
@@ -28,6 +29,7 @@ class MistralAgents(BaseSDK):
28
29
  ] = None,
29
30
  description: OptionalNullable[str] = UNSET,
30
31
  handoffs: OptionalNullable[List[str]] = UNSET,
32
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET,
31
33
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
32
34
  server_url: Optional[str] = None,
33
35
  timeout_ms: Optional[int] = None,
@@ -44,6 +46,7 @@ class MistralAgents(BaseSDK):
44
46
  :param completion_args: White-listed arguments from the completion API
45
47
  :param description:
46
48
  :param handoffs:
49
+ :param metadata:
47
50
  :param retries: Override the default retry configuration for this method
48
51
  :param server_url: Override the default server URL for this method
49
52
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -71,6 +74,7 @@ class MistralAgents(BaseSDK):
71
74
  name=name,
72
75
  description=description,
73
76
  handoffs=handoffs,
77
+ metadata=metadata,
74
78
  )
75
79
 
76
80
  req = self._build_request(
@@ -117,31 +121,20 @@ class MistralAgents(BaseSDK):
117
121
 
118
122
  response_data: Any = None
119
123
  if utils.match_response(http_res, "200", "application/json"):
120
- return utils.unmarshal_json(http_res.text, models.Agent)
124
+ return unmarshal_json_response(models.Agent, http_res)
121
125
  if utils.match_response(http_res, "422", "application/json"):
122
- response_data = utils.unmarshal_json(
123
- http_res.text, models.HTTPValidationErrorData
126
+ response_data = unmarshal_json_response(
127
+ models.HTTPValidationErrorData, http_res
124
128
  )
125
- raise models.HTTPValidationError(data=response_data)
129
+ raise models.HTTPValidationError(response_data, http_res)
126
130
  if utils.match_response(http_res, "4XX", "*"):
127
131
  http_res_text = utils.stream_to_text(http_res)
128
- raise models.SDKError(
129
- "API error occurred", http_res.status_code, http_res_text, http_res
130
- )
132
+ raise models.SDKError("API error occurred", http_res, http_res_text)
131
133
  if utils.match_response(http_res, "5XX", "*"):
132
134
  http_res_text = utils.stream_to_text(http_res)
133
- raise models.SDKError(
134
- "API error occurred", http_res.status_code, http_res_text, http_res
135
- )
135
+ raise models.SDKError("API error occurred", http_res, http_res_text)
136
136
 
137
- content_type = http_res.headers.get("Content-Type")
138
- http_res_text = utils.stream_to_text(http_res)
139
- raise models.SDKError(
140
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
141
- http_res.status_code,
142
- http_res_text,
143
- http_res,
144
- )
137
+ raise models.SDKError("Unexpected response received", http_res)
145
138
 
146
139
  async def create_async(
147
140
  self,
@@ -160,6 +153,7 @@ class MistralAgents(BaseSDK):
160
153
  ] = None,
161
154
  description: OptionalNullable[str] = UNSET,
162
155
  handoffs: OptionalNullable[List[str]] = UNSET,
156
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET,
163
157
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
164
158
  server_url: Optional[str] = None,
165
159
  timeout_ms: Optional[int] = None,
@@ -176,6 +170,7 @@ class MistralAgents(BaseSDK):
176
170
  :param completion_args: White-listed arguments from the completion API
177
171
  :param description:
178
172
  :param handoffs:
173
+ :param metadata:
179
174
  :param retries: Override the default retry configuration for this method
180
175
  :param server_url: Override the default server URL for this method
181
176
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -203,6 +198,7 @@ class MistralAgents(BaseSDK):
203
198
  name=name,
204
199
  description=description,
205
200
  handoffs=handoffs,
201
+ metadata=metadata,
206
202
  )
207
203
 
208
204
  req = self._build_request_async(
@@ -249,37 +245,31 @@ class MistralAgents(BaseSDK):
249
245
 
250
246
  response_data: Any = None
251
247
  if utils.match_response(http_res, "200", "application/json"):
252
- return utils.unmarshal_json(http_res.text, models.Agent)
248
+ return unmarshal_json_response(models.Agent, http_res)
253
249
  if utils.match_response(http_res, "422", "application/json"):
254
- response_data = utils.unmarshal_json(
255
- http_res.text, models.HTTPValidationErrorData
250
+ response_data = unmarshal_json_response(
251
+ models.HTTPValidationErrorData, http_res
256
252
  )
257
- raise models.HTTPValidationError(data=response_data)
253
+ raise models.HTTPValidationError(response_data, http_res)
258
254
  if utils.match_response(http_res, "4XX", "*"):
259
255
  http_res_text = await utils.stream_to_text_async(http_res)
260
- raise models.SDKError(
261
- "API error occurred", http_res.status_code, http_res_text, http_res
262
- )
256
+ raise models.SDKError("API error occurred", http_res, http_res_text)
263
257
  if utils.match_response(http_res, "5XX", "*"):
264
258
  http_res_text = await utils.stream_to_text_async(http_res)
265
- raise models.SDKError(
266
- "API error occurred", http_res.status_code, http_res_text, http_res
267
- )
259
+ raise models.SDKError("API error occurred", http_res, http_res_text)
268
260
 
269
- content_type = http_res.headers.get("Content-Type")
270
- http_res_text = await utils.stream_to_text_async(http_res)
271
- raise models.SDKError(
272
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
273
- http_res.status_code,
274
- http_res_text,
275
- http_res,
276
- )
261
+ raise models.SDKError("Unexpected response received", http_res)
277
262
 
278
263
  def list(
279
264
  self,
280
265
  *,
281
266
  page: Optional[int] = 0,
282
267
  page_size: Optional[int] = 20,
268
+ deployment_chat: OptionalNullable[bool] = UNSET,
269
+ sources: OptionalNullable[List[models.RequestSource]] = UNSET,
270
+ name: OptionalNullable[str] = UNSET,
271
+ id: OptionalNullable[str] = UNSET,
272
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET,
283
273
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
284
274
  server_url: Optional[str] = None,
285
275
  timeout_ms: Optional[int] = None,
@@ -291,6 +281,11 @@ class MistralAgents(BaseSDK):
291
281
 
292
282
  :param page:
293
283
  :param page_size:
284
+ :param deployment_chat:
285
+ :param sources:
286
+ :param name:
287
+ :param id:
288
+ :param metadata:
294
289
  :param retries: Override the default retry configuration for this method
295
290
  :param server_url: Override the default server URL for this method
296
291
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -309,6 +304,11 @@ class MistralAgents(BaseSDK):
309
304
  request = models.AgentsAPIV1AgentsListRequest(
310
305
  page=page,
311
306
  page_size=page_size,
307
+ deployment_chat=deployment_chat,
308
+ sources=sources,
309
+ name=name,
310
+ id=id,
311
+ metadata=metadata,
312
312
  )
313
313
 
314
314
  req = self._build_request(
@@ -352,37 +352,31 @@ class MistralAgents(BaseSDK):
352
352
 
353
353
  response_data: Any = None
354
354
  if utils.match_response(http_res, "200", "application/json"):
355
- return utils.unmarshal_json(http_res.text, List[models.Agent])
355
+ return unmarshal_json_response(List[models.Agent], http_res)
356
356
  if utils.match_response(http_res, "422", "application/json"):
357
- response_data = utils.unmarshal_json(
358
- http_res.text, models.HTTPValidationErrorData
357
+ response_data = unmarshal_json_response(
358
+ models.HTTPValidationErrorData, http_res
359
359
  )
360
- raise models.HTTPValidationError(data=response_data)
360
+ raise models.HTTPValidationError(response_data, http_res)
361
361
  if utils.match_response(http_res, "4XX", "*"):
362
362
  http_res_text = utils.stream_to_text(http_res)
363
- raise models.SDKError(
364
- "API error occurred", http_res.status_code, http_res_text, http_res
365
- )
363
+ raise models.SDKError("API error occurred", http_res, http_res_text)
366
364
  if utils.match_response(http_res, "5XX", "*"):
367
365
  http_res_text = utils.stream_to_text(http_res)
368
- raise models.SDKError(
369
- "API error occurred", http_res.status_code, http_res_text, http_res
370
- )
366
+ raise models.SDKError("API error occurred", http_res, http_res_text)
371
367
 
372
- content_type = http_res.headers.get("Content-Type")
373
- http_res_text = utils.stream_to_text(http_res)
374
- raise models.SDKError(
375
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
376
- http_res.status_code,
377
- http_res_text,
378
- http_res,
379
- )
368
+ raise models.SDKError("Unexpected response received", http_res)
380
369
 
381
370
  async def list_async(
382
371
  self,
383
372
  *,
384
373
  page: Optional[int] = 0,
385
374
  page_size: Optional[int] = 20,
375
+ deployment_chat: OptionalNullable[bool] = UNSET,
376
+ sources: OptionalNullable[List[models.RequestSource]] = UNSET,
377
+ name: OptionalNullable[str] = UNSET,
378
+ id: OptionalNullable[str] = UNSET,
379
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET,
386
380
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
387
381
  server_url: Optional[str] = None,
388
382
  timeout_ms: Optional[int] = None,
@@ -394,6 +388,11 @@ class MistralAgents(BaseSDK):
394
388
 
395
389
  :param page:
396
390
  :param page_size:
391
+ :param deployment_chat:
392
+ :param sources:
393
+ :param name:
394
+ :param id:
395
+ :param metadata:
397
396
  :param retries: Override the default retry configuration for this method
398
397
  :param server_url: Override the default server URL for this method
399
398
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -412,6 +411,11 @@ class MistralAgents(BaseSDK):
412
411
  request = models.AgentsAPIV1AgentsListRequest(
413
412
  page=page,
414
413
  page_size=page_size,
414
+ deployment_chat=deployment_chat,
415
+ sources=sources,
416
+ name=name,
417
+ id=id,
418
+ metadata=metadata,
415
419
  )
416
420
 
417
421
  req = self._build_request_async(
@@ -455,36 +459,26 @@ class MistralAgents(BaseSDK):
455
459
 
456
460
  response_data: Any = None
457
461
  if utils.match_response(http_res, "200", "application/json"):
458
- return utils.unmarshal_json(http_res.text, List[models.Agent])
462
+ return unmarshal_json_response(List[models.Agent], http_res)
459
463
  if utils.match_response(http_res, "422", "application/json"):
460
- response_data = utils.unmarshal_json(
461
- http_res.text, models.HTTPValidationErrorData
464
+ response_data = unmarshal_json_response(
465
+ models.HTTPValidationErrorData, http_res
462
466
  )
463
- raise models.HTTPValidationError(data=response_data)
467
+ raise models.HTTPValidationError(response_data, http_res)
464
468
  if utils.match_response(http_res, "4XX", "*"):
465
469
  http_res_text = await utils.stream_to_text_async(http_res)
466
- raise models.SDKError(
467
- "API error occurred", http_res.status_code, http_res_text, http_res
468
- )
470
+ raise models.SDKError("API error occurred", http_res, http_res_text)
469
471
  if utils.match_response(http_res, "5XX", "*"):
470
472
  http_res_text = await utils.stream_to_text_async(http_res)
471
- raise models.SDKError(
472
- "API error occurred", http_res.status_code, http_res_text, http_res
473
- )
473
+ raise models.SDKError("API error occurred", http_res, http_res_text)
474
474
 
475
- content_type = http_res.headers.get("Content-Type")
476
- http_res_text = await utils.stream_to_text_async(http_res)
477
- raise models.SDKError(
478
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
479
- http_res.status_code,
480
- http_res_text,
481
- http_res,
482
- )
475
+ raise models.SDKError("Unexpected response received", http_res)
483
476
 
484
477
  def get(
485
478
  self,
486
479
  *,
487
480
  agent_id: str,
481
+ agent_version: OptionalNullable[int] = UNSET,
488
482
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
489
483
  server_url: Optional[str] = None,
490
484
  timeout_ms: Optional[int] = None,
@@ -495,6 +489,7 @@ class MistralAgents(BaseSDK):
495
489
  Given an agent retrieve an agent entity with its attributes.
496
490
 
497
491
  :param agent_id:
492
+ :param agent_version:
498
493
  :param retries: Override the default retry configuration for this method
499
494
  :param server_url: Override the default server URL for this method
500
495
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -512,6 +507,7 @@ class MistralAgents(BaseSDK):
512
507
 
513
508
  request = models.AgentsAPIV1AgentsGetRequest(
514
509
  agent_id=agent_id,
510
+ agent_version=agent_version,
515
511
  )
516
512
 
517
513
  req = self._build_request(
@@ -555,36 +551,26 @@ class MistralAgents(BaseSDK):
555
551
 
556
552
  response_data: Any = None
557
553
  if utils.match_response(http_res, "200", "application/json"):
558
- return utils.unmarshal_json(http_res.text, models.Agent)
554
+ return unmarshal_json_response(models.Agent, http_res)
559
555
  if utils.match_response(http_res, "422", "application/json"):
560
- response_data = utils.unmarshal_json(
561
- http_res.text, models.HTTPValidationErrorData
556
+ response_data = unmarshal_json_response(
557
+ models.HTTPValidationErrorData, http_res
562
558
  )
563
- raise models.HTTPValidationError(data=response_data)
559
+ raise models.HTTPValidationError(response_data, http_res)
564
560
  if utils.match_response(http_res, "4XX", "*"):
565
561
  http_res_text = utils.stream_to_text(http_res)
566
- raise models.SDKError(
567
- "API error occurred", http_res.status_code, http_res_text, http_res
568
- )
562
+ raise models.SDKError("API error occurred", http_res, http_res_text)
569
563
  if utils.match_response(http_res, "5XX", "*"):
570
564
  http_res_text = utils.stream_to_text(http_res)
571
- raise models.SDKError(
572
- "API error occurred", http_res.status_code, http_res_text, http_res
573
- )
565
+ raise models.SDKError("API error occurred", http_res, http_res_text)
574
566
 
575
- content_type = http_res.headers.get("Content-Type")
576
- http_res_text = utils.stream_to_text(http_res)
577
- raise models.SDKError(
578
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
579
- http_res.status_code,
580
- http_res_text,
581
- http_res,
582
- )
567
+ raise models.SDKError("Unexpected response received", http_res)
583
568
 
584
569
  async def get_async(
585
570
  self,
586
571
  *,
587
572
  agent_id: str,
573
+ agent_version: OptionalNullable[int] = UNSET,
588
574
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
589
575
  server_url: Optional[str] = None,
590
576
  timeout_ms: Optional[int] = None,
@@ -595,6 +581,7 @@ class MistralAgents(BaseSDK):
595
581
  Given an agent retrieve an agent entity with its attributes.
596
582
 
597
583
  :param agent_id:
584
+ :param agent_version:
598
585
  :param retries: Override the default retry configuration for this method
599
586
  :param server_url: Override the default server URL for this method
600
587
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -612,6 +599,7 @@ class MistralAgents(BaseSDK):
612
599
 
613
600
  request = models.AgentsAPIV1AgentsGetRequest(
614
601
  agent_id=agent_id,
602
+ agent_version=agent_version,
615
603
  )
616
604
 
617
605
  req = self._build_request_async(
@@ -655,31 +643,20 @@ class MistralAgents(BaseSDK):
655
643
 
656
644
  response_data: Any = None
657
645
  if utils.match_response(http_res, "200", "application/json"):
658
- return utils.unmarshal_json(http_res.text, models.Agent)
646
+ return unmarshal_json_response(models.Agent, http_res)
659
647
  if utils.match_response(http_res, "422", "application/json"):
660
- response_data = utils.unmarshal_json(
661
- http_res.text, models.HTTPValidationErrorData
648
+ response_data = unmarshal_json_response(
649
+ models.HTTPValidationErrorData, http_res
662
650
  )
663
- raise models.HTTPValidationError(data=response_data)
651
+ raise models.HTTPValidationError(response_data, http_res)
664
652
  if utils.match_response(http_res, "4XX", "*"):
665
653
  http_res_text = await utils.stream_to_text_async(http_res)
666
- raise models.SDKError(
667
- "API error occurred", http_res.status_code, http_res_text, http_res
668
- )
654
+ raise models.SDKError("API error occurred", http_res, http_res_text)
669
655
  if utils.match_response(http_res, "5XX", "*"):
670
656
  http_res_text = await utils.stream_to_text_async(http_res)
671
- raise models.SDKError(
672
- "API error occurred", http_res.status_code, http_res_text, http_res
673
- )
657
+ raise models.SDKError("API error occurred", http_res, http_res_text)
674
658
 
675
- content_type = http_res.headers.get("Content-Type")
676
- http_res_text = await utils.stream_to_text_async(http_res)
677
- raise models.SDKError(
678
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
679
- http_res.status_code,
680
- http_res_text,
681
- http_res,
682
- )
659
+ raise models.SDKError("Unexpected response received", http_res)
683
660
 
684
661
  def update(
685
662
  self,
@@ -699,6 +676,8 @@ class MistralAgents(BaseSDK):
699
676
  name: OptionalNullable[str] = UNSET,
700
677
  description: OptionalNullable[str] = UNSET,
701
678
  handoffs: OptionalNullable[List[str]] = UNSET,
679
+ deployment_chat: OptionalNullable[bool] = UNSET,
680
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET,
702
681
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
703
682
  server_url: Optional[str] = None,
704
683
  timeout_ms: Optional[int] = None,
@@ -716,6 +695,8 @@ class MistralAgents(BaseSDK):
716
695
  :param name:
717
696
  :param description:
718
697
  :param handoffs:
698
+ :param deployment_chat:
699
+ :param metadata:
719
700
  :param retries: Override the default retry configuration for this method
720
701
  :param server_url: Override the default server URL for this method
721
702
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -745,6 +726,8 @@ class MistralAgents(BaseSDK):
745
726
  name=name,
746
727
  description=description,
747
728
  handoffs=handoffs,
729
+ deployment_chat=deployment_chat,
730
+ metadata=metadata,
748
731
  ),
749
732
  )
750
733
 
@@ -796,31 +779,20 @@ class MistralAgents(BaseSDK):
796
779
 
797
780
  response_data: Any = None
798
781
  if utils.match_response(http_res, "200", "application/json"):
799
- return utils.unmarshal_json(http_res.text, models.Agent)
782
+ return unmarshal_json_response(models.Agent, http_res)
800
783
  if utils.match_response(http_res, "422", "application/json"):
801
- response_data = utils.unmarshal_json(
802
- http_res.text, models.HTTPValidationErrorData
784
+ response_data = unmarshal_json_response(
785
+ models.HTTPValidationErrorData, http_res
803
786
  )
804
- raise models.HTTPValidationError(data=response_data)
787
+ raise models.HTTPValidationError(response_data, http_res)
805
788
  if utils.match_response(http_res, "4XX", "*"):
806
789
  http_res_text = utils.stream_to_text(http_res)
807
- raise models.SDKError(
808
- "API error occurred", http_res.status_code, http_res_text, http_res
809
- )
790
+ raise models.SDKError("API error occurred", http_res, http_res_text)
810
791
  if utils.match_response(http_res, "5XX", "*"):
811
792
  http_res_text = utils.stream_to_text(http_res)
812
- raise models.SDKError(
813
- "API error occurred", http_res.status_code, http_res_text, http_res
814
- )
793
+ raise models.SDKError("API error occurred", http_res, http_res_text)
815
794
 
816
- content_type = http_res.headers.get("Content-Type")
817
- http_res_text = utils.stream_to_text(http_res)
818
- raise models.SDKError(
819
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
820
- http_res.status_code,
821
- http_res_text,
822
- http_res,
823
- )
795
+ raise models.SDKError("Unexpected response received", http_res)
824
796
 
825
797
  async def update_async(
826
798
  self,
@@ -840,6 +812,8 @@ class MistralAgents(BaseSDK):
840
812
  name: OptionalNullable[str] = UNSET,
841
813
  description: OptionalNullable[str] = UNSET,
842
814
  handoffs: OptionalNullable[List[str]] = UNSET,
815
+ deployment_chat: OptionalNullable[bool] = UNSET,
816
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET,
843
817
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
844
818
  server_url: Optional[str] = None,
845
819
  timeout_ms: Optional[int] = None,
@@ -857,6 +831,8 @@ class MistralAgents(BaseSDK):
857
831
  :param name:
858
832
  :param description:
859
833
  :param handoffs:
834
+ :param deployment_chat:
835
+ :param metadata:
860
836
  :param retries: Override the default retry configuration for this method
861
837
  :param server_url: Override the default server URL for this method
862
838
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -886,6 +862,8 @@ class MistralAgents(BaseSDK):
886
862
  name=name,
887
863
  description=description,
888
864
  handoffs=handoffs,
865
+ deployment_chat=deployment_chat,
866
+ metadata=metadata,
889
867
  ),
890
868
  )
891
869
 
@@ -937,32 +915,195 @@ class MistralAgents(BaseSDK):
937
915
 
938
916
  response_data: Any = None
939
917
  if utils.match_response(http_res, "200", "application/json"):
940
- return utils.unmarshal_json(http_res.text, models.Agent)
918
+ return unmarshal_json_response(models.Agent, http_res)
941
919
  if utils.match_response(http_res, "422", "application/json"):
942
- response_data = utils.unmarshal_json(
943
- http_res.text, models.HTTPValidationErrorData
920
+ response_data = unmarshal_json_response(
921
+ models.HTTPValidationErrorData, http_res
944
922
  )
945
- raise models.HTTPValidationError(data=response_data)
923
+ raise models.HTTPValidationError(response_data, http_res)
946
924
  if utils.match_response(http_res, "4XX", "*"):
947
925
  http_res_text = await utils.stream_to_text_async(http_res)
948
- raise models.SDKError(
949
- "API error occurred", http_res.status_code, http_res_text, http_res
950
- )
926
+ raise models.SDKError("API error occurred", http_res, http_res_text)
951
927
  if utils.match_response(http_res, "5XX", "*"):
952
928
  http_res_text = await utils.stream_to_text_async(http_res)
953
- raise models.SDKError(
954
- "API error occurred", http_res.status_code, http_res_text, http_res
929
+ raise models.SDKError("API error occurred", http_res, http_res_text)
930
+
931
+ raise models.SDKError("Unexpected response received", http_res)
932
+
933
+ def delete(
934
+ self,
935
+ *,
936
+ agent_id: str,
937
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
938
+ server_url: Optional[str] = None,
939
+ timeout_ms: Optional[int] = None,
940
+ http_headers: Optional[Mapping[str, str]] = None,
941
+ ):
942
+ r"""Delete an agent entity.
943
+
944
+ :param agent_id:
945
+ :param retries: Override the default retry configuration for this method
946
+ :param server_url: Override the default server URL for this method
947
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
948
+ :param http_headers: Additional headers to set or replace on requests.
949
+ """
950
+ base_url = None
951
+ url_variables = None
952
+ if timeout_ms is None:
953
+ timeout_ms = self.sdk_configuration.timeout_ms
954
+
955
+ if server_url is not None:
956
+ base_url = server_url
957
+ else:
958
+ base_url = self._get_url(base_url, url_variables)
959
+
960
+ request = models.AgentsAPIV1AgentsDeleteRequest(
961
+ agent_id=agent_id,
962
+ )
963
+
964
+ req = self._build_request(
965
+ method="DELETE",
966
+ path="/v1/agents/{agent_id}",
967
+ base_url=base_url,
968
+ url_variables=url_variables,
969
+ request=request,
970
+ request_body_required=False,
971
+ request_has_path_params=True,
972
+ request_has_query_params=True,
973
+ user_agent_header="user-agent",
974
+ accept_header_value="application/json",
975
+ http_headers=http_headers,
976
+ security=self.sdk_configuration.security,
977
+ timeout_ms=timeout_ms,
978
+ )
979
+
980
+ if retries == UNSET:
981
+ if self.sdk_configuration.retry_config is not UNSET:
982
+ retries = self.sdk_configuration.retry_config
983
+
984
+ retry_config = None
985
+ if isinstance(retries, utils.RetryConfig):
986
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
987
+
988
+ http_res = self.do_request(
989
+ hook_ctx=HookContext(
990
+ config=self.sdk_configuration,
991
+ base_url=base_url or "",
992
+ operation_id="agents_api_v1_agents_delete",
993
+ oauth2_scopes=[],
994
+ security_source=get_security_from_env(
995
+ self.sdk_configuration.security, models.Security
996
+ ),
997
+ ),
998
+ request=req,
999
+ error_status_codes=["422", "4XX", "5XX"],
1000
+ retry_config=retry_config,
1001
+ )
1002
+
1003
+ response_data: Any = None
1004
+ if utils.match_response(http_res, "204", "*"):
1005
+ return
1006
+ if utils.match_response(http_res, "422", "application/json"):
1007
+ response_data = unmarshal_json_response(
1008
+ models.HTTPValidationErrorData, http_res
955
1009
  )
1010
+ raise models.HTTPValidationError(response_data, http_res)
1011
+ if utils.match_response(http_res, "4XX", "*"):
1012
+ http_res_text = utils.stream_to_text(http_res)
1013
+ raise models.SDKError("API error occurred", http_res, http_res_text)
1014
+ if utils.match_response(http_res, "5XX", "*"):
1015
+ http_res_text = utils.stream_to_text(http_res)
1016
+ raise models.SDKError("API error occurred", http_res, http_res_text)
1017
+
1018
+ raise models.SDKError("Unexpected response received", http_res)
956
1019
 
957
- content_type = http_res.headers.get("Content-Type")
958
- http_res_text = await utils.stream_to_text_async(http_res)
959
- raise models.SDKError(
960
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
961
- http_res.status_code,
962
- http_res_text,
963
- http_res,
1020
+ async def delete_async(
1021
+ self,
1022
+ *,
1023
+ agent_id: str,
1024
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1025
+ server_url: Optional[str] = None,
1026
+ timeout_ms: Optional[int] = None,
1027
+ http_headers: Optional[Mapping[str, str]] = None,
1028
+ ):
1029
+ r"""Delete an agent entity.
1030
+
1031
+ :param agent_id:
1032
+ :param retries: Override the default retry configuration for this method
1033
+ :param server_url: Override the default server URL for this method
1034
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1035
+ :param http_headers: Additional headers to set or replace on requests.
1036
+ """
1037
+ base_url = None
1038
+ url_variables = None
1039
+ if timeout_ms is None:
1040
+ timeout_ms = self.sdk_configuration.timeout_ms
1041
+
1042
+ if server_url is not None:
1043
+ base_url = server_url
1044
+ else:
1045
+ base_url = self._get_url(base_url, url_variables)
1046
+
1047
+ request = models.AgentsAPIV1AgentsDeleteRequest(
1048
+ agent_id=agent_id,
964
1049
  )
965
1050
 
1051
+ req = self._build_request_async(
1052
+ method="DELETE",
1053
+ path="/v1/agents/{agent_id}",
1054
+ base_url=base_url,
1055
+ url_variables=url_variables,
1056
+ request=request,
1057
+ request_body_required=False,
1058
+ request_has_path_params=True,
1059
+ request_has_query_params=True,
1060
+ user_agent_header="user-agent",
1061
+ accept_header_value="application/json",
1062
+ http_headers=http_headers,
1063
+ security=self.sdk_configuration.security,
1064
+ timeout_ms=timeout_ms,
1065
+ )
1066
+
1067
+ if retries == UNSET:
1068
+ if self.sdk_configuration.retry_config is not UNSET:
1069
+ retries = self.sdk_configuration.retry_config
1070
+
1071
+ retry_config = None
1072
+ if isinstance(retries, utils.RetryConfig):
1073
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1074
+
1075
+ http_res = await self.do_request_async(
1076
+ hook_ctx=HookContext(
1077
+ config=self.sdk_configuration,
1078
+ base_url=base_url or "",
1079
+ operation_id="agents_api_v1_agents_delete",
1080
+ oauth2_scopes=[],
1081
+ security_source=get_security_from_env(
1082
+ self.sdk_configuration.security, models.Security
1083
+ ),
1084
+ ),
1085
+ request=req,
1086
+ error_status_codes=["422", "4XX", "5XX"],
1087
+ retry_config=retry_config,
1088
+ )
1089
+
1090
+ response_data: Any = None
1091
+ if utils.match_response(http_res, "204", "*"):
1092
+ return
1093
+ if utils.match_response(http_res, "422", "application/json"):
1094
+ response_data = unmarshal_json_response(
1095
+ models.HTTPValidationErrorData, http_res
1096
+ )
1097
+ raise models.HTTPValidationError(response_data, http_res)
1098
+ if utils.match_response(http_res, "4XX", "*"):
1099
+ http_res_text = await utils.stream_to_text_async(http_res)
1100
+ raise models.SDKError("API error occurred", http_res, http_res_text)
1101
+ if utils.match_response(http_res, "5XX", "*"):
1102
+ http_res_text = await utils.stream_to_text_async(http_res)
1103
+ raise models.SDKError("API error occurred", http_res, http_res_text)
1104
+
1105
+ raise models.SDKError("Unexpected response received", http_res)
1106
+
966
1107
  def update_version(
967
1108
  self,
968
1109
  *,
@@ -1040,31 +1181,20 @@ class MistralAgents(BaseSDK):
1040
1181
 
1041
1182
  response_data: Any = None
1042
1183
  if utils.match_response(http_res, "200", "application/json"):
1043
- return utils.unmarshal_json(http_res.text, models.Agent)
1184
+ return unmarshal_json_response(models.Agent, http_res)
1044
1185
  if utils.match_response(http_res, "422", "application/json"):
1045
- response_data = utils.unmarshal_json(
1046
- http_res.text, models.HTTPValidationErrorData
1186
+ response_data = unmarshal_json_response(
1187
+ models.HTTPValidationErrorData, http_res
1047
1188
  )
1048
- raise models.HTTPValidationError(data=response_data)
1189
+ raise models.HTTPValidationError(response_data, http_res)
1049
1190
  if utils.match_response(http_res, "4XX", "*"):
1050
1191
  http_res_text = utils.stream_to_text(http_res)
1051
- raise models.SDKError(
1052
- "API error occurred", http_res.status_code, http_res_text, http_res
1053
- )
1192
+ raise models.SDKError("API error occurred", http_res, http_res_text)
1054
1193
  if utils.match_response(http_res, "5XX", "*"):
1055
1194
  http_res_text = utils.stream_to_text(http_res)
1056
- raise models.SDKError(
1057
- "API error occurred", http_res.status_code, http_res_text, http_res
1058
- )
1195
+ raise models.SDKError("API error occurred", http_res, http_res_text)
1059
1196
 
1060
- content_type = http_res.headers.get("Content-Type")
1061
- http_res_text = utils.stream_to_text(http_res)
1062
- raise models.SDKError(
1063
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1064
- http_res.status_code,
1065
- http_res_text,
1066
- http_res,
1067
- )
1197
+ raise models.SDKError("Unexpected response received", http_res)
1068
1198
 
1069
1199
  async def update_version_async(
1070
1200
  self,
@@ -1143,28 +1273,17 @@ class MistralAgents(BaseSDK):
1143
1273
 
1144
1274
  response_data: Any = None
1145
1275
  if utils.match_response(http_res, "200", "application/json"):
1146
- return utils.unmarshal_json(http_res.text, models.Agent)
1276
+ return unmarshal_json_response(models.Agent, http_res)
1147
1277
  if utils.match_response(http_res, "422", "application/json"):
1148
- response_data = utils.unmarshal_json(
1149
- http_res.text, models.HTTPValidationErrorData
1278
+ response_data = unmarshal_json_response(
1279
+ models.HTTPValidationErrorData, http_res
1150
1280
  )
1151
- raise models.HTTPValidationError(data=response_data)
1281
+ raise models.HTTPValidationError(response_data, http_res)
1152
1282
  if utils.match_response(http_res, "4XX", "*"):
1153
1283
  http_res_text = await utils.stream_to_text_async(http_res)
1154
- raise models.SDKError(
1155
- "API error occurred", http_res.status_code, http_res_text, http_res
1156
- )
1284
+ raise models.SDKError("API error occurred", http_res, http_res_text)
1157
1285
  if utils.match_response(http_res, "5XX", "*"):
1158
1286
  http_res_text = await utils.stream_to_text_async(http_res)
1159
- raise models.SDKError(
1160
- "API error occurred", http_res.status_code, http_res_text, http_res
1161
- )
1287
+ raise models.SDKError("API error occurred", http_res, http_res_text)
1162
1288
 
1163
- content_type = http_res.headers.get("Content-Type")
1164
- http_res_text = await utils.stream_to_text_async(http_res)
1165
- raise models.SDKError(
1166
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1167
- http_res.status_code,
1168
- http_res_text,
1169
- http_res,
1170
- )
1289
+ raise models.SDKError("Unexpected response received", http_res)