mistralai 1.0.0rc1__py3-none-any.whl → 1.0.1__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 (114) hide show
  1. mistralai/agents.py +434 -0
  2. mistralai/basesdk.py +43 -6
  3. mistralai/chat.py +29 -34
  4. mistralai/client.py +1 -1
  5. mistralai/embeddings.py +4 -4
  6. mistralai/files.py +10 -10
  7. mistralai/fim.py +17 -18
  8. mistralai/fine_tuning.py +10 -849
  9. mistralai/jobs.py +844 -0
  10. mistralai/models/__init__.py +6 -4
  11. mistralai/models/agentscompletionrequest.py +96 -0
  12. mistralai/models/agentscompletionstreamrequest.py +92 -0
  13. mistralai/models/assistantmessage.py +4 -9
  14. mistralai/models/chatcompletionchoice.py +4 -15
  15. mistralai/models/chatcompletionrequest.py +25 -30
  16. mistralai/models/chatcompletionstreamrequest.py +25 -30
  17. mistralai/models/completionresponsestreamchoice.py +4 -9
  18. mistralai/models/delete_model_v1_models_model_id_deleteop.py +2 -0
  19. mistralai/models/deltamessage.py +7 -12
  20. mistralai/models/detailedjobout.py +4 -9
  21. mistralai/models/embeddingrequest.py +12 -17
  22. mistralai/models/eventout.py +4 -9
  23. mistralai/models/fileschema.py +4 -9
  24. mistralai/models/fimcompletionrequest.py +19 -24
  25. mistralai/models/fimcompletionstreamrequest.py +19 -24
  26. mistralai/models/ftmodelout.py +4 -9
  27. mistralai/models/functioncall.py +9 -3
  28. mistralai/models/githubrepositoryin.py +4 -9
  29. mistralai/models/githubrepositoryout.py +4 -9
  30. mistralai/models/httpvalidationerror.py +1 -1
  31. mistralai/models/jobin.py +4 -9
  32. mistralai/models/jobmetadataout.py +4 -9
  33. mistralai/models/jobout.py +4 -9
  34. mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +2 -0
  35. mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +1 -59
  36. mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +4 -9
  37. mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +2 -0
  38. mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +2 -0
  39. mistralai/models/legacyjobmetadataout.py +4 -9
  40. mistralai/models/metricout.py +4 -9
  41. mistralai/models/modelcard.py +4 -9
  42. mistralai/models/retrieve_model_v1_models_model_id_getop.py +2 -0
  43. mistralai/models/retrievefileout.py +4 -9
  44. mistralai/models/security.py +4 -4
  45. mistralai/models/systemmessage.py +6 -6
  46. mistralai/models/toolmessage.py +4 -9
  47. mistralai/models/trainingparameters.py +4 -9
  48. mistralai/models/trainingparametersin.py +4 -9
  49. mistralai/models/updateftmodelin.py +4 -9
  50. mistralai/models/uploadfileout.py +4 -9
  51. mistralai/models/usermessage.py +6 -6
  52. mistralai/models/validationerror.py +6 -6
  53. mistralai/models/wandbintegration.py +4 -9
  54. mistralai/models/wandbintegrationout.py +4 -9
  55. mistralai/models_.py +24 -24
  56. mistralai/sdk.py +14 -6
  57. mistralai/sdkconfiguration.py +5 -4
  58. mistralai/types/basemodel.py +10 -6
  59. mistralai/utils/__init__.py +4 -0
  60. mistralai/utils/eventstreaming.py +8 -9
  61. mistralai/utils/logger.py +16 -0
  62. mistralai/utils/retries.py +2 -2
  63. mistralai/utils/security.py +5 -2
  64. {mistralai-1.0.0rc1.dist-info → mistralai-1.0.1.dist-info}/METADATA +153 -69
  65. {mistralai-1.0.0rc1.dist-info → mistralai-1.0.1.dist-info}/RECORD +114 -107
  66. mistralai_azure/basesdk.py +42 -4
  67. mistralai_azure/chat.py +15 -20
  68. mistralai_azure/models/__init__.py +3 -3
  69. mistralai_azure/models/assistantmessage.py +4 -9
  70. mistralai_azure/models/chatcompletionchoice.py +4 -15
  71. mistralai_azure/models/chatcompletionrequest.py +21 -26
  72. mistralai_azure/models/chatcompletionstreamrequest.py +21 -26
  73. mistralai_azure/models/completionresponsestreamchoice.py +4 -9
  74. mistralai_azure/models/deltamessage.py +7 -12
  75. mistralai_azure/models/functioncall.py +9 -3
  76. mistralai_azure/models/httpvalidationerror.py +1 -1
  77. mistralai_azure/models/systemmessage.py +6 -6
  78. mistralai_azure/models/toolmessage.py +4 -9
  79. mistralai_azure/models/usermessage.py +6 -6
  80. mistralai_azure/models/validationerror.py +6 -6
  81. mistralai_azure/sdk.py +7 -2
  82. mistralai_azure/sdkconfiguration.py +5 -4
  83. mistralai_azure/types/basemodel.py +10 -6
  84. mistralai_azure/utils/__init__.py +4 -0
  85. mistralai_azure/utils/eventstreaming.py +8 -9
  86. mistralai_azure/utils/logger.py +16 -0
  87. mistralai_azure/utils/retries.py +2 -2
  88. mistralai_gcp/basesdk.py +42 -4
  89. mistralai_gcp/chat.py +12 -17
  90. mistralai_gcp/fim.py +12 -13
  91. mistralai_gcp/models/__init__.py +3 -3
  92. mistralai_gcp/models/assistantmessage.py +4 -9
  93. mistralai_gcp/models/chatcompletionchoice.py +4 -15
  94. mistralai_gcp/models/chatcompletionrequest.py +23 -28
  95. mistralai_gcp/models/chatcompletionstreamrequest.py +23 -28
  96. mistralai_gcp/models/completionresponsestreamchoice.py +4 -9
  97. mistralai_gcp/models/deltamessage.py +7 -12
  98. mistralai_gcp/models/fimcompletionrequest.py +19 -24
  99. mistralai_gcp/models/fimcompletionstreamrequest.py +19 -24
  100. mistralai_gcp/models/functioncall.py +9 -3
  101. mistralai_gcp/models/httpvalidationerror.py +1 -1
  102. mistralai_gcp/models/systemmessage.py +6 -6
  103. mistralai_gcp/models/toolmessage.py +4 -9
  104. mistralai_gcp/models/usermessage.py +6 -6
  105. mistralai_gcp/models/validationerror.py +6 -6
  106. mistralai_gcp/sdk.py +9 -0
  107. mistralai_gcp/sdkconfiguration.py +5 -4
  108. mistralai_gcp/types/basemodel.py +10 -6
  109. mistralai_gcp/utils/__init__.py +4 -0
  110. mistralai_gcp/utils/eventstreaming.py +8 -9
  111. mistralai_gcp/utils/logger.py +16 -0
  112. mistralai_gcp/utils/retries.py +2 -2
  113. {mistralai-1.0.0rc1.dist-info → mistralai-1.0.1.dist-info}/LICENSE +0 -0
  114. {mistralai-1.0.0rc1.dist-info → mistralai-1.0.1.dist-info}/WHEEL +0 -0
