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,107 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .finetuneablemodel import FineTuneableModel
5
+ from .githubrepositoryout import GithubRepositoryOut, GithubRepositoryOutTypedDict
6
+ from .jobmetadataout import JobMetadataOut, JobMetadataOutTypedDict
7
+ from .trainingparameters import TrainingParameters, TrainingParametersTypedDict
8
+ from .wandbintegrationout import WandbIntegrationOut, WandbIntegrationOutTypedDict
9
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
10
+ import pydantic
11
+ from pydantic import model_serializer
12
+ from typing import Final, List, Literal, Optional, TypedDict
13
+ from typing_extensions import Annotated, NotRequired
14
+
15
+
16
+ Status = Literal["QUEUED", "STARTED", "VALIDATING", "VALIDATED", "RUNNING", "FAILED_VALIDATION", "FAILED", "SUCCESS", "CANCELLED", "CANCELLATION_REQUESTED"]
17
+ r"""The current status of the fine-tuning job."""
18
+
19
+ class JobOutTypedDict(TypedDict):
20
+ id: str
21
+ r"""The ID of the job."""
22
+ auto_start: bool
23
+ hyperparameters: TrainingParametersTypedDict
24
+ model: FineTuneableModel
25
+ r"""The name of the model to fine-tune."""
26
+ status: Status
27
+ r"""The current status of the fine-tuning job."""
28
+ job_type: str
29
+ r"""The type of job (`FT` for fine-tuning)."""
30
+ created_at: int
31
+ r"""The UNIX timestamp (in seconds) for when the fine-tuning job was created."""
32
+ modified_at: int
33
+ r"""The UNIX timestamp (in seconds) for when the fine-tuning job was last modified."""
34
+ training_files: List[str]
35
+ r"""A list containing the IDs of uploaded files that contain training data."""
36
+ validation_files: NotRequired[Nullable[List[str]]]
37
+ r"""A list containing the IDs of uploaded files that contain validation data."""
38
+ fine_tuned_model: NotRequired[Nullable[str]]
39
+ r"""The name of the fine-tuned model that is being created. The value will be `null` if the fine-tuning job is still running."""
40
+ suffix: NotRequired[Nullable[str]]
41
+ r"""Optional text/code that adds more context for the model. When given a `prompt` and a `suffix` the model will fill what is between them. When `suffix` is not provided, the model will simply execute completion starting with `prompt`."""
42
+ integrations: NotRequired[Nullable[List[WandbIntegrationOutTypedDict]]]
43
+ r"""A list of integrations enabled for your fine-tuning job."""
44
+ trained_tokens: NotRequired[Nullable[int]]
45
+ r"""Total number of tokens trained."""
46
+ repositories: NotRequired[List[GithubRepositoryOutTypedDict]]
47
+ metadata: NotRequired[Nullable[JobMetadataOutTypedDict]]
48
+
49
+
50
+ class JobOut(BaseModel):
51
+ id: str
52
+ r"""The ID of the job."""
53
+ auto_start: bool
54
+ hyperparameters: TrainingParameters
55
+ model: FineTuneableModel
56
+ r"""The name of the model to fine-tune."""
57
+ status: Status
58
+ r"""The current status of the fine-tuning job."""
59
+ job_type: str
60
+ r"""The type of job (`FT` for fine-tuning)."""
61
+ created_at: int
62
+ r"""The UNIX timestamp (in seconds) for when the fine-tuning job was created."""
63
+ modified_at: int
64
+ r"""The UNIX timestamp (in seconds) for when the fine-tuning job was last modified."""
65
+ training_files: List[str]
66
+ r"""A list containing the IDs of uploaded files that contain training data."""
67
+ validation_files: OptionalNullable[List[str]] = UNSET
68
+ r"""A list containing the IDs of uploaded files that contain validation data."""
69
+ OBJECT: Annotated[Final[Optional[str]], pydantic.Field(alias="object")] = "job" # type: ignore
70
+ r"""The object type of the fine-tuning job."""
71
+ fine_tuned_model: OptionalNullable[str] = UNSET
72
+ r"""The name of the fine-tuned model that is being created. The value will be `null` if the fine-tuning job is still running."""
73
+ suffix: OptionalNullable[str] = UNSET
74
+ r"""Optional text/code that adds more context for the model. When given a `prompt` and a `suffix` the model will fill what is between them. When `suffix` is not provided, the model will simply execute completion starting with `prompt`."""
75
+ integrations: OptionalNullable[List[WandbIntegrationOut]] = UNSET
76
+ r"""A list of integrations enabled for your fine-tuning job."""
77
+ trained_tokens: OptionalNullable[int] = UNSET
78
+ r"""Total number of tokens trained."""
79
+ repositories: Optional[List[GithubRepositoryOut]] = None
80
+ metadata: OptionalNullable[JobMetadataOut] = UNSET
81
+
82
+ @model_serializer(mode="wrap")
83
+ def serialize_model(self, handler):
84
+ optional_fields = ["validation_files", "object", "fine_tuned_model", "suffix", "integrations", "trained_tokens", "repositories", "metadata"]
85
+ nullable_fields = ["validation_files", "fine_tuned_model", "suffix", "integrations", "trained_tokens", "metadata"]
86
+ null_default_fields = []
87
+
88
+ serialized = handler(self)
89
+
90
+ m = {}
91
+
92
+ for n, f in self.model_fields.items():
93
+ k = f.alias or n
94
+ val = serialized.get(k)
95
+
96
+ optional_nullable = k in optional_fields and k in nullable_fields
97
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
98
+
99
+ if val is not None and val != UNSET_SENTINEL:
100
+ m[k] = val
101
+ elif val != UNSET_SENTINEL and (
102
+ not k in optional_fields or (optional_nullable and is_set)
103
+ ):
104
+ m[k] = val
105
+
106
+ return m
107
+
@@ -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 JobsAPIRoutesFineTuningArchiveFineTunedModelRequestTypedDict(TypedDict):
11
+ model_id: str
12
+ r"""The ID of the model to archive."""
13
+
14
+
15
+ class JobsAPIRoutesFineTuningArchiveFineTunedModelRequest(BaseModel):
16
+ model_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
17
+ r"""The ID of the model to archive."""
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 mistralai.utils import FieldMetadata, PathParamMetadata
6
+ from typing import TypedDict
7
+ from typing_extensions import Annotated
8
+
9
+
10
+ class JobsAPIRoutesFineTuningCancelFineTuningJobRequestTypedDict(TypedDict):
11
+ job_id: str
12
+ r"""The ID of the job to cancel."""
13
+
14
+
15
+ class JobsAPIRoutesFineTuningCancelFineTuningJobRequest(BaseModel):
16
+ job_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
17
+ r"""The ID of the job to cancel."""
18
+
@@ -0,0 +1,15 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .jobout import JobOut, JobOutTypedDict
5
+ from .legacyjobmetadataout import LegacyJobMetadataOut, LegacyJobMetadataOutTypedDict
6
+ from typing import Union
7
+
8
+
9
+ JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict = Union[LegacyJobMetadataOutTypedDict, JobOutTypedDict]
10
+ r"""OK"""
11
+
12
+
13
+ JobsAPIRoutesFineTuningCreateFineTuningJobResponse = Union[LegacyJobMetadataOut, JobOut]
14
+ r"""OK"""
15
+
@@ -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 JobsAPIRoutesFineTuningGetFineTuningJobRequestTypedDict(TypedDict):
11
+ job_id: str
12
+ r"""The ID of the job to analyse."""
13
+
14
+
15
+ class JobsAPIRoutesFineTuningGetFineTuningJobRequest(BaseModel):
16
+ job_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
17
+ r"""The ID of the job to analyse."""
18
+
@@ -0,0 +1,81 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from datetime import datetime
5
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
6
+ from mistralai.utils import FieldMetadata, QueryParamMetadata
7
+ from pydantic import model_serializer
8
+ from typing import Literal, Optional, TypedDict
9
+ from typing_extensions import Annotated, NotRequired
10
+
11
+
12
+ QueryParamStatus = Literal["QUEUED", "STARTED", "VALIDATING", "VALIDATED", "RUNNING", "FAILED_VALIDATION", "FAILED", "SUCCESS", "CANCELLED", "CANCELLATION_REQUESTED"]
13
+ r"""The current job state to filter on. When set, the other results are not displayed."""
14
+
15
+ class JobsAPIRoutesFineTuningGetFineTuningJobsRequestTypedDict(TypedDict):
16
+ page: NotRequired[int]
17
+ r"""The page number of the results to be returned."""
18
+ page_size: NotRequired[int]
19
+ r"""The number of items to return per page."""
20
+ model: NotRequired[Nullable[str]]
21
+ r"""The model name used for fine-tuning to filter on. When set, the other results are not displayed."""
22
+ created_after: NotRequired[Nullable[datetime]]
23
+ r"""The date/time to filter on. When set, the results for previous creation times are not displayed."""
24
+ created_by_me: NotRequired[bool]
25
+ r"""When set, only return results for jobs created by the API caller. Other results are not displayed."""
26
+ status: NotRequired[Nullable[QueryParamStatus]]
27
+ r"""The current job state to filter on. When set, the other results are not displayed."""
28
+ wandb_project: NotRequired[Nullable[str]]
29
+ r"""The Weights and Biases project to filter on. When set, the other results are not displayed."""
30
+ wandb_name: NotRequired[Nullable[str]]
31
+ r"""The Weight and Biases run name to filter on. When set, the other results are not displayed."""
32
+ suffix: NotRequired[Nullable[str]]
33
+ r"""The model suffix to filter on. When set, the other results are not displayed."""
34
+
35
+
36
+ class JobsAPIRoutesFineTuningGetFineTuningJobsRequest(BaseModel):
37
+ page: Annotated[Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True))] = 0
38
+ r"""The page number of the results to be returned."""
39
+ page_size: Annotated[Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True))] = 100
40
+ r"""The number of items to return per page."""
41
+ model: Annotated[OptionalNullable[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True))] = UNSET
42
+ r"""The model name used for fine-tuning to filter on. When set, the other results are not displayed."""
43
+ created_after: Annotated[OptionalNullable[datetime], FieldMetadata(query=QueryParamMetadata(style="form", explode=True))] = UNSET
44
+ r"""The date/time to filter on. When set, the results for previous creation times are not displayed."""
45
+ created_by_me: Annotated[Optional[bool], FieldMetadata(query=QueryParamMetadata(style="form", explode=True))] = False
46
+ r"""When set, only return results for jobs created by the API caller. Other results are not displayed."""
47
+ status: Annotated[OptionalNullable[QueryParamStatus], FieldMetadata(query=QueryParamMetadata(style="form", explode=True))] = UNSET
48
+ r"""The current job state to filter on. When set, the other results are not displayed."""
49
+ wandb_project: Annotated[OptionalNullable[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True))] = UNSET
50
+ r"""The Weights and Biases project to filter on. When set, the other results are not displayed."""
51
+ wandb_name: Annotated[OptionalNullable[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True))] = UNSET
52
+ r"""The Weight and Biases run name to filter on. When set, the other results are not displayed."""
53
+ suffix: Annotated[OptionalNullable[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True))] = UNSET
54
+ r"""The model suffix to filter on. When set, the other results are not displayed."""
55
+
56
+ @model_serializer(mode="wrap")
57
+ def serialize_model(self, handler):
58
+ optional_fields = ["page", "page_size", "model", "created_after", "created_by_me", "status", "wandb_project", "wandb_name", "suffix"]
59
+ nullable_fields = ["model", "created_after", "status", "wandb_project", "wandb_name", "suffix"]
60
+ null_default_fields = []
61
+
62
+ serialized = handler(self)
63
+
64
+ m = {}
65
+
66
+ for n, f in self.model_fields.items():
67
+ k = f.alias or n
68
+ val = serialized.get(k)
69
+
70
+ optional_nullable = k in optional_fields and k in nullable_fields
71
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
72
+
73
+ if val is not None and val != UNSET_SENTINEL:
74
+ m[k] = val
75
+ elif val != UNSET_SENTINEL and (
76
+ not k in optional_fields or (optional_nullable and is_set)
77
+ ):
78
+ m[k] = val
79
+
80
+ return m
81
+
@@ -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 JobsAPIRoutesFineTuningStartFineTuningJobRequestTypedDict(TypedDict):
11
+ job_id: str
12
+
13
+
14
+ class JobsAPIRoutesFineTuningStartFineTuningJobRequest(BaseModel):
15
+ job_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
16
+
@@ -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 JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequestTypedDict(TypedDict):
11
+ model_id: str
12
+ r"""The ID of the model to unarchive."""
13
+
14
+
15
+ class JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequest(BaseModel):
16
+ model_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
17
+ r"""The ID of the model to unarchive."""
18
+
@@ -0,0 +1,21 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .updateftmodelin import UpdateFTModelIn, UpdateFTModelInTypedDict
5
+ from mistralai.types import BaseModel
6
+ from mistralai.utils import FieldMetadata, PathParamMetadata, RequestMetadata
7
+ from typing import TypedDict
8
+ from typing_extensions import Annotated
9
+
10
+
11
+ class JobsAPIRoutesFineTuningUpdateFineTunedModelRequestTypedDict(TypedDict):
12
+ model_id: str
13
+ r"""The ID of the model to update."""
14
+ update_ft_model_in: UpdateFTModelInTypedDict
15
+
16
+
17
+ class JobsAPIRoutesFineTuningUpdateFineTunedModelRequest(BaseModel):
18
+ model_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
19
+ r"""The ID of the model to update."""
20
+ update_ft_model_in: Annotated[UpdateFTModelIn, FieldMetadata(request=RequestMetadata(media_type="application/json"))]
21
+
@@ -0,0 +1,20 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .jobout import JobOut, JobOutTypedDict
5
+ from mistralai.types import BaseModel
6
+ import pydantic
7
+ from typing import Final, List, Optional, TypedDict
8
+ from typing_extensions import Annotated, NotRequired
9
+
10
+
11
+ class JobsOutTypedDict(TypedDict):
12
+ total: int
13
+ data: NotRequired[List[JobOutTypedDict]]
14
+
15
+
16
+ class JobsOut(BaseModel):
17
+ total: int
18
+ data: Optional[List[JobOut]] = None
19
+ OBJECT: Annotated[Final[Optional[str]], pydantic.Field(alias="object")] = "list" # type: ignore
20
+
@@ -0,0 +1,80 @@
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 Final, Optional, TypedDict
8
+ from typing_extensions import Annotated, NotRequired
9
+
10
+
11
+ class LegacyJobMetadataOutTypedDict(TypedDict):
12
+ details: str
13
+ expected_duration_seconds: NotRequired[Nullable[int]]
14
+ r"""The approximated time (in seconds) for the fine-tuning process to complete."""
15
+ cost: NotRequired[Nullable[float]]
16
+ r"""The cost of the fine-tuning job."""
17
+ cost_currency: NotRequired[Nullable[str]]
18
+ r"""The currency used for the fine-tuning job cost."""
19
+ train_tokens_per_step: NotRequired[Nullable[int]]
20
+ r"""The number of tokens consumed by one training step."""
21
+ train_tokens: NotRequired[Nullable[int]]
22
+ r"""The total number of tokens used during the fine-tuning process."""
23
+ data_tokens: NotRequired[Nullable[int]]
24
+ r"""The total number of tokens in the training dataset."""
25
+ estimated_start_time: NotRequired[Nullable[int]]
26
+ deprecated: NotRequired[bool]
27
+ epochs: NotRequired[Nullable[float]]
28
+ r"""The number of complete passes through the entire training dataset."""
29
+ training_steps: NotRequired[Nullable[int]]
30
+ 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."""
31
+
32
+
33
+ class LegacyJobMetadataOut(BaseModel):
34
+ details: str
35
+ expected_duration_seconds: OptionalNullable[int] = UNSET
36
+ r"""The approximated time (in seconds) for the fine-tuning process to complete."""
37
+ cost: OptionalNullable[float] = UNSET
38
+ r"""The cost of the fine-tuning job."""
39
+ cost_currency: OptionalNullable[str] = UNSET
40
+ r"""The currency used for the fine-tuning job cost."""
41
+ train_tokens_per_step: OptionalNullable[int] = UNSET
42
+ r"""The number of tokens consumed by one training step."""
43
+ train_tokens: OptionalNullable[int] = UNSET
44
+ r"""The total number of tokens used during the fine-tuning process."""
45
+ data_tokens: OptionalNullable[int] = UNSET
46
+ r"""The total number of tokens in the training dataset."""
47
+ estimated_start_time: OptionalNullable[int] = UNSET
48
+ deprecated: Optional[bool] = True
49
+ epochs: OptionalNullable[float] = UNSET
50
+ r"""The number of complete passes through the entire training dataset."""
51
+ training_steps: OptionalNullable[int] = UNSET
52
+ 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."""
53
+ OBJECT: Annotated[Final[Optional[str]], pydantic.Field(alias="object")] = "job.metadata" # type: ignore
54
+
55
+ @model_serializer(mode="wrap")
56
+ def serialize_model(self, handler):
57
+ optional_fields = ["expected_duration_seconds", "cost", "cost_currency", "train_tokens_per_step", "train_tokens", "data_tokens", "estimated_start_time", "deprecated", "epochs", "training_steps", "object"]
58
+ nullable_fields = ["expected_duration_seconds", "cost", "cost_currency", "train_tokens_per_step", "train_tokens", "data_tokens", "estimated_start_time", "epochs", "training_steps"]
59
+ null_default_fields = []
60
+
61
+ serialized = handler(self)
62
+
63
+ m = {}
64
+
65
+ for n, f in self.model_fields.items():
66
+ k = f.alias or n
67
+ val = serialized.get(k)
68
+
69
+ optional_nullable = k in optional_fields and k in nullable_fields
70
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
71
+
72
+ if val is not None and val != UNSET_SENTINEL:
73
+ m[k] = val
74
+ elif val != UNSET_SENTINEL and (
75
+ not k in optional_fields or (optional_nullable and is_set)
76
+ ):
77
+ m[k] = val
78
+
79
+ return m
80
+
@@ -0,0 +1,17 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .fileschema import FileSchema, FileSchemaTypedDict
5
+ from mistralai.types import BaseModel
6
+ from typing import List, TypedDict
7
+
8
+
9
+ class ListFilesOutTypedDict(TypedDict):
10
+ data: List[FileSchemaTypedDict]
11
+ object: str
12
+
13
+
14
+ class ListFilesOut(BaseModel):
15
+ data: List[FileSchema]
16
+ object: str
17
+
@@ -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 TypedDict
7
+ from typing_extensions import NotRequired
8
+
9
+
10
+ class MetricOutTypedDict(TypedDict):
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
+
13
+ train_loss: NotRequired[Nullable[float]]
14
+ valid_loss: NotRequired[Nullable[float]]
15
+ valid_mean_token_accuracy: NotRequired[Nullable[float]]
16
+
17
+
18
+ class MetricOut(BaseModel):
19
+ 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)."""
20
+
21
+ train_loss: OptionalNullable[float] = UNSET
22
+ valid_loss: OptionalNullable[float] = UNSET
23
+ valid_mean_token_accuracy: OptionalNullable[float] = UNSET
24
+
25
+ @model_serializer(mode="wrap")
26
+ def serialize_model(self, handler):
27
+ optional_fields = ["train_loss", "valid_loss", "valid_mean_token_accuracy"]
28
+ nullable_fields = ["train_loss", "valid_loss", "valid_mean_token_accuracy"]
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,21 @@
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 ModelCapabilitiesTypedDict(TypedDict):
10
+ completion_chat: NotRequired[bool]
11
+ completion_fim: NotRequired[bool]
12
+ function_calling: NotRequired[bool]
13
+ fine_tuning: NotRequired[bool]
14
+
15
+
16
+ class ModelCapabilities(BaseModel):
17
+ completion_chat: Optional[bool] = True
18
+ completion_fim: Optional[bool] = False
19
+ function_calling: Optional[bool] = True
20
+ fine_tuning: Optional[bool] = False
21
+
@@ -0,0 +1,66 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .modelcapabilities import ModelCapabilities, ModelCapabilitiesTypedDict
5
+ from datetime import datetime
6
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
7
+ from pydantic import model_serializer
8
+ from typing import List, Optional, TypedDict
9
+ from typing_extensions import NotRequired
10
+
11
+
12
+ class ModelCardTypedDict(TypedDict):
13
+ id: str
14
+ capabilities: ModelCapabilitiesTypedDict
15
+ object: NotRequired[str]
16
+ created: NotRequired[int]
17
+ owned_by: NotRequired[str]
18
+ root: NotRequired[Nullable[str]]
19
+ archived: NotRequired[bool]
20
+ name: NotRequired[Nullable[str]]
21
+ description: NotRequired[Nullable[str]]
22
+ max_context_length: NotRequired[int]
23
+ aliases: NotRequired[List[str]]
24
+ deprecation: NotRequired[Nullable[datetime]]
25
+
26
+
27
+ class ModelCard(BaseModel):
28
+ id: str
29
+ capabilities: ModelCapabilities
30
+ object: Optional[str] = "model"
31
+ created: Optional[int] = None
32
+ owned_by: Optional[str] = "mistralai"
33
+ root: OptionalNullable[str] = UNSET
34
+ archived: Optional[bool] = False
35
+ name: OptionalNullable[str] = UNSET
36
+ description: OptionalNullable[str] = UNSET
37
+ max_context_length: Optional[int] = 32768
38
+ aliases: Optional[List[str]] = None
39
+ deprecation: OptionalNullable[datetime] = UNSET
40
+
41
+ @model_serializer(mode="wrap")
42
+ def serialize_model(self, handler):
43
+ optional_fields = ["object", "created", "owned_by", "root", "archived", "name", "description", "max_context_length", "aliases", "deprecation"]
44
+ nullable_fields = ["root", "name", "description", "deprecation"]
45
+ null_default_fields = []
46
+
47
+ serialized = handler(self)
48
+
49
+ m = {}
50
+
51
+ for n, f in self.model_fields.items():
52
+ k = f.alias or n
53
+ val = serialized.get(k)
54
+
55
+ optional_nullable = k in optional_fields and k in nullable_fields
56
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
57
+
58
+ if val is not None and val != UNSET_SENTINEL:
59
+ m[k] = val
60
+ elif val != UNSET_SENTINEL and (
61
+ not k in optional_fields or (optional_nullable and is_set)
62
+ ):
63
+ m[k] = val
64
+
65
+ return m
66
+
@@ -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,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 RetrieveModelV1ModelsModelIDGetRequestTypedDict(TypedDict):
11
+ model_id: str
12
+ r"""The ID of the model to retrieve."""
13
+
14
+
15
+ class RetrieveModelV1ModelsModelIDGetRequest(BaseModel):
16
+ model_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
17
+ r"""The ID of the model to retrieve."""
18
+