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,112 @@
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
+ if val is not None and val != UNSET_SENTINEL:
97
+ m[k] = val
98
+ elif val != UNSET_SENTINEL and (
99
+ not k in optional_fields
100
+ or (
101
+ k in optional_fields
102
+ and k in nullable_fields
103
+ and (
104
+ self.__pydantic_fields_set__.intersection({n})
105
+ or k in null_default_fields
106
+ ) # pylint: disable=no-member
107
+ )
108
+ ):
109
+ m[k] = val
110
+
111
+ return m
112
+
@@ -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 JobsAPIRoutesFineTuningArchiveFineTunedModelRequestTypedDict(TypedDict):
11
+ model_id: str
12
+
13
+
14
+ class JobsAPIRoutesFineTuningArchiveFineTunedModelRequest(BaseModel):
15
+ model_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 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,73 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .jobin import JobIn, JobInTypedDict
5
+ from .jobout import JobOut, JobOutTypedDict
6
+ from .legacyjobmetadataout import LegacyJobMetadataOut, LegacyJobMetadataOutTypedDict
7
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
8
+ from mistralai.utils import FieldMetadata, QueryParamMetadata, RequestMetadata
9
+ from pydantic import model_serializer
10
+ from typing import TypedDict, Union
11
+ from typing_extensions import Annotated, NotRequired
12
+
13
+
14
+ class JobsAPIRoutesFineTuningCreateFineTuningJobRequestTypedDict(TypedDict):
15
+ job_in: JobInTypedDict
16
+ dry_run: NotRequired[Nullable[bool]]
17
+ r"""* If `true` the job is not spawned, instead the query returns a handful of useful metadata
18
+ for the user to perform sanity checks (see `LegacyJobMetadataOut` response).
19
+ * Otherwise, the job is started and the query returns the job ID along with some of the
20
+ input parameters (see `JobOut` response).
21
+
22
+ """
23
+
24
+
25
+ class JobsAPIRoutesFineTuningCreateFineTuningJobRequest(BaseModel):
26
+ job_in: Annotated[JobIn, FieldMetadata(request=RequestMetadata(media_type="application/json"))]
27
+ dry_run: Annotated[OptionalNullable[bool], FieldMetadata(query=QueryParamMetadata(style="form", explode=True))] = UNSET
28
+ r"""* If `true` the job is not spawned, instead the query returns a handful of useful metadata
29
+ for the user to perform sanity checks (see `LegacyJobMetadataOut` response).
30
+ * Otherwise, the job is started and the query returns the job ID along with some of the
31
+ input parameters (see `JobOut` response).
32
+
33
+ """
34
+
35
+ @model_serializer(mode="wrap")
36
+ def serialize_model(self, handler):
37
+ optional_fields = ["dry_run"]
38
+ nullable_fields = ["dry_run"]
39
+ null_default_fields = []
40
+
41
+ serialized = handler(self)
42
+
43
+ m = {}
44
+
45
+ for n, f in self.model_fields.items():
46
+ k = f.alias or n
47
+ val = serialized.get(k)
48
+
49
+ if val is not None and val != UNSET_SENTINEL:
50
+ m[k] = val
51
+ elif val != UNSET_SENTINEL and (
52
+ not k in optional_fields
53
+ or (
54
+ k in optional_fields
55
+ and k in nullable_fields
56
+ and (
57
+ self.__pydantic_fields_set__.intersection({n})
58
+ or k in null_default_fields
59
+ ) # pylint: disable=no-member
60
+ )
61
+ ):
62
+ m[k] = val
63
+
64
+ return m
65
+
66
+
67
+ JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict = Union[LegacyJobMetadataOutTypedDict, JobOutTypedDict]
68
+ r"""OK"""
69
+
70
+
71
+ JobsAPIRoutesFineTuningCreateFineTuningJobResponse = Union[LegacyJobMetadataOut, JobOut]
72
+ r"""OK"""
73
+
@@ -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,86 @@
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
+ if val is not None and val != UNSET_SENTINEL:
71
+ m[k] = val
72
+ elif val != UNSET_SENTINEL and (
73
+ not k in optional_fields
74
+ or (
75
+ k in optional_fields
76
+ and k in nullable_fields
77
+ and (
78
+ self.__pydantic_fields_set__.intersection({n})
79
+ or k in null_default_fields
80
+ ) # pylint: disable=no-member
81
+ )
82
+ ):
83
+ m[k] = val
84
+
85
+ return m
86
+
@@ -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,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 JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequestTypedDict(TypedDict):
11
+ model_id: str
12
+
13
+
14
+ class JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequest(BaseModel):
15
+ model_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
16
+
@@ -0,0 +1,19 @@
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
+ update_ft_model_in: UpdateFTModelInTypedDict
14
+
15
+
16
+ class JobsAPIRoutesFineTuningUpdateFineTunedModelRequest(BaseModel):
17
+ model_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
18
+ update_ft_model_in: Annotated[UpdateFTModelIn, FieldMetadata(request=RequestMetadata(media_type="application/json"))]
19
+
@@ -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,85 @@
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
+ if val is not None and val != UNSET_SENTINEL:
70
+ m[k] = val
71
+ elif val != UNSET_SENTINEL and (
72
+ not k in optional_fields
73
+ or (
74
+ k in optional_fields
75
+ and k in nullable_fields
76
+ and (
77
+ self.__pydantic_fields_set__.intersection({n})
78
+ or k in null_default_fields
79
+ ) # pylint: disable=no-member
80
+ )
81
+ ):
82
+ m[k] = val
83
+
84
+ return m
85
+
@@ -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,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 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
+ 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,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,71 @@
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
+ if val is not None and val != UNSET_SENTINEL:
56
+ m[k] = val
57
+ elif val != UNSET_SENTINEL and (
58
+ not k in optional_fields
59
+ or (
60
+ k in optional_fields
61
+ and k in nullable_fields
62
+ and (
63
+ self.__pydantic_fields_set__.intersection({n})
64
+ or k in null_default_fields
65
+ ) # pylint: disable=no-member
66
+ )
67
+ ):
68
+ m[k] = val
69
+
70
+ return m
71
+