@@ -57,18 +57,13 @@ class RetrieveFileOut(BaseModel):
57
57
  k = f.alias or n
58
58
  val = serialized.get(k)
59
59
 
60
+ optional_nullable = k in optional_fields and k in nullable_fields
61
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
62
+
60
63
  if val is not None and val != UNSET_SENTINEL:
61
64
  m[k] = val
62
65
  elif val != UNSET_SENTINEL and (
63
- not k in optional_fields
64
- or (
65
- k in optional_fields
66
- and k in nullable_fields
67
- and (
68
- self.__pydantic_fields_set__.intersection({n})
69
- or k in null_default_fields
70
- ) # pylint: disable=no-member
71
- )
66
+ not k in optional_fields or (optional_nullable and is_set)
72
67
  ):
73
68
  m[k] = val
74
69
 
@@ -3,14 +3,14 @@
3
3
  from __future__ import annotations
4
4
  from mistralai.types import BaseModel
5
5
  from mistralai.utils import FieldMetadata, SecurityMetadata
6
- from typing import TypedDict
7
- from typing_extensions import Annotated
6
+ from typing import Optional, TypedDict
7
+ from typing_extensions import Annotated, NotRequired
8
8
 
9
9
 
10
10
  class SecurityTypedDict(TypedDict):
11
- api_key: str
11
+ api_key: NotRequired[str]
12
12
 
13
13
 
14
14
  class Security(BaseModel):
15
- api_key: Annotated[str, FieldMetadata(security=SecurityMetadata(scheme=True, scheme_type="http", sub_type="bearer", field_name="Authorization"))]
15
+ api_key: Annotated[Optional[str], FieldMetadata(security=SecurityMetadata(scheme=True, scheme_type="http", sub_type="bearer", field_name="Authorization"))] = None
16
16
 
