mistralai 0.4.2__py3-none-any.whl → 1.0.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 (246) hide show
  1. mistralai/__init__.py +5 -0
  2. mistralai/_hooks/__init__.py +5 -0
  3. mistralai/_hooks/custom_user_agent.py +16 -0
  4. mistralai/_hooks/deprecation_warning.py +26 -0
  5. mistralai/_hooks/registration.py +17 -0
  6. mistralai/_hooks/sdkhooks.py +57 -0
  7. mistralai/_hooks/types.py +76 -0
  8. mistralai/agents.py +434 -0
  9. mistralai/async_client.py +5 -413
  10. mistralai/basesdk.py +253 -0
  11. mistralai/chat.py +470 -0
  12. mistralai/client.py +5 -414
  13. mistralai/embeddings.py +182 -0
  14. mistralai/files.py +600 -84
  15. mistralai/fim.py +438 -0
  16. mistralai/fine_tuning.py +16 -0
  17. mistralai/httpclient.py +78 -0
  18. mistralai/jobs.py +822 -150
  19. mistralai/models/__init__.py +82 -0
  20. mistralai/models/agentscompletionrequest.py +96 -0
  21. mistralai/models/agentscompletionstreamrequest.py +92 -0
  22. mistralai/models/archiveftmodelout.py +19 -0
  23. mistralai/models/assistantmessage.py +53 -0
  24. mistralai/models/chatcompletionchoice.py +22 -0
  25. mistralai/models/chatcompletionrequest.py +109 -0
  26. mistralai/models/chatcompletionresponse.py +27 -0
  27. mistralai/models/chatcompletionstreamrequest.py +107 -0
  28. mistralai/models/checkpointout.py +25 -0
  29. mistralai/models/completionchunk.py +27 -0
  30. mistralai/models/completionevent.py +15 -0
  31. mistralai/models/completionresponsestreamchoice.py +48 -0
  32. mistralai/models/contentchunk.py +17 -0
  33. mistralai/models/delete_model_v1_models_model_id_deleteop.py +18 -0
  34. mistralai/models/deletefileout.py +24 -0
  35. mistralai/models/deletemodelout.py +25 -0
  36. mistralai/models/deltamessage.py +47 -0
  37. mistralai/models/detailedjobout.py +91 -0
  38. mistralai/models/embeddingrequest.py +61 -0
  39. mistralai/models/embeddingresponse.py +24 -0
  40. mistralai/models/embeddingresponsedata.py +19 -0
  41. mistralai/models/eventout.py +50 -0
  42. mistralai/models/files_api_routes_delete_fileop.py +16 -0
  43. mistralai/models/files_api_routes_retrieve_fileop.py +16 -0
  44. mistralai/models/files_api_routes_upload_fileop.py +51 -0
  45. mistralai/models/fileschema.py +71 -0
  46. mistralai/models/fimcompletionrequest.py +94 -0
  47. mistralai/models/fimcompletionresponse.py +27 -0
  48. mistralai/models/fimcompletionstreamrequest.py +92 -0
  49. mistralai/models/finetuneablemodel.py +8 -0
  50. mistralai/models/ftmodelcapabilitiesout.py +21 -0
  51. mistralai/models/ftmodelout.py +65 -0
  52. mistralai/models/function.py +19 -0
  53. mistralai/models/functioncall.py +22 -0
  54. mistralai/models/githubrepositoryin.py +52 -0
  55. mistralai/models/githubrepositoryout.py +52 -0
  56. mistralai/models/httpvalidationerror.py +23 -0
  57. mistralai/models/jobin.py +73 -0
  58. mistralai/models/jobmetadataout.py +54 -0
  59. mistralai/models/jobout.py +107 -0
  60. mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +18 -0
  61. mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +18 -0
  62. mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +15 -0
  63. mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +18 -0
  64. mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +81 -0
  65. mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +16 -0
  66. mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +18 -0
  67. mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +21 -0
  68. mistralai/models/jobsout.py +20 -0
  69. mistralai/models/legacyjobmetadataout.py +80 -0
  70. mistralai/models/listfilesout.py +17 -0
  71. mistralai/models/metricout.py +50 -0
  72. mistralai/models/modelcapabilities.py +21 -0
  73. mistralai/models/modelcard.py +66 -0
  74. mistralai/models/modellist.py +18 -0
  75. mistralai/models/responseformat.py +18 -0
  76. mistralai/models/retrieve_model_v1_models_model_id_getop.py +18 -0
  77. mistralai/models/retrievefileout.py +71 -0
  78. mistralai/models/sampletype.py +7 -0
  79. mistralai/models/sdkerror.py +22 -0
  80. mistralai/models/security.py +16 -0
  81. mistralai/models/source.py +7 -0
  82. mistralai/models/systemmessage.py +26 -0
  83. mistralai/models/textchunk.py +17 -0
  84. mistralai/models/tool.py +18 -0
  85. mistralai/models/toolcall.py +20 -0
  86. mistralai/models/toolmessage.py +50 -0
  87. mistralai/models/trainingfile.py +17 -0
  88. mistralai/models/trainingparameters.py +48 -0
  89. mistralai/models/trainingparametersin.py +56 -0
  90. mistralai/models/unarchiveftmodelout.py +19 -0
  91. mistralai/models/updateftmodelin.py +44 -0
  92. mistralai/models/uploadfileout.py +71 -0
  93. mistralai/models/usageinfo.py +18 -0
  94. mistralai/models/usermessage.py +26 -0
  95. mistralai/models/validationerror.py +24 -0
  96. mistralai/models/wandbintegration.py +56 -0
  97. mistralai/models/wandbintegrationout.py +52 -0
  98. mistralai/models_.py +928 -0
  99. mistralai/py.typed +1 -0
  100. mistralai/sdk.py +119 -0
  101. mistralai/sdkconfiguration.py +54 -0
  102. mistralai/types/__init__.py +21 -0
  103. mistralai/types/basemodel.py +39 -0
  104. mistralai/utils/__init__.py +86 -0
  105. mistralai/utils/annotations.py +19 -0
  106. mistralai/utils/enums.py +34 -0
  107. mistralai/utils/eventstreaming.py +178 -0
  108. mistralai/utils/forms.py +207 -0
  109. mistralai/utils/headers.py +136 -0
  110. mistralai/utils/logger.py +16 -0
  111. mistralai/utils/metadata.py +118 -0
  112. mistralai/utils/queryparams.py +203 -0
  113. mistralai/utils/requestbodies.py +66 -0
  114. mistralai/utils/retries.py +216 -0
  115. mistralai/utils/security.py +185 -0
  116. mistralai/utils/serializers.py +181 -0
  117. mistralai/utils/url.py +150 -0
  118. mistralai/utils/values.py +128 -0
  119. {mistralai-0.4.2.dist-info → mistralai-1.0.0.dist-info}/LICENSE +1 -1
  120. mistralai-1.0.0.dist-info/METADATA +695 -0
  121. mistralai-1.0.0.dist-info/RECORD +235 -0
  122. mistralai_azure/__init__.py +5 -0
  123. mistralai_azure/_hooks/__init__.py +5 -0
  124. mistralai_azure/_hooks/custom_user_agent.py +16 -0
  125. mistralai_azure/_hooks/registration.py +15 -0
  126. mistralai_azure/_hooks/sdkhooks.py +57 -0
  127. mistralai_azure/_hooks/types.py +76 -0
  128. mistralai_azure/basesdk.py +253 -0
  129. mistralai_azure/chat.py +470 -0
  130. mistralai_azure/httpclient.py +78 -0
  131. mistralai_azure/models/__init__.py +28 -0
  132. mistralai_azure/models/assistantmessage.py +53 -0
  133. mistralai_azure/models/chatcompletionchoice.py +22 -0
  134. mistralai_azure/models/chatcompletionrequest.py +109 -0
  135. mistralai_azure/models/chatcompletionresponse.py +27 -0
  136. mistralai_azure/models/chatcompletionstreamrequest.py +107 -0
  137. mistralai_azure/models/completionchunk.py +27 -0
  138. mistralai_azure/models/completionevent.py +15 -0
  139. mistralai_azure/models/completionresponsestreamchoice.py +48 -0
  140. mistralai_azure/models/contentchunk.py +17 -0
  141. mistralai_azure/models/deltamessage.py +47 -0
  142. mistralai_azure/models/function.py +19 -0
  143. mistralai_azure/models/functioncall.py +22 -0
  144. mistralai_azure/models/httpvalidationerror.py +23 -0
  145. mistralai_azure/models/responseformat.py +18 -0
  146. mistralai_azure/models/sdkerror.py +22 -0
  147. mistralai_azure/models/security.py +16 -0
  148. mistralai_azure/models/systemmessage.py +26 -0
  149. mistralai_azure/models/textchunk.py +17 -0
  150. mistralai_azure/models/tool.py +18 -0
  151. mistralai_azure/models/toolcall.py +20 -0
  152. mistralai_azure/models/toolmessage.py +50 -0
  153. mistralai_azure/models/usageinfo.py +18 -0
  154. mistralai_azure/models/usermessage.py +26 -0
  155. mistralai_azure/models/validationerror.py +24 -0
  156. mistralai_azure/py.typed +1 -0
  157. mistralai_azure/sdk.py +107 -0
  158. mistralai_azure/sdkconfiguration.py +54 -0
  159. mistralai_azure/types/__init__.py +21 -0
  160. mistralai_azure/types/basemodel.py +39 -0
  161. mistralai_azure/utils/__init__.py +84 -0
  162. mistralai_azure/utils/annotations.py +19 -0
  163. mistralai_azure/utils/enums.py +34 -0
  164. mistralai_azure/utils/eventstreaming.py +178 -0
  165. mistralai_azure/utils/forms.py +207 -0
  166. mistralai_azure/utils/headers.py +136 -0
  167. mistralai_azure/utils/logger.py +16 -0
  168. mistralai_azure/utils/metadata.py +118 -0
  169. mistralai_azure/utils/queryparams.py +203 -0
  170. mistralai_azure/utils/requestbodies.py +66 -0
  171. mistralai_azure/utils/retries.py +216 -0
  172. mistralai_azure/utils/security.py +168 -0
  173. mistralai_azure/utils/serializers.py +181 -0
  174. mistralai_azure/utils/url.py +150 -0
  175. mistralai_azure/utils/values.py +128 -0
  176. mistralai_gcp/__init__.py +5 -0
  177. mistralai_gcp/_hooks/__init__.py +5 -0
  178. mistralai_gcp/_hooks/custom_user_agent.py +16 -0
  179. mistralai_gcp/_hooks/registration.py +15 -0
  180. mistralai_gcp/_hooks/sdkhooks.py +57 -0
  181. mistralai_gcp/_hooks/types.py +76 -0
  182. mistralai_gcp/basesdk.py +253 -0
  183. mistralai_gcp/chat.py +458 -0
  184. mistralai_gcp/fim.py +438 -0
  185. mistralai_gcp/httpclient.py +78 -0
  186. mistralai_gcp/models/__init__.py +31 -0
  187. mistralai_gcp/models/assistantmessage.py +53 -0
  188. mistralai_gcp/models/chatcompletionchoice.py +22 -0
  189. mistralai_gcp/models/chatcompletionrequest.py +105 -0
  190. mistralai_gcp/models/chatcompletionresponse.py +27 -0
  191. mistralai_gcp/models/chatcompletionstreamrequest.py +103 -0
  192. mistralai_gcp/models/completionchunk.py +27 -0
  193. mistralai_gcp/models/completionevent.py +15 -0
  194. mistralai_gcp/models/completionresponsestreamchoice.py +48 -0
  195. mistralai_gcp/models/contentchunk.py +17 -0
  196. mistralai_gcp/models/deltamessage.py +47 -0
  197. mistralai_gcp/models/fimcompletionrequest.py +94 -0
  198. mistralai_gcp/models/fimcompletionresponse.py +27 -0
  199. mistralai_gcp/models/fimcompletionstreamrequest.py +92 -0
  200. mistralai_gcp/models/function.py +19 -0
  201. mistralai_gcp/models/functioncall.py +22 -0
  202. mistralai_gcp/models/httpvalidationerror.py +23 -0
  203. mistralai_gcp/models/responseformat.py +18 -0
  204. mistralai_gcp/models/sdkerror.py +22 -0
  205. mistralai_gcp/models/security.py +16 -0
  206. mistralai_gcp/models/systemmessage.py +26 -0
  207. mistralai_gcp/models/textchunk.py +17 -0
  208. mistralai_gcp/models/tool.py +18 -0
  209. mistralai_gcp/models/toolcall.py +20 -0
  210. mistralai_gcp/models/toolmessage.py +50 -0
  211. mistralai_gcp/models/usageinfo.py +18 -0
  212. mistralai_gcp/models/usermessage.py +26 -0
  213. mistralai_gcp/models/validationerror.py +24 -0
  214. mistralai_gcp/py.typed +1 -0
  215. mistralai_gcp/sdk.py +174 -0
  216. mistralai_gcp/sdkconfiguration.py +54 -0
  217. mistralai_gcp/types/__init__.py +21 -0
  218. mistralai_gcp/types/basemodel.py +39 -0
  219. mistralai_gcp/utils/__init__.py +84 -0
  220. mistralai_gcp/utils/annotations.py +19 -0
  221. mistralai_gcp/utils/enums.py +34 -0
  222. mistralai_gcp/utils/eventstreaming.py +178 -0
  223. mistralai_gcp/utils/forms.py +207 -0
  224. mistralai_gcp/utils/headers.py +136 -0
  225. mistralai_gcp/utils/logger.py +16 -0
  226. mistralai_gcp/utils/metadata.py +118 -0
  227. mistralai_gcp/utils/queryparams.py +203 -0
  228. mistralai_gcp/utils/requestbodies.py +66 -0
  229. mistralai_gcp/utils/retries.py +216 -0
  230. mistralai_gcp/utils/security.py +168 -0
  231. mistralai_gcp/utils/serializers.py +181 -0
  232. mistralai_gcp/utils/url.py +150 -0
  233. mistralai_gcp/utils/values.py +128 -0
  234. py.typed +1 -0
  235. mistralai/client_base.py +0 -211
  236. mistralai/constants.py +0 -5
  237. mistralai/exceptions.py +0 -54
  238. mistralai/models/chat_completion.py +0 -93
  239. mistralai/models/common.py +0 -9
  240. mistralai/models/embeddings.py +0 -19
  241. mistralai/models/files.py +0 -23
  242. mistralai/models/jobs.py +0 -100
  243. mistralai/models/models.py +0 -39
  244. mistralai-0.4.2.dist-info/METADATA +0 -82
  245. mistralai-0.4.2.dist-info/RECORD +0 -20
  246. {mistralai-0.4.2.dist-info → mistralai-1.0.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,25 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .metricout import MetricOut, MetricOutTypedDict
5
+ from mistralai.types import BaseModel
6
+ from typing import TypedDict
7
+
8
+
9
+ class CheckpointOutTypedDict(TypedDict):
10
+ metrics: MetricOutTypedDict
11
+ r"""Metrics at the step number during the fine-tuning job. Use these metrics to assess if the training is going smoothly (loss should decrease, token accuracy should increase)."""
12
+ step_number: int
13
+ r"""The step number that the checkpoint was created at."""
14
+ created_at: int
15
+ r"""The UNIX timestamp (in seconds) for when the checkpoint was created."""
16
+
17
+
18
+ class CheckpointOut(BaseModel):
19
+ metrics: MetricOut
20
+ r"""Metrics at the step number during the fine-tuning job. Use these metrics to assess if the training is going smoothly (loss should decrease, token accuracy should increase)."""
21
+ step_number: int
22
+ r"""The step number that the checkpoint was created at."""
23
+ created_at: int
24
+ r"""The UNIX timestamp (in seconds) for when the checkpoint was created."""
25
+
@@ -0,0 +1,27 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .completionresponsestreamchoice import CompletionResponseStreamChoice, CompletionResponseStreamChoiceTypedDict
5
+ from .usageinfo import UsageInfo, UsageInfoTypedDict
6
+ from mistralai.types import BaseModel
7
+ from typing import List, Optional, TypedDict
8
+ from typing_extensions import NotRequired
9
+
10
+
11
+ class CompletionChunkTypedDict(TypedDict):
12
+ id: str
13
+ model: str
14
+ choices: List[CompletionResponseStreamChoiceTypedDict]
15
+ object: NotRequired[str]
16
+ created: NotRequired[int]
17
+ usage: NotRequired[UsageInfoTypedDict]
18
+
19
+
20
+ class CompletionChunk(BaseModel):
21
+ id: str
22
+ model: str
23
+ choices: List[CompletionResponseStreamChoice]
24
+ object: Optional[str] = None
25
+ created: Optional[int] = None
26
+ usage: Optional[UsageInfo] = None
27
+
@@ -0,0 +1,15 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .completionchunk import CompletionChunk, CompletionChunkTypedDict
5
+ from mistralai.types import BaseModel
6
+ from typing import TypedDict
7
+
8
+
9
+ class CompletionEventTypedDict(TypedDict):
10
+ data: CompletionChunkTypedDict
11
+
12
+
13
+ class CompletionEvent(BaseModel):
14
+ data: CompletionChunk
15
+
@@ -0,0 +1,48 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .deltamessage import DeltaMessage, DeltaMessageTypedDict
5
+ from mistralai.types import BaseModel, Nullable, UNSET_SENTINEL
6
+ from pydantic import model_serializer
7
+ from typing import Literal, TypedDict
8
+
9
+
10
+ CompletionResponseStreamChoiceFinishReason = Literal["stop", "length", "error", "tool_calls"]
11
+
12
+ class CompletionResponseStreamChoiceTypedDict(TypedDict):
13
+ index: int
14
+ delta: DeltaMessageTypedDict
15
+ finish_reason: Nullable[CompletionResponseStreamChoiceFinishReason]
16
+
17
+
18
+ class CompletionResponseStreamChoice(BaseModel):
19
+ index: int
20
+ delta: DeltaMessage
21
+ finish_reason: Nullable[CompletionResponseStreamChoiceFinishReason]
22
+
23
+ @model_serializer(mode="wrap")
24
+ def serialize_model(self, handler):
25
+ optional_fields = []
26
+ nullable_fields = ["finish_reason"]
27
+ null_default_fields = []
28
+
29
+ serialized = handler(self)
30
+
31
+ m = {}
32
+
33
+ for n, f in self.model_fields.items():
34
+ k = f.alias or n
35
+ val = serialized.get(k)
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
+
40
+ if val is not None and val != UNSET_SENTINEL:
41
+ m[k] = val
42
+ elif val != UNSET_SENTINEL and (
43
+ not k in optional_fields or (optional_nullable and is_set)
44
+ ):
45
+ m[k] = val
46
+
47
+ return m
48
+
@@ -0,0 +1,17 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel
5
+ import pydantic
6
+ from typing import Final, Optional, TypedDict
7
+ from typing_extensions import Annotated
8
+
9
+
10
+ class ContentChunkTypedDict(TypedDict):
11
+ text: str
12
+
13
+
14
+ class ContentChunk(BaseModel):
15
+ text: str
16
+ TYPE: Annotated[Final[Optional[str]], pydantic.Field(alias="type")] = "text" # type: ignore
17
+
@@ -0,0 +1,18 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel
5
+ from mistralai.utils import FieldMetadata, PathParamMetadata
6
+ from typing import TypedDict
7
+ from typing_extensions import Annotated
8
+
9
+
10
+ class DeleteModelV1ModelsModelIDDeleteRequestTypedDict(TypedDict):
11
+ model_id: str
12
+ r"""The ID of the model to delete."""
13
+
14
+
15
+ class DeleteModelV1ModelsModelIDDeleteRequest(BaseModel):
16
+ model_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
17
+ r"""The ID of the model to delete."""
18
+
@@ -0,0 +1,24 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel
5
+ from typing import TypedDict
6
+
7
+
8
+ class DeleteFileOutTypedDict(TypedDict):
9
+ id: str
10
+ r"""The ID of the deleted file."""
11
+ object: str
12
+ r"""The object type that was deleted"""
13
+ deleted: bool
14
+ r"""The deletion status."""
15
+
16
+
17
+ class DeleteFileOut(BaseModel):
18
+ id: str
19
+ r"""The ID of the deleted file."""
20
+ object: str
21
+ r"""The object type that was deleted"""
22
+ deleted: bool
23
+ r"""The deletion status."""
24
+
@@ -0,0 +1,25 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel
5
+ from typing import Optional, TypedDict
6
+ from typing_extensions import NotRequired
7
+
8
+
9
+ class DeleteModelOutTypedDict(TypedDict):
10
+ id: str
11
+ r"""The ID of the deleted model."""
12
+ object: NotRequired[str]
13
+ r"""The object type that was deleted"""
14
+ deleted: NotRequired[bool]
15
+ r"""The deletion status"""
16
+
17
+
18
+ class DeleteModelOut(BaseModel):
19
+ id: str
20
+ r"""The ID of the deleted model."""
21
+ object: Optional[str] = "model"
22
+ r"""The object type that was deleted"""
23
+ deleted: Optional[bool] = True
24
+ r"""The deletion status"""
25
+
@@ -0,0 +1,47 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .toolcall import ToolCall, ToolCallTypedDict
5
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
6
+ from pydantic import model_serializer
7
+ from typing import Optional, TypedDict
8
+ from typing_extensions import NotRequired
9
+
10
+
11
+ class DeltaMessageTypedDict(TypedDict):
12
+ role: NotRequired[str]
13
+ content: NotRequired[str]
14
+ tool_calls: NotRequired[Nullable[ToolCallTypedDict]]
15
+
16
+
17
+ class DeltaMessage(BaseModel):
18
+ role: Optional[str] = None
19
+ content: Optional[str] = None
20
+ tool_calls: OptionalNullable[ToolCall] = UNSET
21
+
22
+ @model_serializer(mode="wrap")
23
+ def serialize_model(self, handler):
24
+ optional_fields = ["role", "content", "tool_calls"]
25
+ nullable_fields = ["tool_calls"]
26
+ null_default_fields = []
27
+
28
+ serialized = handler(self)
29
+
30
+ m = {}
31
+
32
+ for n, f in self.model_fields.items():
33
+ k = f.alias or n
34
+ val = serialized.get(k)
35
+
36
+ optional_nullable = k in optional_fields and k in nullable_fields
37
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
38
+
39
+ if val is not None and val != UNSET_SENTINEL:
40
+ m[k] = val
41
+ elif val != UNSET_SENTINEL and (
42
+ not k in optional_fields or (optional_nullable and is_set)
43
+ ):
44
+ m[k] = val
45
+
46
+ return m
47
+
@@ -0,0 +1,91 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .checkpointout import CheckpointOut, CheckpointOutTypedDict
5
+ from .eventout import EventOut, EventOutTypedDict
6
+ from .finetuneablemodel import FineTuneableModel
7
+ from .githubrepositoryout import GithubRepositoryOut, GithubRepositoryOutTypedDict
8
+ from .jobmetadataout import JobMetadataOut, JobMetadataOutTypedDict
9
+ from .trainingparameters import TrainingParameters, TrainingParametersTypedDict
10
+ from .wandbintegrationout import WandbIntegrationOut, WandbIntegrationOutTypedDict
11
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
12
+ import pydantic
13
+ from pydantic import model_serializer
14
+ from typing import Final, List, Literal, Optional, TypedDict
15
+ from typing_extensions import Annotated, NotRequired
16
+
17
+
18
+ DetailedJobOutStatus = Literal["QUEUED", "STARTED", "VALIDATING", "VALIDATED", "RUNNING", "FAILED_VALIDATION", "FAILED", "SUCCESS", "CANCELLED", "CANCELLATION_REQUESTED"]
19
+
20
+ class DetailedJobOutTypedDict(TypedDict):
21
+ id: str
22
+ auto_start: bool
23
+ hyperparameters: TrainingParametersTypedDict
24
+ model: FineTuneableModel
25
+ r"""The name of the model to fine-tune."""
26
+ status: DetailedJobOutStatus
27
+ job_type: str
28
+ created_at: int
29
+ modified_at: int
30
+ training_files: List[str]
31
+ validation_files: NotRequired[Nullable[List[str]]]
32
+ fine_tuned_model: NotRequired[Nullable[str]]
33
+ suffix: NotRequired[Nullable[str]]
34
+ integrations: NotRequired[Nullable[List[WandbIntegrationOutTypedDict]]]
35
+ trained_tokens: NotRequired[Nullable[int]]
36
+ repositories: NotRequired[List[GithubRepositoryOutTypedDict]]
37
+ metadata: NotRequired[Nullable[JobMetadataOutTypedDict]]
38
+ events: NotRequired[List[EventOutTypedDict]]
39
+ r"""Event items are created every time the status of a fine-tuning job changes. The timestamped list of all events is accessible here."""
40
+ checkpoints: NotRequired[List[CheckpointOutTypedDict]]
41
+
42
+
43
+ class DetailedJobOut(BaseModel):
44
+ id: str
45
+ auto_start: bool
46
+ hyperparameters: TrainingParameters
47
+ model: FineTuneableModel
48
+ r"""The name of the model to fine-tune."""
49
+ status: DetailedJobOutStatus
50
+ job_type: str
51
+ created_at: int
52
+ modified_at: int
53
+ training_files: List[str]
54
+ validation_files: OptionalNullable[List[str]] = UNSET
55
+ OBJECT: Annotated[Final[Optional[str]], pydantic.Field(alias="object")] = "job" # type: ignore
56
+ fine_tuned_model: OptionalNullable[str] = UNSET
57
+ suffix: OptionalNullable[str] = UNSET
58
+ integrations: OptionalNullable[List[WandbIntegrationOut]] = UNSET
59
+ trained_tokens: OptionalNullable[int] = UNSET
60
+ repositories: Optional[List[GithubRepositoryOut]] = None
61
+ metadata: OptionalNullable[JobMetadataOut] = UNSET
62
+ events: Optional[List[EventOut]] = None
63
+ r"""Event items are created every time the status of a fine-tuning job changes. The timestamped list of all events is accessible here."""
64
+ checkpoints: Optional[List[CheckpointOut]] = None
65
+
66
+ @model_serializer(mode="wrap")
67
+ def serialize_model(self, handler):
68
+ optional_fields = ["validation_files", "object", "fine_tuned_model", "suffix", "integrations", "trained_tokens", "repositories", "metadata", "events", "checkpoints"]
69
+ nullable_fields = ["validation_files", "fine_tuned_model", "suffix", "integrations", "trained_tokens", "metadata"]
70
+ null_default_fields = []
71
+
72
+ serialized = handler(self)
73
+
74
+ m = {}
75
+
76
+ for n, f in self.model_fields.items():
77
+ k = f.alias or n
78
+ val = serialized.get(k)
79
+
80
+ optional_nullable = k in optional_fields and k in nullable_fields
81
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
82
+
83
+ if val is not None and val != UNSET_SENTINEL:
84
+ m[k] = val
85
+ elif val != UNSET_SENTINEL and (
86
+ not k in optional_fields or (optional_nullable and is_set)
87
+ ):
88
+ m[k] = val
89
+
90
+ return m
91
+
@@ -0,0 +1,61 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
+ import pydantic
6
+ from pydantic import model_serializer
7
+ from typing import List, TypedDict, Union
8
+ from typing_extensions import Annotated, NotRequired
9
+
10
+
11
+ class EmbeddingRequestTypedDict(TypedDict):
12
+ inputs: InputsTypedDict
13
+ r"""Text to embed."""
14
+ model: str
15
+ r"""ID of the model to use."""
16
+ encoding_format: NotRequired[Nullable[str]]
17
+ r"""The format to return the embeddings in."""
18
+
19
+
20
+ class EmbeddingRequest(BaseModel):
21
+ inputs: Annotated[Inputs, pydantic.Field(alias="input")]
22
+ r"""Text to embed."""
23
+ model: str
24
+ r"""ID of the model to use."""
25
+ encoding_format: OptionalNullable[str] = UNSET
26
+ r"""The format to return the embeddings in."""
27
+
28
+ @model_serializer(mode="wrap")
29
+ def serialize_model(self, handler):
30
+ optional_fields = ["encoding_format"]
31
+ nullable_fields = ["encoding_format"]
32
+ null_default_fields = []
33
+
34
+ serialized = handler(self)
35
+
36
+ m = {}
37
+
38
+ for n, f in self.model_fields.items():
39
+ k = f.alias or n
40
+ val = serialized.get(k)
41
+
42
+ optional_nullable = k in optional_fields and k in nullable_fields
43
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
44
+
45
+ if val is not None and val != UNSET_SENTINEL:
46
+ m[k] = val
47
+ elif val != UNSET_SENTINEL and (
48
+ not k in optional_fields or (optional_nullable and is_set)
49
+ ):
50
+ m[k] = val
51
+
52
+ return m
53
+
54
+
55
+ InputsTypedDict = Union[str, List[str]]
56
+ r"""Text to embed."""
57
+
58
+
59
+ Inputs = Union[str, List[str]]
60
+ r"""Text to embed."""
61
+
@@ -0,0 +1,24 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .embeddingresponsedata import EmbeddingResponseData, EmbeddingResponseDataTypedDict
5
+ from .usageinfo import UsageInfo, UsageInfoTypedDict
6
+ from mistralai.types import BaseModel
7
+ from typing import List, TypedDict
8
+
9
+
10
+ class EmbeddingResponseTypedDict(TypedDict):
11
+ id: str
12
+ object: str
13
+ model: str
14
+ usage: UsageInfoTypedDict
15
+ data: List[EmbeddingResponseDataTypedDict]
16
+
17
+
18
+ class EmbeddingResponse(BaseModel):
19
+ id: str
20
+ object: str
21
+ model: str
22
+ usage: UsageInfo
23
+ data: List[EmbeddingResponseData]
24
+
@@ -0,0 +1,19 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel
5
+ from typing import List, Optional, TypedDict
6
+ from typing_extensions import NotRequired
7
+
8
+
9
+ class EmbeddingResponseDataTypedDict(TypedDict):
10
+ object: NotRequired[str]
11
+ embedding: NotRequired[List[float]]
12
+ index: NotRequired[int]
13
+
14
+
15
+ class EmbeddingResponseData(BaseModel):
16
+ object: Optional[str] = None
17
+ embedding: Optional[List[float]] = None
18
+ index: Optional[int] = None
19
+
@@ -0,0 +1,50 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
+ from pydantic import model_serializer
6
+ from typing import Any, Dict, TypedDict
7
+ from typing_extensions import NotRequired
8
+
9
+
10
+ class EventOutTypedDict(TypedDict):
11
+ name: str
12
+ r"""The name of the event."""
13
+ created_at: int
14
+ r"""The UNIX timestamp (in seconds) of the event."""
15
+ data: NotRequired[Nullable[Dict[str, Any]]]
16
+
17
+
18
+ class EventOut(BaseModel):
19
+ name: str
20
+ r"""The name of the event."""
21
+ created_at: int
22
+ r"""The UNIX timestamp (in seconds) of the event."""
23
+ data: OptionalNullable[Dict[str, Any]] = UNSET
24
+
25
+ @model_serializer(mode="wrap")
26
+ def serialize_model(self, handler):
27
+ optional_fields = ["data"]
28
+ nullable_fields = ["data"]
29
+ null_default_fields = []
30
+
31
+ serialized = handler(self)
32
+
33
+ m = {}
34
+
35
+ for n, f in self.model_fields.items():
36
+ k = f.alias or n
37
+ val = serialized.get(k)
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
+
42
+ if val is not None and val != UNSET_SENTINEL:
43
+ m[k] = val
44
+ elif val != UNSET_SENTINEL and (
45
+ not k in optional_fields or (optional_nullable and is_set)
46
+ ):
47
+ m[k] = val
48
+
49
+ return m
50
+
@@ -0,0 +1,16 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel
5
+ from mistralai.utils import FieldMetadata, PathParamMetadata
6
+ from typing import TypedDict
7
+ from typing_extensions import Annotated
8
+
9
+
10
+ class FilesAPIRoutesDeleteFileRequestTypedDict(TypedDict):
11
+ file_id: str
12
+
13
+
14
+ class FilesAPIRoutesDeleteFileRequest(BaseModel):
15
+ file_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
16
+
@@ -0,0 +1,16 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel
5
+ from mistralai.utils import FieldMetadata, PathParamMetadata
6
+ from typing import TypedDict
7
+ from typing_extensions import Annotated
8
+
9
+
10
+ class FilesAPIRoutesRetrieveFileRequestTypedDict(TypedDict):
11
+ file_id: str
12
+
13
+
14
+ class FilesAPIRoutesRetrieveFileRequest(BaseModel):
15
+ file_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
16
+
@@ -0,0 +1,51 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ import io
5
+ from mistralai.types import BaseModel
6
+ from mistralai.utils import FieldMetadata, MultipartFormMetadata
7
+ import pydantic
8
+ from typing import Final, IO, Optional, TypedDict, Union
9
+ from typing_extensions import Annotated, NotRequired
10
+
11
+
12
+ class FileTypedDict(TypedDict):
13
+ file_name: str
14
+ content: Union[bytes, IO[bytes], io.BufferedReader]
15
+ content_type: NotRequired[str]
16
+
17
+
18
+ class File(BaseModel):
19
+ file_name: Annotated[str, pydantic.Field(alias="file"), FieldMetadata(multipart=True)]
20
+ content: Annotated[Union[bytes, IO[bytes], io.BufferedReader], pydantic.Field(alias=""), FieldMetadata(multipart=MultipartFormMetadata(content=True))]
21
+ content_type: Annotated[Optional[str], pydantic.Field(alias="Content-Type"), FieldMetadata(multipart=True)] = None
22
+
23
+
24
+ class FilesAPIRoutesUploadFileMultiPartBodyParamsTypedDict(TypedDict):
25
+ file: FileTypedDict
26
+ r"""The File object (not file name) to be uploaded.
27
+ To upload a file and specify a custom file name you should format your request as such:
28
+ ```bash
29
+ file=@path/to/your/file.jsonl;filename=custom_name.jsonl
30
+ ```
31
+ Otherwise, you can just keep the original file name:
32
+ ```bash
33
+ file=@path/to/your/file.jsonl
34
+ ```
35
+ """
36
+
37
+
38
+ class FilesAPIRoutesUploadFileMultiPartBodyParams(BaseModel):
39
+ file: Annotated[File, pydantic.Field(alias=""), FieldMetadata(multipart=MultipartFormMetadata(file=True))]
40
+ r"""The File object (not file name) to be uploaded.
41
+ To upload a file and specify a custom file name you should format your request as such:
42
+ ```bash
43
+ file=@path/to/your/file.jsonl;filename=custom_name.jsonl
44
+ ```
45
+ Otherwise, you can just keep the original file name:
46
+ ```bash
47
+ file=@path/to/your/file.jsonl
48
+ ```
49
+ """
50
+ PURPOSE: Annotated[Final[Optional[str]], pydantic.Field(alias="purpose"), FieldMetadata(multipart=True)] = "fine-tune" # type: ignore
51
+
@@ -0,0 +1,71 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .sampletype import SampleType
5
+ from .source import Source
6
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
7
+ import pydantic
8
+ from pydantic import model_serializer
9
+ from typing import Final, TypedDict
10
+ from typing_extensions import Annotated, NotRequired
11
+
12
+
13
+ class FileSchemaTypedDict(TypedDict):
14
+ id: str
15
+ r"""The unique identifier of the file."""
16
+ object: str
17
+ r"""The object type, which is always \"file\"."""
18
+ bytes: int
19
+ r"""The size of the file, in bytes."""
20
+ created_at: int
21
+ r"""The UNIX timestamp (in seconds) of the event."""
22
+ filename: str
23
+ r"""The name of the uploaded file."""
24
+ sample_type: SampleType
25
+ source: Source
26
+ num_lines: NotRequired[Nullable[int]]
27
+
28
+
29
+ class FileSchema(BaseModel):
30
+ id: str
31
+ r"""The unique identifier of the file."""
32
+ object: str
33
+ r"""The object type, which is always \"file\"."""
34
+ bytes: int
35
+ r"""The size of the file, in bytes."""
36
+ created_at: int
37
+ r"""The UNIX timestamp (in seconds) of the event."""
38
+ filename: str
39
+ r"""The name of the uploaded file."""
40
+ sample_type: SampleType
41
+ source: Source
42
+ PURPOSE: Annotated[Final[str], pydantic.Field(alias="purpose")] = "fine-tune" # type: ignore
43
+ r"""The intended purpose of the uploaded file. Only accepts fine-tuning (`fine-tune`) for now."""
44
+ num_lines: OptionalNullable[int] = UNSET
45
+
46
+ @model_serializer(mode="wrap")
47
+ def serialize_model(self, handler):
48
+ optional_fields = ["num_lines"]
49
+ nullable_fields = ["num_lines"]
50
+ null_default_fields = []
51
+
52
+ serialized = handler(self)
53
+
54
+ m = {}
55
+
56
+ for n, f in self.model_fields.items():
57
+ k = f.alias or n
58
+ val = serialized.get(k)
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
+
63
+ if val is not None and val != UNSET_SENTINEL:
64
+ m[k] = val
65
+ elif val != UNSET_SENTINEL and (
66
+ not k in optional_fields or (optional_nullable and is_set)
67
+ ):
68
+ m[k] = val
69
+
70
+ return m
71
+