mistralai 0.4.2__py3-none-any.whl → 0.5.5a50__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 (240) 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/async_client.py +5 -413
  9. mistralai/basesdk.py +216 -0
  10. mistralai/chat.py +475 -0
  11. mistralai/client.py +5 -414
  12. mistralai/embeddings.py +182 -0
  13. mistralai/files.py +600 -84
  14. mistralai/fim.py +439 -0
  15. mistralai/fine_tuning.py +855 -0
  16. mistralai/httpclient.py +78 -0
  17. mistralai/models/__init__.py +80 -0
  18. mistralai/models/archiveftmodelout.py +19 -0
  19. mistralai/models/assistantmessage.py +58 -0
  20. mistralai/models/chatcompletionchoice.py +33 -0
  21. mistralai/models/chatcompletionrequest.py +114 -0
  22. mistralai/models/chatcompletionresponse.py +27 -0
  23. mistralai/models/chatcompletionstreamrequest.py +112 -0
  24. mistralai/models/checkpointout.py +25 -0
  25. mistralai/models/completionchunk.py +27 -0
  26. mistralai/models/completionevent.py +15 -0
  27. mistralai/models/completionresponsestreamchoice.py +53 -0
  28. mistralai/models/contentchunk.py +17 -0
  29. mistralai/models/delete_model_v1_models_model_id_deleteop.py +16 -0
  30. mistralai/models/deletefileout.py +24 -0
  31. mistralai/models/deletemodelout.py +25 -0
  32. mistralai/models/deltamessage.py +52 -0
  33. mistralai/models/detailedjobout.py +96 -0
  34. mistralai/models/embeddingrequest.py +66 -0
  35. mistralai/models/embeddingresponse.py +24 -0
  36. mistralai/models/embeddingresponsedata.py +19 -0
  37. mistralai/models/eventout.py +55 -0
  38. mistralai/models/files_api_routes_delete_fileop.py +16 -0
  39. mistralai/models/files_api_routes_retrieve_fileop.py +16 -0
  40. mistralai/models/files_api_routes_upload_fileop.py +51 -0
  41. mistralai/models/fileschema.py +76 -0
  42. mistralai/models/fimcompletionrequest.py +99 -0
  43. mistralai/models/fimcompletionresponse.py +27 -0
  44. mistralai/models/fimcompletionstreamrequest.py +97 -0
  45. mistralai/models/finetuneablemodel.py +8 -0
  46. mistralai/models/ftmodelcapabilitiesout.py +21 -0
  47. mistralai/models/ftmodelout.py +70 -0
  48. mistralai/models/function.py +19 -0
  49. mistralai/models/functioncall.py +16 -0
  50. mistralai/models/githubrepositoryin.py +57 -0
  51. mistralai/models/githubrepositoryout.py +57 -0
  52. mistralai/models/httpvalidationerror.py +23 -0
  53. mistralai/models/jobin.py +78 -0
  54. mistralai/models/jobmetadataout.py +59 -0
  55. mistralai/models/jobout.py +112 -0
  56. mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +16 -0
  57. mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +18 -0
  58. mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +73 -0
  59. mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +18 -0
  60. mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +86 -0
  61. mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +16 -0
  62. mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +16 -0
  63. mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +19 -0
  64. mistralai/models/jobsout.py +20 -0
  65. mistralai/models/legacyjobmetadataout.py +85 -0
  66. mistralai/models/listfilesout.py +17 -0
  67. mistralai/models/metricout.py +55 -0
  68. mistralai/models/modelcapabilities.py +21 -0
  69. mistralai/models/modelcard.py +71 -0
  70. mistralai/models/modellist.py +18 -0
  71. mistralai/models/responseformat.py +18 -0
  72. mistralai/models/retrieve_model_v1_models_model_id_getop.py +16 -0
  73. mistralai/models/retrievefileout.py +76 -0
  74. mistralai/models/sampletype.py +7 -0
  75. mistralai/models/sdkerror.py +22 -0
  76. mistralai/models/security.py +16 -0
  77. mistralai/models/source.py +7 -0
  78. mistralai/models/systemmessage.py +26 -0
  79. mistralai/models/textchunk.py +17 -0
  80. mistralai/models/tool.py +18 -0
  81. mistralai/models/toolcall.py +20 -0
  82. mistralai/models/toolmessage.py +55 -0
  83. mistralai/models/trainingfile.py +17 -0
  84. mistralai/models/trainingparameters.py +53 -0
  85. mistralai/models/trainingparametersin.py +61 -0
  86. mistralai/models/unarchiveftmodelout.py +19 -0
  87. mistralai/models/updateftmodelin.py +49 -0
  88. mistralai/models/uploadfileout.py +76 -0
  89. mistralai/models/usageinfo.py +18 -0
  90. mistralai/models/usermessage.py +26 -0
  91. mistralai/models/validationerror.py +24 -0
  92. mistralai/models/wandbintegration.py +61 -0
  93. mistralai/models/wandbintegrationout.py +57 -0
  94. mistralai/models_.py +928 -0
  95. mistralai/py.typed +1 -0
  96. mistralai/sdk.py +111 -0
  97. mistralai/sdkconfiguration.py +53 -0
  98. mistralai/types/__init__.py +21 -0
  99. mistralai/types/basemodel.py +35 -0
  100. mistralai/utils/__init__.py +82 -0
  101. mistralai/utils/annotations.py +19 -0
  102. mistralai/utils/enums.py +34 -0
  103. mistralai/utils/eventstreaming.py +179 -0
  104. mistralai/utils/forms.py +207 -0
  105. mistralai/utils/headers.py +136 -0
  106. mistralai/utils/metadata.py +118 -0
  107. mistralai/utils/queryparams.py +203 -0
  108. mistralai/utils/requestbodies.py +66 -0
  109. mistralai/utils/retries.py +216 -0
  110. mistralai/utils/security.py +182 -0
  111. mistralai/utils/serializers.py +181 -0
  112. mistralai/utils/url.py +150 -0
  113. mistralai/utils/values.py +128 -0
  114. {mistralai-0.4.2.dist-info → mistralai-0.5.5a50.dist-info}/LICENSE +1 -1
  115. mistralai-0.5.5a50.dist-info/METADATA +626 -0
  116. mistralai-0.5.5a50.dist-info/RECORD +228 -0
  117. mistralai_azure/__init__.py +5 -0
  118. mistralai_azure/_hooks/__init__.py +5 -0
  119. mistralai_azure/_hooks/custom_user_agent.py +16 -0
  120. mistralai_azure/_hooks/registration.py +15 -0
  121. mistralai_azure/_hooks/sdkhooks.py +57 -0
  122. mistralai_azure/_hooks/types.py +76 -0
  123. mistralai_azure/basesdk.py +215 -0
  124. mistralai_azure/chat.py +475 -0
  125. mistralai_azure/httpclient.py +78 -0
  126. mistralai_azure/models/__init__.py +28 -0
  127. mistralai_azure/models/assistantmessage.py +58 -0
  128. mistralai_azure/models/chatcompletionchoice.py +33 -0
  129. mistralai_azure/models/chatcompletionrequest.py +114 -0
  130. mistralai_azure/models/chatcompletionresponse.py +27 -0
  131. mistralai_azure/models/chatcompletionstreamrequest.py +112 -0
  132. mistralai_azure/models/completionchunk.py +27 -0
  133. mistralai_azure/models/completionevent.py +15 -0
  134. mistralai_azure/models/completionresponsestreamchoice.py +53 -0
  135. mistralai_azure/models/contentchunk.py +17 -0
  136. mistralai_azure/models/deltamessage.py +52 -0
  137. mistralai_azure/models/function.py +19 -0
  138. mistralai_azure/models/functioncall.py +16 -0
  139. mistralai_azure/models/httpvalidationerror.py +23 -0
  140. mistralai_azure/models/responseformat.py +18 -0
  141. mistralai_azure/models/sdkerror.py +22 -0
  142. mistralai_azure/models/security.py +16 -0
  143. mistralai_azure/models/systemmessage.py +26 -0
  144. mistralai_azure/models/textchunk.py +17 -0
  145. mistralai_azure/models/tool.py +18 -0
  146. mistralai_azure/models/toolcall.py +20 -0
  147. mistralai_azure/models/toolmessage.py +55 -0
  148. mistralai_azure/models/usageinfo.py +18 -0
  149. mistralai_azure/models/usermessage.py +26 -0
  150. mistralai_azure/models/validationerror.py +24 -0
  151. mistralai_azure/py.typed +1 -0
  152. mistralai_azure/sdk.py +102 -0
  153. mistralai_azure/sdkconfiguration.py +53 -0
  154. mistralai_azure/types/__init__.py +21 -0
  155. mistralai_azure/types/basemodel.py +35 -0
  156. mistralai_azure/utils/__init__.py +80 -0
  157. mistralai_azure/utils/annotations.py +19 -0
  158. mistralai_azure/utils/enums.py +34 -0
  159. mistralai_azure/utils/eventstreaming.py +179 -0
  160. mistralai_azure/utils/forms.py +207 -0
  161. mistralai_azure/utils/headers.py +136 -0
  162. mistralai_azure/utils/metadata.py +118 -0
  163. mistralai_azure/utils/queryparams.py +203 -0
  164. mistralai_azure/utils/requestbodies.py +66 -0
  165. mistralai_azure/utils/retries.py +216 -0
  166. mistralai_azure/utils/security.py +168 -0
  167. mistralai_azure/utils/serializers.py +181 -0
  168. mistralai_azure/utils/url.py +150 -0
  169. mistralai_azure/utils/values.py +128 -0
  170. mistralai_gcp/__init__.py +5 -0
  171. mistralai_gcp/_hooks/__init__.py +5 -0
  172. mistralai_gcp/_hooks/custom_user_agent.py +16 -0
  173. mistralai_gcp/_hooks/registration.py +15 -0
  174. mistralai_gcp/_hooks/sdkhooks.py +57 -0
  175. mistralai_gcp/_hooks/types.py +76 -0
  176. mistralai_gcp/basesdk.py +215 -0
  177. mistralai_gcp/chat.py +463 -0
  178. mistralai_gcp/fim.py +439 -0
  179. mistralai_gcp/httpclient.py +78 -0
  180. mistralai_gcp/models/__init__.py +31 -0
  181. mistralai_gcp/models/assistantmessage.py +58 -0
  182. mistralai_gcp/models/chatcompletionchoice.py +33 -0
  183. mistralai_gcp/models/chatcompletionrequest.py +110 -0
  184. mistralai_gcp/models/chatcompletionresponse.py +27 -0
  185. mistralai_gcp/models/chatcompletionstreamrequest.py +108 -0
  186. mistralai_gcp/models/completionchunk.py +27 -0
  187. mistralai_gcp/models/completionevent.py +15 -0
  188. mistralai_gcp/models/completionresponsestreamchoice.py +53 -0
  189. mistralai_gcp/models/contentchunk.py +17 -0
  190. mistralai_gcp/models/deltamessage.py +52 -0
  191. mistralai_gcp/models/fimcompletionrequest.py +99 -0
  192. mistralai_gcp/models/fimcompletionresponse.py +27 -0
  193. mistralai_gcp/models/fimcompletionstreamrequest.py +97 -0
  194. mistralai_gcp/models/function.py +19 -0
  195. mistralai_gcp/models/functioncall.py +16 -0
  196. mistralai_gcp/models/httpvalidationerror.py +23 -0
  197. mistralai_gcp/models/responseformat.py +18 -0
  198. mistralai_gcp/models/sdkerror.py +22 -0
  199. mistralai_gcp/models/security.py +16 -0
  200. mistralai_gcp/models/systemmessage.py +26 -0
  201. mistralai_gcp/models/textchunk.py +17 -0
  202. mistralai_gcp/models/tool.py +18 -0
  203. mistralai_gcp/models/toolcall.py +20 -0
  204. mistralai_gcp/models/toolmessage.py +55 -0
  205. mistralai_gcp/models/usageinfo.py +18 -0
  206. mistralai_gcp/models/usermessage.py +26 -0
  207. mistralai_gcp/models/validationerror.py +24 -0
  208. mistralai_gcp/py.typed +1 -0
  209. mistralai_gcp/sdk.py +165 -0
  210. mistralai_gcp/sdkconfiguration.py +53 -0
  211. mistralai_gcp/types/__init__.py +21 -0
  212. mistralai_gcp/types/basemodel.py +35 -0
  213. mistralai_gcp/utils/__init__.py +80 -0
  214. mistralai_gcp/utils/annotations.py +19 -0
  215. mistralai_gcp/utils/enums.py +34 -0
  216. mistralai_gcp/utils/eventstreaming.py +179 -0
  217. mistralai_gcp/utils/forms.py +207 -0
  218. mistralai_gcp/utils/headers.py +136 -0
  219. mistralai_gcp/utils/metadata.py +118 -0
  220. mistralai_gcp/utils/queryparams.py +203 -0
  221. mistralai_gcp/utils/requestbodies.py +66 -0
  222. mistralai_gcp/utils/retries.py +216 -0
  223. mistralai_gcp/utils/security.py +168 -0
  224. mistralai_gcp/utils/serializers.py +181 -0
  225. mistralai_gcp/utils/url.py +150 -0
  226. mistralai_gcp/utils/values.py +128 -0
  227. py.typed +1 -0
  228. mistralai/client_base.py +0 -211
  229. mistralai/constants.py +0 -5
  230. mistralai/exceptions.py +0 -54
  231. mistralai/jobs.py +0 -172
  232. mistralai/models/chat_completion.py +0 -93
  233. mistralai/models/common.py +0 -9
  234. mistralai/models/embeddings.py +0 -19
  235. mistralai/models/files.py +0 -23
  236. mistralai/models/jobs.py +0 -100
  237. mistralai/models/models.py +0 -39
  238. mistralai-0.4.2.dist-info/METADATA +0 -82
  239. mistralai-0.4.2.dist-info/RECORD +0 -20
  240. {mistralai-0.4.2.dist-info → mistralai-0.5.5a50.dist-info}/WHEEL +0 -0