@@ -7,6 +7,12 @@ from typing import List, Literal, Optional, TypedDict, Union
7
7
  from typing_extensions import NotRequired
8
8
 
9
9
 
10
+ ContentTypedDict = Union[str, List[ContentChunkTypedDict]]
11
+
12
+
13
+ Content = Union[str, List[ContentChunk]]
14
+
15
+
10
16
  Role = Literal["system"]
11
17
 
12
18
  class SystemMessageTypedDict(TypedDict):
@@ -18,9 +24,3 @@ class SystemMessage(BaseModel):
18
24
  content: Content
19
25
  role: Optional[Role] = "system"
20
26
 
21
-
22
- ContentTypedDict = Union[str, List[ContentChunkTypedDict]]
23
-
24
-
25
- Content = Union[str, List[ContentChunk]]
26
-
@@ -36,18 +36,13 @@ class ToolMessage(BaseModel):
36
36
  k = f.alias or n
37
37
  val = serialized.get(k)
38
38
 
39
+ optional_nullable = k in optional_fields and k in nullable_fields
40
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
41
+
39
42
  if val is not None and val != UNSET_SENTINEL:
40
43
  m[k] = val
41
44
  elif val != UNSET_SENTINEL and (
42
- not k in optional_fields
43
- or (
44
- k in optional_fields
45
- and k in nullable_fields
46
- and (
47
- self.__pydantic_fields_set__.intersection({n})
48
- or k in null_default_fields
49
- ) # pylint: disable=no-member
50
- )
45
+ not k in optional_fields or (optional_nullable and is_set)
51
46
  ):
52
47
  m[k] = val
53
48
 
@@ -34,18 +34,13 @@ class TrainingParameters(BaseModel):
34
34
  k = f.alias or n
35
35
  val = serialized.get(k)
36
36
 
37
+ optional_nullable = k in optional_fields and k in nullable_fields
38
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
39
+
37
40
  if val is not None and val != UNSET_SENTINEL:
38
41
  m[k] = val
39
42
  elif val != UNSET_SENTINEL and (
40
- not k in optional_fields
41
- or (
42
- k in optional_fields
43
- and k in nullable_fields
44
- and (
45
- self.__pydantic_fields_set__.intersection({n})
46
- or k in null_default_fields
47
- ) # pylint: disable=no-member
48
- )
43
+ not k in optional_fields or (optional_nullable and is_set)
49
44
  ):
50
45
  m[k] = val
51
46
 
@@ -42,18 +42,13 @@ class TrainingParametersIn(BaseModel):
42
42
  k = f.alias or n
43
43
  val = serialized.get(k)
44
44
 
45
+ optional_nullable = k in optional_fields and k in nullable_fields
46
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
47
+
45
48
  if val is not None and val != UNSET_SENTINEL:
46
49
  m[k] = val
47
50
  elif val != UNSET_SENTINEL and (
48
- not k in optional_fields
49
- or (
50
- k in optional_fields
51
- and k in nullable_fields
52
- and (
53
- self.__pydantic_fields_set__.intersection({n})
54
- or k in null_default_fields
55
- ) # pylint: disable=no-member
56
- )
51
+ not k in optional_fields or (optional_nullable and is_set)
57
52
  ):
58
53
  m[k] = val
59
54
 
@@ -30,18 +30,13 @@ class UpdateFTModelIn(BaseModel):
30
30
  k = f.alias or n
31
31
  val = serialized.get(k)
32
32
 
33
+ optional_nullable = k in optional_fields and k in nullable_fields
34
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
35
+
33
36
  if val is not None and val != UNSET_SENTINEL:
34
37
  m[k] = val
35
38
  elif val != UNSET_SENTINEL and (
36
- not k in optional_fields
37
- or (
38
- k in optional_fields
39
- and k in nullable_fields
40
- and (
41
- self.__pydantic_fields_set__.intersection({n})
42
- or k in null_default_fields
43
- ) # pylint: disable=no-member
44
- )
39
+ not k in optional_fields or (optional_nullable and is_set)
45
40
  ):
46
41
  m[k] = val
47
42
 
@@ -57,18 +57,13 @@ class UploadFileOut(BaseModel):
57
57
  k = f.alias or n
58
58
  val = serialized.get(k)
59
59
 
60
+ optional_nullable = k in optional_fields and k in nullable_fields
61
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
62
+
60
63
  if val is not None and val != UNSET_SENTINEL:
61
64
  m[k] = val
62
65
  elif val != UNSET_SENTINEL and (
63
- not k in optional_fields
64
- or (
65
- k in optional_fields
66
- and k in nullable_fields
67
- and (
68
- self.__pydantic_fields_set__.intersection({n})
69
- or k in null_default_fields
70
- ) # pylint: disable=no-member
71
- )
66
+ not k in optional_fields or (optional_nullable and is_set)
72
67
  ):
73
68
  m[k] = val
74
69
 
@@ -7,6 +7,12 @@ from typing import List, Literal, Optional, TypedDict, Union
7
7
  from typing_extensions import NotRequired
8
8
 
9
9
 
10
+ UserMessageContentTypedDict = Union[str, List[TextChunkTypedDict]]
11
+
12
+
13
+ UserMessageContent = Union[str, List[TextChunk]]
14
+
15
+
10
16
  UserMessageRole = Literal["user"]
11
17
 
12
18
  class UserMessageTypedDict(TypedDict):
@@ -18,9 +24,3 @@ class UserMessage(BaseModel):
18
24
  content: UserMessageContent
19
25
  role: Optional[UserMessageRole] = "user"
20
26
 
21
-
22
- UserMessageContentTypedDict = Union[str, List[TextChunkTypedDict]]
23
-
24
-
25
- UserMessageContent = Union[str, List[TextChunk]]
26
-
@@ -5,6 +5,12 @@ from mistralai.types import BaseModel
5
5
  from typing import List, TypedDict, Union
6
6
 
7
7
 
8
+ LocTypedDict = Union[str, int]
9
+
10
+
11
+ Loc = Union[str, int]
12
+
13
+
8
14
  class ValidationErrorTypedDict(TypedDict):
9
15
  loc: List[LocTypedDict]
10
16
  msg: str
@@ -16,9 +22,3 @@ class ValidationError(BaseModel):
16
22
  msg: str
17
23
  type: str
18
24
 
19
-
20
- LocTypedDict = Union[str, int]
21
-
22
-
23
- Loc = Union[str, int]
24
-
@@ -42,18 +42,13 @@ class WandbIntegration(BaseModel):
42
42
  k = f.alias or n
43
43
  val = serialized.get(k)
44
44
 
45
+ optional_nullable = k in optional_fields and k in nullable_fields
46
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
47
+
45
48
  if val is not None and val != UNSET_SENTINEL:
46
49
  m[k] = val
47
50
  elif val != UNSET_SENTINEL and (
48
- not k in optional_fields
49
- or (
50
- k in optional_fields
51
- and k in nullable_fields
52
- and (
53
- self.__pydantic_fields_set__.intersection({n})
54
- or k in null_default_fields
55
- ) # pylint: disable=no-member
56
- )
51
+ not k in optional_fields or (optional_nullable and is_set)
57
52
  ):
58
53
  m[k] = val
59
54
 
@@ -38,18 +38,13 @@ class WandbIntegrationOut(BaseModel):
38
38
  k = f.alias or n
39
39
  val = serialized.get(k)
40
40
 
41
+ optional_nullable = k in optional_fields and k in nullable_fields
42
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
43
+
41
44
  if val is not None and val != UNSET_SENTINEL:
42
45
  m[k] = val
43
46
  elif val != UNSET_SENTINEL and (
44
- not k in optional_fields
45
- or (
46
- k in optional_fields
47
- and k in nullable_fields
48
- and (
49
- self.__pydantic_fields_set__.intersection({n})
50
- or k in null_default_fields
51
- ) # pylint: disable=no-member
52
- )
47
+ not k in optional_fields or (optional_nullable and is_set)
53
48
  ):
54
49
  m[k] = val
55
50
 
mistralai/models_.py CHANGED
@@ -1,10 +1,10 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from .basesdk import BaseSDK
4
- from mistralai import models
4
+ from mistralai import models, utils
5
5
  from mistralai._hooks import HookContext
6
6
  from mistralai.types import OptionalNullable, UNSET
7
- import mistralai.utils as utils
7
+ from mistralai.utils import get_security_from_env
8
8
  from typing import Any, Optional
9
9
 
10
10
  class Models(BaseSDK):
@@ -62,7 +62,7 @@ class Models(BaseSDK):
62
62
  ])
63
63
 