@@ -0,0 +1,18 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .modelcard import ModelCard, ModelCardTypedDict
5
+ from mistralai.types import BaseModel
6
+ from typing import List, Optional, TypedDict
7
+ from typing_extensions import NotRequired
8
+
9
+
10
+ class ModelListTypedDict(TypedDict):
11
+ object: NotRequired[str]
12
+ data: NotRequired[List[ModelCardTypedDict]]
13
+
14
+
15
+ class ModelList(BaseModel):
16
+ object: Optional[str] = "list"
17
+ data: Optional[List[ModelCard]] = None
18
+
@@ -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 typing import Literal, Optional, TypedDict
6
+ from typing_extensions import NotRequired
7
+
8
+
9
+ ResponseFormats = Literal["text", "json_object"]
10
+ r"""An object specifying the format that the model must output. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message."""
11
+
12
+ class ResponseFormatTypedDict(TypedDict):
13
+ type: NotRequired[ResponseFormats]
14
+
15
+
16
+ class ResponseFormat(BaseModel):
17
+ type: Optional[ResponseFormats] = "text"
18
+
@@ -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 RetrieveModelV1ModelsModelIDGetRequestTypedDict(TypedDict):
11
+ model_id: str
12
+
13
+
14
+ class RetrieveModelV1ModelsModelIDGetRequest(BaseModel):
15
+ model_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
16
+
@@ -0,0 +1,76 @@
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 RetrieveFileOutTypedDict(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 RetrieveFileOut(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
+ if val is not None and val != UNSET_SENTINEL:
61
+ m[k] = val
62
+ 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
+ )
72
+ ):
73
+ m[k] = val
74
+
75
+ return m
76
+
@@ -0,0 +1,7 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from typing import Literal
5
+
6
+
7
+ SampleType = Literal["pretrain", "instruct"]
@@ -0,0 +1,22 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from dataclasses import dataclass
4
+ from typing import Optional
5
+ import httpx
6
+
7
+
8
+ @dataclass
9
+ class SDKError(Exception):
10
+ """Represents an error returned by the API."""
11
+
12
+ message: str
13
+ status_code: int = -1
14
+ body: str = ""
15
+ raw_response: Optional[httpx.Response] = None
16
+
17
+ def __str__(self):
18
+ body = ""
19
+ if len(self.body) > 0:
20
+ body = f"\n{self.body}"
21
+
22
+ return f"{self.message}: Status {self.status_code}{body}"
@@ -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, SecurityMetadata
6
+ from typing import TypedDict
7
+ from typing_extensions import Annotated
8
+
9
+
10
+ class SecurityTypedDict(TypedDict):
11
+ api_key: str
12
+
13
+
14
+ class Security(BaseModel):
15
+ api_key: Annotated[str, FieldMetadata(security=SecurityMetadata(scheme=True, scheme_type="http", sub_type="bearer", field_name="Authorization"))]
16
+
@@ -0,0 +1,7 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from typing import Literal
5
+
6
+
7
+ Source = Literal["upload", "repository"]
@@ -0,0 +1,26 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .contentchunk import ContentChunk, ContentChunkTypedDict
5
+ from mistralai.types import BaseModel
6
+ from typing import List, Literal, Optional, TypedDict, Union
7
+ from typing_extensions import NotRequired
8
+
9
+
10
+ Role = Literal["system"]
11
+
12
+ class SystemMessageTypedDict(TypedDict):
13
+ content: ContentTypedDict
14
+ role: NotRequired[Role]
15
+
16
+
17
+ class SystemMessage(BaseModel):
18
+ content: Content
19
+ role: Optional[Role] = "system"
20
+
21
+
22
+ ContentTypedDict = Union[str, List[ContentChunkTypedDict]]
23
+
24
+
25
+ Content = Union[str, List[ContentChunk]]
26
+
@@ -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 TextChunkTypedDict(TypedDict):
11
+ text: str
12
+
13
+
14
+ class TextChunk(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 .function import Function, FunctionTypedDict
5
+ from mistralai.types import BaseModel
6
+ import pydantic
7
+ from typing import Final, Optional, TypedDict
8
+ from typing_extensions import Annotated
9
+
10
+
11
+ class ToolTypedDict(TypedDict):
12
+ function: FunctionTypedDict
13
+
14
+
15
+ class Tool(BaseModel):
16
+ function: Function
17
+ TYPE: Annotated[Final[Optional[str]], pydantic.Field(alias="type")] = "function" # type: ignore
18
+
@@ -0,0 +1,20 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .functioncall import FunctionCall, FunctionCallTypedDict
5
+ from mistralai.types import BaseModel
6
+ import pydantic
7
+ from typing import Final, Optional, TypedDict
8
+ from typing_extensions import Annotated, NotRequired
9
+
10
+
11
+ class ToolCallTypedDict(TypedDict):
12
+ function: FunctionCallTypedDict
13
+ id: NotRequired[str]
14
+
15
+
16
+ class ToolCall(BaseModel):
17
+ function: FunctionCall
18
+ id: Optional[str] = "null"
19
+ TYPE: Annotated[Final[Optional[str]], pydantic.Field(alias="type")] = "function" # type: ignore
20
+
@@ -0,0 +1,55 @@
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 Literal, Optional, TypedDict
7
+ from typing_extensions import NotRequired
8
+
9
+
10
+ ToolMessageRole = Literal["tool"]
11
+
12
+ class ToolMessageTypedDict(TypedDict):
13
+ content: str
14
+ tool_call_id: NotRequired[Nullable[str]]
15
+ name: NotRequired[Nullable[str]]
16
+ role: NotRequired[ToolMessageRole]
17
+
18
+
19
+ class ToolMessage(BaseModel):
20
+ content: str
21
+ tool_call_id: OptionalNullable[str] = UNSET
22
+ name: OptionalNullable[str] = UNSET
23
+ role: Optional[ToolMessageRole] = "tool"
24
+
25
+ @model_serializer(mode="wrap")
26
+ def serialize_model(self, handler):
27
+ optional_fields = ["tool_call_id", "name", "role"]
28
+ nullable_fields = ["tool_call_id", "name"]
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
+ 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
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
+ )
51
+ ):
52
+ m[k] = val
53
+
54
+ return m
55
+
@@ -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
+ from typing import Optional, TypedDict
6
+ from typing_extensions import NotRequired
7
+
8
+
9
+ class TrainingFileTypedDict(TypedDict):
10
+ file_id: str
11
+ weight: NotRequired[float]
12
+
13
+
14
+ class TrainingFile(BaseModel):
15
+ file_id: str
16
+ weight: Optional[float] = 1
17
+
@@ -0,0 +1,53 @@
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 Optional, TypedDict
7
+ from typing_extensions import NotRequired
8
+
9
+
10
+ class TrainingParametersTypedDict(TypedDict):
11
+ training_steps: NotRequired[Nullable[int]]
12
+ learning_rate: NotRequired[float]
13
+ epochs: NotRequired[Nullable[float]]
14
+ fim_ratio: NotRequired[Nullable[float]]
15
+
16
+
17
+ class TrainingParameters(BaseModel):
18
+ training_steps: OptionalNullable[int] = UNSET
19
+ learning_rate: Optional[float] = 0.0001
20
+ epochs: OptionalNullable[float] = UNSET
21
+ fim_ratio: OptionalNullable[float] = UNSET
22
+
23
+ @model_serializer(mode="wrap")
24
+ def serialize_model(self, handler):
25
+ optional_fields = ["training_steps", "learning_rate", "epochs", "fim_ratio"]
26
+ nullable_fields = ["training_steps", "epochs", "fim_ratio"]
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
+ if val is not None and val != UNSET_SENTINEL:
38
+ m[k] = val
39
+ 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
+ )
49
+ ):
50
+ m[k] = val
51
+
52
+ return m
53
+
@@ -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
+ from pydantic import model_serializer
6
+ from typing import Optional, TypedDict
7
+ from typing_extensions import NotRequired
8
+
9
+
10
+ class TrainingParametersInTypedDict(TypedDict):
11
+ r"""The fine-tuning hyperparameter settings used in a fine-tune job."""
12
+
13
+ training_steps: NotRequired[Nullable[int]]
14
+ r"""The number of training steps to perform. A training step refers to a single update of the model weights during the fine-tuning process. This update is typically calculated using a batch of samples from the training dataset."""
15
+ learning_rate: NotRequired[float]
16
+ r"""A parameter describing how much to adjust the pre-trained model's weights in response to the estimated error each time the weights are updated during the fine-tuning process."""
17
+ epochs: NotRequired[Nullable[float]]
18
+ fim_ratio: NotRequired[Nullable[float]]
19
+
20
+
21
+ class TrainingParametersIn(BaseModel):
22
+ r"""The fine-tuning hyperparameter settings used in a fine-tune job."""
23
+
24
+ training_steps: OptionalNullable[int] = UNSET
25
+ r"""The number of training steps to perform. A training step refers to a single update of the model weights during the fine-tuning process. This update is typically calculated using a batch of samples from the training dataset."""
26
+ learning_rate: Optional[float] = 0.0001
27
+ r"""A parameter describing how much to adjust the pre-trained model's weights in response to the estimated error each time the weights are updated during the fine-tuning process."""
28
+ epochs: OptionalNullable[float] = UNSET
29
+ fim_ratio: OptionalNullable[float] = UNSET
30
+
31
+ @model_serializer(mode="wrap")
32
+ def serialize_model(self, handler):
33
+ optional_fields = ["training_steps", "learning_rate", "epochs", "fim_ratio"]
34
+ nullable_fields = ["training_steps", "epochs", "fim_ratio"]
35
+ null_default_fields = []
36
+
37
+ serialized = handler(self)
38
+
39
+ m = {}
40
+
41
+ for n, f in self.model_fields.items():
42
+ k = f.alias or n
43
+ val = serialized.get(k)
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
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
+ )
57
+ ):
58
+ m[k] = val
59
+
60
+ return m
61
+
@@ -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
+ import pydantic
6
+ from typing import Final, Optional, TypedDict
7
+ from typing_extensions import Annotated, NotRequired
8
+
9
+
10
+ class UnarchiveFTModelOutTypedDict(TypedDict):
11
+ id: str
12
+ archived: NotRequired[bool]
13
+
14
+
15
+ class UnarchiveFTModelOut(BaseModel):
16
+ id: str
17
+ OBJECT: Annotated[Final[Optional[str]], pydantic.Field(alias="object")] = "model" # type: ignore
18
+ archived: Optional[bool] = False
19
+
@@ -0,0 +1,49 @@
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 TypedDict
7
+ from typing_extensions import NotRequired
8
+
9
+
10
+ class UpdateFTModelInTypedDict(TypedDict):
11
+ name: NotRequired[Nullable[str]]
12
+ description: NotRequired[Nullable[str]]
13
+
14
+
15
+ class UpdateFTModelIn(BaseModel):
16
+ name: OptionalNullable[str] = UNSET
17
+ description: OptionalNullable[str] = UNSET
18
+
19
+ @model_serializer(mode="wrap")
20
+ def serialize_model(self, handler):
21
+ optional_fields = ["name", "description"]
22
+ nullable_fields = ["name", "description"]
23
+ null_default_fields = []
24
+
25
+ serialized = handler(self)
26
+
27
+ m = {}
28
+
29
+ for n, f in self.model_fields.items():
30
+ k = f.alias or n
31
+ val = serialized.get(k)
32
+
33
+ if val is not None and val != UNSET_SENTINEL:
34
+ m[k] = val
35
+ 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
+ )
45
+ ):
46
+ m[k] = val
47
+
48
+ return m
49
+
@@ -0,0 +1,76 @@
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 UploadFileOutTypedDict(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 UploadFileOut(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
+ if val is not None and val != UNSET_SENTINEL:
61
+ m[k] = val
62
+ 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
+ )
72
+ ):
73
+ m[k] = val
74
+
75
+ return m
76
+
@@ -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 typing import TypedDict
6
+
7
+
8
+ class UsageInfoTypedDict(TypedDict):
9
+ prompt_tokens: int
10
+ completion_tokens: int
11
+ total_tokens: int
12
+
13
+
14
+ class UsageInfo(BaseModel):
15
+ prompt_tokens: int
16
+ completion_tokens: int
17
+ total_tokens: int
18
+
@@ -0,0 +1,26 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .textchunk import TextChunk, TextChunkTypedDict
5
+ from mistralai.types import BaseModel
6
+ from typing import List, Literal, Optional, TypedDict, Union
7
+ from typing_extensions import NotRequired
8
+
9
+
10
+ UserMessageRole = Literal["user"]
11
+
12
+ class UserMessageTypedDict(TypedDict):
13
+ content: UserMessageContentTypedDict
14
+ role: NotRequired[UserMessageRole]
15
+
16
+
17
+ class UserMessage(BaseModel):
18
+ content: UserMessageContent
19
+ role: Optional[UserMessageRole] = "user"
20
+
21
+
22
+ UserMessageContentTypedDict = Union[str, List[TextChunkTypedDict]]
23
+
24
+
25
+ UserMessageContent = Union[str, List[TextChunk]]
26
+