64
64
  http_res = self.do_request(
65
- hook_ctx=HookContext(operation_id="list_models_v1_models_get", oauth2_scopes=[], security_source=self.sdk_configuration.security),
65
+ hook_ctx=HookContext(operation_id="list_models_v1_models_get", oauth2_scopes=[], security_source=get_security_from_env(self.sdk_configuration.security, models.Security)),
66
66
  request=req,
67
67
  error_status_codes=["422","4XX","5XX"],
68
68
  retry_config=retry_config
@@ -133,7 +133,7 @@ class Models(BaseSDK):
133
133
  ])
134
134
 
135
135
  http_res = await self.do_request_async(
136
- hook_ctx=HookContext(operation_id="list_models_v1_models_get", oauth2_scopes=[], security_source=self.sdk_configuration.security),
136
+ hook_ctx=HookContext(operation_id="list_models_v1_models_get", oauth2_scopes=[], security_source=get_security_from_env(self.sdk_configuration.security, models.Security)),
137
137
  request=req,
138
138
  error_status_codes=["422","4XX","5XX"],
139
139
  retry_config=retry_config
@@ -164,7 +164,7 @@ class Models(BaseSDK):
164
164
 
165
165
  Retrieve a model information.
166
166
 
167
- :param model_id:
167
+ :param model_id: The ID of the model to retrieve.
168
168
  :param retries: Override the default retry configuration for this method
169
169
  :param server_url: Override the default server URL for this method
170
170
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -211,7 +211,7 @@ class Models(BaseSDK):
211
211
  ])
212
212
 
213
213
  http_res = self.do_request(
214
- hook_ctx=HookContext(operation_id="retrieve_model_v1_models__model_id__get", oauth2_scopes=[], security_source=self.sdk_configuration.security),
214
+ hook_ctx=HookContext(operation_id="retrieve_model_v1_models__model_id__get", oauth2_scopes=[], security_source=get_security_from_env(self.sdk_configuration.security, models.Security)),
215
215
  request=req,
216
216
  error_status_codes=["422","4XX","5XX"],
217
217
  retry_config=retry_config
@@ -242,7 +242,7 @@ class Models(BaseSDK):
242
242
 
243
243
  Retrieve a model information.
244
244
 
245
- :param model_id:
245
+ :param model_id: The ID of the model to retrieve.
246
246
  :param retries: Override the default retry configuration for this method
247
247
  :param server_url: Override the default server URL for this method
248
248
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -289,7 +289,7 @@ class Models(BaseSDK):
289
289
  ])
290
290
 
291
291
  http_res = await self.do_request_async(
292
- hook_ctx=HookContext(operation_id="retrieve_model_v1_models__model_id__get", oauth2_scopes=[], security_source=self.sdk_configuration.security),
292
+ hook_ctx=HookContext(operation_id="retrieve_model_v1_models__model_id__get", oauth2_scopes=[], security_source=get_security_from_env(self.sdk_configuration.security, models.Security)),
293
293
  request=req,
294
294
  error_status_codes=["422","4XX","5XX"],
295
295
  retry_config=retry_config
@@ -320,7 +320,7 @@ class Models(BaseSDK):
320
320
 
321
321
  Delete a fine-tuned model.
322
322
 
323
- :param model_id:
323
+ :param model_id: The ID of the model to delete.
324
324
  :param retries: Override the default retry configuration for this method
325
325
  :param server_url: Override the default server URL for this method
326
326
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -367,7 +367,7 @@ class Models(BaseSDK):
367
367
  ])
368
368
 
369
369
  http_res = self.do_request(
370
- hook_ctx=HookContext(operation_id="delete_model_v1_models__model_id__delete", oauth2_scopes=[], security_source=self.sdk_configuration.security),
370
+ hook_ctx=HookContext(operation_id="delete_model_v1_models__model_id__delete", oauth2_scopes=[], security_source=get_security_from_env(self.sdk_configuration.security, models.Security)),
371
371
  request=req,
372
372
  error_status_codes=["422","4XX","5XX"],
373
373
  retry_config=retry_config
@@ -398,7 +398,7 @@ class Models(BaseSDK):
398
398
 
399
399
  Delete a fine-tuned model.
400
400
 
401
- :param model_id:
401
+ :param model_id: The ID of the model to delete.
402
402
  :param retries: Override the default retry configuration for this method
403
403
  :param server_url: Override the default server URL for this method
404
404
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -445,7 +445,7 @@ class Models(BaseSDK):
445
445
  ])
446
446
 
447
447
  http_res = await self.do_request_async(
448
- hook_ctx=HookContext(operation_id="delete_model_v1_models__model_id__delete", oauth2_scopes=[], security_source=self.sdk_configuration.security),
448
+ hook_ctx=HookContext(operation_id="delete_model_v1_models__model_id__delete", oauth2_scopes=[], security_source=get_security_from_env(self.sdk_configuration.security, models.Security)),
449
449
  request=req,
450
450
  error_status_codes=["422","4XX","5XX"],
451
451
  retry_config=retry_config
@@ -478,7 +478,7 @@ class Models(BaseSDK):
478
478
 
479
479
  Update a model name or description.
480
480
 
481
- :param model_id:
481
+ :param model_id: The ID of the model to update.
482
482
  :param name:
483
483
  :param description:
484
484
  :param retries: Override the default retry configuration for this method
@@ -532,7 +532,7 @@ class Models(BaseSDK):
532
532
  ])
533
533
 
534
534
  http_res = self.do_request(
535
- hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_update_fine_tuned_model", oauth2_scopes=[], security_source=self.sdk_configuration.security),
535
+ hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_update_fine_tuned_model", oauth2_scopes=[], security_source=get_security_from_env(self.sdk_configuration.security, models.Security)),
536
536
  request=req,
537
537
  error_status_codes=["4XX","5XX"],
538
538
  retry_config=retry_config
@@ -561,7 +561,7 @@ class Models(BaseSDK):
561
561
 
562
562
  Update a model name or description.
563
563
 
564
- :param model_id:
564
+ :param model_id: The ID of the model to update.
565
565
  :param name:
566
566
  :param description:
567
567
  :param retries: Override the default retry configuration for this method
@@ -615,7 +615,7 @@ class Models(BaseSDK):
615
615
  ])
616
616
 
617
617
  http_res = await self.do_request_async(
618
- hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_update_fine_tuned_model", oauth2_scopes=[], security_source=self.sdk_configuration.security),
618
+ hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_update_fine_tuned_model", oauth2_scopes=[], security_source=get_security_from_env(self.sdk_configuration.security, models.Security)),
619
619
  request=req,
620
620
  error_status_codes=["4XX","5XX"],
621
621
  retry_config=retry_config
@@ -642,7 +642,7 @@ class Models(BaseSDK):
642
642
 
643
643
  Archive a fine-tuned model.
644
644
 
645
- :param model_id:
645
+ :param model_id: The ID of the model to archive.
646
646
  :param retries: Override the default retry configuration for this method
647
647
  :param server_url: Override the default server URL for this method
648
648
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -689,7 +689,7 @@ class Models(BaseSDK):
689
689
  ])
690
690
 
691
691
  http_res = self.do_request(
692
- hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_archive_fine_tuned_model", oauth2_scopes=[], security_source=self.sdk_configuration.security),
692
+ hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_archive_fine_tuned_model", oauth2_scopes=[], security_source=get_security_from_env(self.sdk_configuration.security, models.Security)),
693
693
  request=req,
694
694
  error_status_codes=["4XX","5XX"],
695
695
  retry_config=retry_config
@@ -716,7 +716,7 @@ class Models(BaseSDK):
716
716
 
717
717
  Archive a fine-tuned model.
718
718
 
719
- :param model_id:
719
+ :param model_id: The ID of the model to archive.
720
720
  :param retries: Override the default retry configuration for this method
721
721
  :param server_url: Override the default server URL for this method
722
722
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -763,7 +763,7 @@ class Models(BaseSDK):
763
763
  ])
764
764
 
765
765
  http_res = await self.do_request_async(
766
- hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_archive_fine_tuned_model", oauth2_scopes=[], security_source=self.sdk_configuration.security),
766
+ hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_archive_fine_tuned_model", oauth2_scopes=[], security_source=get_security_from_env(self.sdk_configuration.security, models.Security)),
767
767
  request=req,
768
768
  error_status_codes=["4XX","5XX"],
769
769
  retry_config=retry_config
@@ -790,7 +790,7 @@ class Models(BaseSDK):
790
790
 
791
791
  Un-archive a fine-tuned model.
792
792
 
793
- :param model_id:
793
+ :param model_id: The ID of the model to unarchive.
794
794
  :param retries: Override the default retry configuration for this method
795
795
  :param server_url: Override the default server URL for this method
796
796
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -837,7 +837,7 @@ class Models(BaseSDK):
837
837
  ])
838
838
 
839
839
  http_res = self.do_request(
840
- hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_unarchive_fine_tuned_model", oauth2_scopes=[], security_source=self.sdk_configuration.security),
840
+ hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_unarchive_fine_tuned_model", oauth2_scopes=[], security_source=get_security_from_env(self.sdk_configuration.security, models.Security)),
841
841
  request=req,
842
842
  error_status_codes=["4XX","5XX"],
843
843
  retry_config=retry_config
@@ -864,7 +864,7 @@ class Models(BaseSDK):
864
864
 
865
865
  Un-archive a fine-tuned model.
866
866
 
867
- :param model_id:
867
+ :param model_id: The ID of the model to unarchive.
868
868
  :param retries: Override the default retry configuration for this method
869
869
  :param server_url: Override the default server URL for this method
870
870
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -911,7 +911,7 @@ class Models(BaseSDK):
911
911
  ])
912
912
 
913
913
  http_res = await self.do_request_async(
914
- hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_unarchive_fine_tuned_model", oauth2_scopes=[], security_source=self.sdk_configuration.security),
914
+ hook_ctx=HookContext(operation_id="jobs_api_routes_fine_tuning_unarchive_fine_tuned_model", oauth2_scopes=[], security_source=get_security_from_env(self.sdk_configuration.security, models.Security)),
915
915
  request=req,
916
916
  error_status_codes=["4XX","5XX"],
917
917
  retry_config=retry_config
mistralai/sdk.py CHANGED
@@ -3,10 +3,12 @@
3
3
  from .basesdk import BaseSDK
4
4
  from .httpclient import AsyncHttpClient, HttpClient
5
5
  from .sdkconfiguration import SDKConfiguration
6
+ from .utils.logger import Logger, NoOpLogger
6
7
  from .utils.retries import RetryConfig
7
8
  import httpx
8
- from mistralai import models
9
+ from mistralai import models, utils
9
10
  from mistralai._hooks import SDKHooks
11
+ from mistralai.agents import Agents
10
12
  from mistralai.chat import Chat
11
13
  from mistralai.embeddings import Embeddings
12
14
  from mistralai.files import Files
@@ -14,7 +16,6 @@ from mistralai.fim import Fim
14
16
  from mistralai.fine_tuning import FineTuning
15
17
  from mistralai.models_ import Models
16
18
  from mistralai.types import OptionalNullable, UNSET
17
- import mistralai.utils as utils
18
19
  from typing import Any, Callable, Dict, Optional, Union
19
20
 
20
21
  class Mistral(BaseSDK):
@@ -24,23 +25,25 @@ class Mistral(BaseSDK):
24
25
  files: Files
25
26
  r"""Files API"""
26
27
  fine_tuning: FineTuning
27
- r"""Fine-tuning API"""
28
28
  chat: Chat
29
29
  r"""Chat Completion API."""
30
30
  fim: Fim
31
31
  r"""Fill-in-the-middle API."""
32
+ agents: Agents
33
+ r"""Agents API."""
32
34
  embeddings: Embeddings
33
35
  r"""Embeddings API."""
34
36
  def __init__(
35
37
  self,
36
- api_key: Union[str, Callable[[], str]],
38
+ api_key: Optional[Union[Optional[str], Callable[[], Optional[str]]]] = None,
37
39
  server: Optional[str] = None,
38
40
  server_url: Optional[str] = None,
39
41
  url_params: Optional[Dict[str, str]] = None,
40
42
  client: Optional[HttpClient] = None,
41
43
  async_client: Optional[AsyncHttpClient] = None,
42
44
  retry_config: OptionalNullable[RetryConfig] = UNSET,
43
- timeout_ms: Optional[int] = None
45
+ timeout_ms: Optional[int] = None,
46
+ debug_logger: Optional[Logger] = None
44
47
  ) -> None:
45
48
  r"""Instantiates the SDK configuring it with the provided parameters.
46
49
 
@@ -63,6 +66,9 @@ class Mistral(BaseSDK):
63
66
  if async_client is None:
64
67
  async_client = httpx.AsyncClient()
65
68
 
69
+ if debug_logger is None:
70
+ debug_logger = NoOpLogger()
71
+
66
72
  assert issubclass(
67
73
  type(async_client), AsyncHttpClient
68
74
  ), "The provided async_client must implement the AsyncHttpClient protocol."
@@ -85,7 +91,8 @@ class Mistral(BaseSDK):
85
91
  server_url=server_url,
86
92
  server=server,
87
93
  retry_config=retry_config,
88
- timeout_ms=timeout_ms
94
+ timeout_ms=timeout_ms,
95
+ debug_logger=debug_logger
89
96
  ))
90
97
 
91
98
  hooks = SDKHooks()
@@ -107,5 +114,6 @@ class Mistral(BaseSDK):
107
114
  self.fine_tuning = FineTuning(self.sdk_configuration)
108
115
  self.chat = Chat(self.sdk_configuration)
109
116
  self.fim = Fim(self.sdk_configuration)
117
+ self.agents = Agents(self.sdk_configuration)
110
118
  self.embeddings = Embeddings(self.sdk_configuration)
111
119
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  from ._hooks import SDKHooks
5
5
  from .httpclient import AsyncHttpClient, HttpClient
6
- from .utils import RetryConfig, remove_suffix
6
+ from .utils import Logger, RetryConfig, remove_suffix
7
7
  from dataclasses import dataclass
8
8
  from mistralai import models
9
9
  from mistralai.types import OptionalNullable, UNSET
@@ -23,14 +23,15 @@ SERVERS = {
23
23
  class SDKConfiguration:
24
24
  client: HttpClient
25
25
  async_client: AsyncHttpClient
26
+ debug_logger: Logger
26
27
  security: Optional[Union[models.Security,Callable[[], models.Security]]] = None
27
28
  server_url: Optional[str] = ""
28
29
  server: Optional[str] = ""
29
30
  language: str = "python"
30
31
  openapi_doc_version: str = "0.0.2"
31
- sdk_version: str = "1.0.0rc1"
32
- gen_version: str = "2.382.2"
33
- user_agent: str = "speakeasy-sdk/python 1.0.0rc1 2.382.2 0.0.2 mistralai"
32
+ sdk_version: str = "1.0.1"
33
+ gen_version: str = "2.390.6"
34
+ user_agent: str = "speakeasy-sdk/python 1.0.1 2.390.6 0.0.2 mistralai"
34
35
  retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET)
35
36
  timeout_ms: Optional[int] = None
36
37
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  from pydantic import ConfigDict, model_serializer
4
4
  from pydantic import BaseModel as PydanticBaseModel
5
- from typing import Literal, Optional, TypeVar, Union, NewType
6
- from typing_extensions import TypeAliasType
5
+ from typing import TYPE_CHECKING, Literal, Optional, TypeVar, Union, NewType
6
+ from typing_extensions import TypeAliasType, TypeAlias
7
7
 
8
8
 
9
9
  class BaseModel(PydanticBaseModel):
@@ -26,10 +26,14 @@ UNSET_SENTINEL = "~?~unset~?~sentinel~?~"
26
26
 
27
27
 
28
28
  T = TypeVar("T")
29
- Nullable = TypeAliasType("Nullable", Union[T, None], type_params=(T,))
30
- OptionalNullable = TypeAliasType(
31
- "OptionalNullable", Union[Optional[Nullable[T]], Unset], type_params=(T,)
32
- )
29
+ if TYPE_CHECKING:
30
+ Nullable: TypeAlias = Union[T, None]
31
+ OptionalNullable: TypeAlias = Union[Optional[Nullable[T]], Unset]
32
+ else:
33
+ Nullable = TypeAliasType("Nullable", Union[T, None], type_params=(T,))
34
+ OptionalNullable = TypeAliasType(
35
+ "OptionalNullable", Union[Optional[Nullable[T]], Unset], type_params=(T,)
36
+ )
33
37
 
34
38
  UnrecognizedInt = NewType("UnrecognizedInt", int)
35
39
  UnrecognizedStr = NewType("UnrecognizedStr", str)
@@ -35,6 +35,7 @@ from .serializers import (
35
35
  )
36
36
  from .url import generate_url, template_url, remove_suffix
37
37
  from .values import get_global_from_env, match_content_type, match_status_codes, match_response
38
+ from .logger import Logger, get_body_content, NoOpLogger
38
39
 
39
40
  __all__ = [
40
41
  "BackoffStrategy",
@@ -42,6 +43,7 @@ __all__ = [
42
43
  "find_metadata",
43
44
  "FormMetadata",
44
45
  "generate_url",
46
+ "get_body_content",
45
47
  "get_discriminator",
46
48
  "get_global_from_env",
47
49
  "get_headers",
@@ -51,11 +53,13 @@ __all__ = [
51
53
  "get_security",
52
54
  "get_security_from_env",
53
55
  "HeaderMetadata",
56
+ "Logger",
54
57
  "marshal_json",
55
58
  "match_content_type",
56
59
  "match_status_codes",
57
60
  "match_response",
58
61
  "MultipartFormMetadata",
62
+ "NoOpLogger",
59
63
  "OpenEnumMeta",
60
64
  "PathParamMetadata",
61
65
  "QueryParamMetadata",