mistralai 1.0.3__py3-none-any.whl → 1.2.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.
- mistralai/__init__.py +4 -0
- mistralai/_hooks/sdkhooks.py +23 -4
- mistralai/_hooks/types.py +27 -9
- mistralai/_version.py +12 -0
- mistralai/agents.py +334 -164
- mistralai/basesdk.py +90 -5
- mistralai/batch.py +17 -0
- mistralai/chat.py +316 -166
- mistralai/classifiers.py +396 -0
- mistralai/embeddings.py +79 -55
- mistralai/files.py +487 -194
- mistralai/fim.py +206 -132
- mistralai/fine_tuning.py +3 -2
- mistralai/jobs.py +392 -263
- mistralai/mistral_jobs.py +733 -0
- mistralai/models/__init__.py +593 -50
- mistralai/models/agentscompletionrequest.py +70 -17
- mistralai/models/agentscompletionstreamrequest.py +72 -17
- mistralai/models/apiendpoint.py +9 -0
- mistralai/models/archiveftmodelout.py +15 -5
- mistralai/models/assistantmessage.py +22 -10
- mistralai/models/{modelcard.py → basemodelcard.py} +53 -14
- mistralai/models/batcherror.py +17 -0
- mistralai/models/batchjobin.py +58 -0
- mistralai/models/batchjobout.py +117 -0
- mistralai/models/batchjobsout.py +30 -0
- mistralai/models/batchjobstatus.py +15 -0
- mistralai/models/chatclassificationrequest.py +104 -0
- mistralai/models/chatcompletionchoice.py +13 -6
- mistralai/models/chatcompletionrequest.py +86 -21
- mistralai/models/chatcompletionresponse.py +8 -4
- mistralai/models/chatcompletionstreamrequest.py +88 -21
- mistralai/models/checkpointout.py +4 -3
- mistralai/models/classificationobject.py +21 -0
- mistralai/models/classificationrequest.py +59 -0
- mistralai/models/classificationresponse.py +21 -0
- mistralai/models/completionchunk.py +12 -5
- mistralai/models/completionevent.py +2 -3
- mistralai/models/completionresponsestreamchoice.py +22 -8
- mistralai/models/contentchunk.py +13 -10
- mistralai/models/delete_model_v1_models_model_id_deleteop.py +5 -5
- mistralai/models/deletefileout.py +4 -3
- mistralai/models/deletemodelout.py +5 -4
- mistralai/models/deltamessage.py +23 -11
- mistralai/models/detailedjobout.py +70 -12
- mistralai/models/embeddingrequest.py +14 -9
- mistralai/models/embeddingresponse.py +7 -3
- mistralai/models/embeddingresponsedata.py +5 -4
- mistralai/models/eventout.py +11 -6
- mistralai/models/filepurpose.py +8 -0
- mistralai/models/files_api_routes_delete_fileop.py +5 -5
- mistralai/models/files_api_routes_download_fileop.py +16 -0
- mistralai/models/files_api_routes_list_filesop.py +96 -0
- mistralai/models/files_api_routes_retrieve_fileop.py +5 -5
- mistralai/models/files_api_routes_upload_fileop.py +33 -14
- mistralai/models/fileschema.py +22 -15
- mistralai/models/fimcompletionrequest.py +44 -16
- mistralai/models/fimcompletionresponse.py +8 -4
- mistralai/models/fimcompletionstreamrequest.py +44 -16
- mistralai/models/finetuneablemodel.py +7 -1
- mistralai/models/ftmodelcapabilitiesout.py +6 -4
- mistralai/models/ftmodelcard.py +121 -0
- mistralai/models/ftmodelout.py +39 -9
- mistralai/models/function.py +5 -4
- mistralai/models/functioncall.py +4 -3
- mistralai/models/functionname.py +17 -0
- mistralai/models/githubrepositoryin.py +24 -7
- mistralai/models/githubrepositoryout.py +24 -7
- mistralai/models/httpvalidationerror.py +1 -3
- mistralai/models/imageurl.py +47 -0
- mistralai/models/imageurlchunk.py +38 -0
- mistralai/models/jobin.py +24 -7
- mistralai/models/jobmetadataout.py +32 -8
- mistralai/models/jobout.py +65 -12
- mistralai/models/jobs_api_routes_batch_cancel_batch_jobop.py +16 -0
- mistralai/models/jobs_api_routes_batch_get_batch_jobop.py +16 -0
- mistralai/models/jobs_api_routes_batch_get_batch_jobsop.py +95 -0
- mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +3 -2
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +85 -18
- mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +10 -6
- mistralai/models/jobsout.py +13 -5
- mistralai/models/legacyjobmetadataout.py +55 -9
- mistralai/models/listfilesout.py +7 -3
- mistralai/models/metricout.py +12 -8
- mistralai/models/modelcapabilities.py +9 -4
- mistralai/models/modellist.py +21 -7
- mistralai/models/responseformat.py +7 -8
- mistralai/models/responseformats.py +8 -0
- mistralai/models/retrieve_model_v1_models_model_id_getop.py +25 -6
- mistralai/models/retrievefileout.py +25 -15
- mistralai/models/sampletype.py +6 -2
- mistralai/models/security.py +14 -5
- mistralai/models/source.py +3 -2
- mistralai/models/systemmessage.py +10 -9
- mistralai/models/textchunk.py +14 -5
- mistralai/models/tool.py +10 -9
- mistralai/models/toolcall.py +10 -8
- mistralai/models/toolchoice.py +29 -0
- mistralai/models/toolchoiceenum.py +7 -0
- mistralai/models/toolmessage.py +13 -6
- mistralai/models/tooltypes.py +8 -0
- mistralai/models/trainingfile.py +4 -4
- mistralai/models/trainingparameters.py +34 -8
- mistralai/models/trainingparametersin.py +36 -10
- mistralai/models/unarchiveftmodelout.py +15 -5
- mistralai/models/updateftmodelin.py +9 -6
- mistralai/models/uploadfileout.py +22 -15
- mistralai/models/usageinfo.py +4 -3
- mistralai/models/usermessage.py +42 -10
- mistralai/models/validationerror.py +5 -3
- mistralai/models/wandbintegration.py +23 -7
- mistralai/models/wandbintegrationout.py +23 -8
- mistralai/models_.py +416 -294
- mistralai/sdk.py +31 -19
- mistralai/sdkconfiguration.py +9 -11
- mistralai/utils/__init__.py +14 -1
- mistralai/utils/annotations.py +13 -2
- mistralai/utils/logger.py +4 -1
- mistralai/utils/retries.py +2 -1
- mistralai/utils/security.py +13 -6
- mistralai/utils/serializers.py +25 -0
- {mistralai-1.0.3.dist-info → mistralai-1.2.0.dist-info}/METADATA +171 -66
- mistralai-1.2.0.dist-info/RECORD +276 -0
- {mistralai-1.0.3.dist-info → mistralai-1.2.0.dist-info}/WHEEL +1 -1
- mistralai_azure/__init__.py +4 -0
- mistralai_azure/_hooks/sdkhooks.py +23 -4
- mistralai_azure/_hooks/types.py +27 -9
- mistralai_azure/_version.py +12 -0
- mistralai_azure/basesdk.py +91 -6
- mistralai_azure/chat.py +308 -166
- mistralai_azure/models/__init__.py +164 -16
- mistralai_azure/models/assistantmessage.py +29 -11
- mistralai_azure/models/chatcompletionchoice.py +15 -6
- mistralai_azure/models/chatcompletionrequest.py +94 -22
- mistralai_azure/models/chatcompletionresponse.py +8 -4
- mistralai_azure/models/chatcompletionstreamrequest.py +96 -22
- mistralai_azure/models/completionchunk.py +12 -5
- mistralai_azure/models/completionevent.py +2 -3
- mistralai_azure/models/completionresponsestreamchoice.py +19 -8
- mistralai_azure/models/contentchunk.py +4 -11
- mistralai_azure/models/deltamessage.py +30 -12
- mistralai_azure/models/function.py +5 -4
- mistralai_azure/models/functioncall.py +4 -3
- mistralai_azure/models/functionname.py +17 -0
- mistralai_azure/models/httpvalidationerror.py +1 -3
- mistralai_azure/models/responseformat.py +7 -8
- mistralai_azure/models/responseformats.py +8 -0
- mistralai_azure/models/security.py +13 -5
- mistralai_azure/models/systemmessage.py +10 -9
- mistralai_azure/models/textchunk.py +14 -5
- mistralai_azure/models/tool.py +10 -9
- mistralai_azure/models/toolcall.py +10 -8
- mistralai_azure/models/toolchoice.py +29 -0
- mistralai_azure/models/toolchoiceenum.py +7 -0
- mistralai_azure/models/toolmessage.py +20 -7
- mistralai_azure/models/tooltypes.py +8 -0
- mistralai_azure/models/usageinfo.py +4 -3
- mistralai_azure/models/usermessage.py +42 -10
- mistralai_azure/models/validationerror.py +5 -3
- mistralai_azure/sdkconfiguration.py +9 -11
- mistralai_azure/utils/__init__.py +16 -3
- mistralai_azure/utils/annotations.py +13 -2
- mistralai_azure/utils/forms.py +10 -9
- mistralai_azure/utils/headers.py +8 -8
- mistralai_azure/utils/logger.py +6 -0
- mistralai_azure/utils/queryparams.py +16 -14
- mistralai_azure/utils/retries.py +2 -1
- mistralai_azure/utils/security.py +12 -6
- mistralai_azure/utils/serializers.py +42 -8
- mistralai_azure/utils/url.py +13 -8
- mistralai_azure/utils/values.py +6 -0
- mistralai_gcp/__init__.py +4 -0
- mistralai_gcp/_hooks/sdkhooks.py +23 -4
- mistralai_gcp/_hooks/types.py +27 -9
- mistralai_gcp/_version.py +12 -0
- mistralai_gcp/basesdk.py +91 -6
- mistralai_gcp/chat.py +308 -166
- mistralai_gcp/fim.py +198 -132
- mistralai_gcp/models/__init__.py +186 -18
- mistralai_gcp/models/assistantmessage.py +29 -11
- mistralai_gcp/models/chatcompletionchoice.py +15 -6
- mistralai_gcp/models/chatcompletionrequest.py +91 -22
- mistralai_gcp/models/chatcompletionresponse.py +8 -4
- mistralai_gcp/models/chatcompletionstreamrequest.py +93 -22
- mistralai_gcp/models/completionchunk.py +12 -5
- mistralai_gcp/models/completionevent.py +2 -3
- mistralai_gcp/models/completionresponsestreamchoice.py +19 -8
- mistralai_gcp/models/contentchunk.py +4 -11
- mistralai_gcp/models/deltamessage.py +30 -12
- mistralai_gcp/models/fimcompletionrequest.py +51 -17
- mistralai_gcp/models/fimcompletionresponse.py +8 -4
- mistralai_gcp/models/fimcompletionstreamrequest.py +51 -17
- mistralai_gcp/models/function.py +5 -4
- mistralai_gcp/models/functioncall.py +4 -3
- mistralai_gcp/models/functionname.py +17 -0
- mistralai_gcp/models/httpvalidationerror.py +1 -3
- mistralai_gcp/models/responseformat.py +7 -8
- mistralai_gcp/models/responseformats.py +8 -0
- mistralai_gcp/models/security.py +13 -5
- mistralai_gcp/models/systemmessage.py +10 -9
- mistralai_gcp/models/textchunk.py +14 -5
- mistralai_gcp/models/tool.py +10 -9
- mistralai_gcp/models/toolcall.py +10 -8
- mistralai_gcp/models/toolchoice.py +29 -0
- mistralai_gcp/models/toolchoiceenum.py +7 -0
- mistralai_gcp/models/toolmessage.py +20 -7
- mistralai_gcp/models/tooltypes.py +8 -0
- mistralai_gcp/models/usageinfo.py +4 -3
- mistralai_gcp/models/usermessage.py +42 -10
- mistralai_gcp/models/validationerror.py +5 -3
- mistralai_gcp/sdk.py +6 -7
- mistralai_gcp/sdkconfiguration.py +9 -11
- mistralai_gcp/utils/__init__.py +16 -3
- mistralai_gcp/utils/annotations.py +13 -2
- mistralai_gcp/utils/forms.py +10 -9
- mistralai_gcp/utils/headers.py +8 -8
- mistralai_gcp/utils/logger.py +6 -0
- mistralai_gcp/utils/queryparams.py +16 -14
- mistralai_gcp/utils/retries.py +2 -1
- mistralai_gcp/utils/security.py +12 -6
- mistralai_gcp/utils/serializers.py +42 -8
- mistralai_gcp/utils/url.py +13 -8
- mistralai_gcp/utils/values.py +6 -0
- mistralai-1.0.3.dist-info/RECORD +0 -236
- {mistralai-1.0.3.dist-info → mistralai-1.2.0.dist-info}/LICENSE +0 -0
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
5
|
from mistralai.utils import FieldMetadata, PathParamMetadata
|
|
6
|
-
from
|
|
7
|
-
from typing_extensions import Annotated
|
|
6
|
+
from typing_extensions import Annotated, TypedDict
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class JobsAPIRoutesFineTuningGetFineTuningJobRequestTypedDict(TypedDict):
|
|
11
10
|
job_id: str
|
|
12
11
|
r"""The ID of the job to analyse."""
|
|
13
|
-
|
|
12
|
+
|
|
14
13
|
|
|
15
14
|
class JobsAPIRoutesFineTuningGetFineTuningJobRequest(BaseModel):
|
|
16
|
-
job_id: Annotated[
|
|
15
|
+
job_id: Annotated[
|
|
16
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
17
|
+
]
|
|
17
18
|
r"""The ID of the job to analyse."""
|
|
18
|
-
|
|
@@ -5,13 +5,25 @@ from datetime import datetime
|
|
|
5
5
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
6
6
|
from mistralai.utils import FieldMetadata, QueryParamMetadata
|
|
7
7
|
from pydantic import model_serializer
|
|
8
|
-
from typing import Literal, Optional
|
|
9
|
-
from typing_extensions import Annotated, NotRequired
|
|
8
|
+
from typing import Literal, Optional
|
|
9
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
QueryParamStatus = Literal[
|
|
12
|
+
QueryParamStatus = Literal[
|
|
13
|
+
"QUEUED",
|
|
14
|
+
"STARTED",
|
|
15
|
+
"VALIDATING",
|
|
16
|
+
"VALIDATED",
|
|
17
|
+
"RUNNING",
|
|
18
|
+
"FAILED_VALIDATION",
|
|
19
|
+
"FAILED",
|
|
20
|
+
"SUCCESS",
|
|
21
|
+
"CANCELLED",
|
|
22
|
+
"CANCELLATION_REQUESTED",
|
|
23
|
+
]
|
|
13
24
|
r"""The current job state to filter on. When set, the other results are not displayed."""
|
|
14
25
|
|
|
26
|
+
|
|
15
27
|
class JobsAPIRoutesFineTuningGetFineTuningJobsRequestTypedDict(TypedDict):
|
|
16
28
|
page: NotRequired[int]
|
|
17
29
|
r"""The page number of the results to be returned."""
|
|
@@ -31,32 +43,84 @@ class JobsAPIRoutesFineTuningGetFineTuningJobsRequestTypedDict(TypedDict):
|
|
|
31
43
|
r"""The Weight and Biases run name to filter on. When set, the other results are not displayed."""
|
|
32
44
|
suffix: NotRequired[Nullable[str]]
|
|
33
45
|
r"""The model suffix to filter on. When set, the other results are not displayed."""
|
|
34
|
-
|
|
46
|
+
|
|
35
47
|
|
|
36
48
|
class JobsAPIRoutesFineTuningGetFineTuningJobsRequest(BaseModel):
|
|
37
|
-
page: Annotated[
|
|
49
|
+
page: Annotated[
|
|
50
|
+
Optional[int],
|
|
51
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
52
|
+
] = 0
|
|
38
53
|
r"""The page number of the results to be returned."""
|
|
39
|
-
|
|
54
|
+
|
|
55
|
+
page_size: Annotated[
|
|
56
|
+
Optional[int],
|
|
57
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
58
|
+
] = 100
|
|
40
59
|
r"""The number of items to return per page."""
|
|
41
|
-
|
|
60
|
+
|
|
61
|
+
model: Annotated[
|
|
62
|
+
OptionalNullable[str],
|
|
63
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
64
|
+
] = UNSET
|
|
42
65
|
r"""The model name used for fine-tuning to filter on. When set, the other results are not displayed."""
|
|
43
|
-
|
|
66
|
+
|
|
67
|
+
created_after: Annotated[
|
|
68
|
+
OptionalNullable[datetime],
|
|
69
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
70
|
+
] = UNSET
|
|
44
71
|
r"""The date/time to filter on. When set, the results for previous creation times are not displayed."""
|
|
45
|
-
|
|
72
|
+
|
|
73
|
+
created_by_me: Annotated[
|
|
74
|
+
Optional[bool],
|
|
75
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
76
|
+
] = False
|
|
46
77
|
r"""When set, only return results for jobs created by the API caller. Other results are not displayed."""
|
|
47
|
-
|
|
78
|
+
|
|
79
|
+
status: Annotated[
|
|
80
|
+
OptionalNullable[QueryParamStatus],
|
|
81
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
82
|
+
] = UNSET
|
|
48
83
|
r"""The current job state to filter on. When set, the other results are not displayed."""
|
|
49
|
-
|
|
84
|
+
|
|
85
|
+
wandb_project: Annotated[
|
|
86
|
+
OptionalNullable[str],
|
|
87
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
88
|
+
] = UNSET
|
|
50
89
|
r"""The Weights and Biases project to filter on. When set, the other results are not displayed."""
|
|
51
|
-
|
|
90
|
+
|
|
91
|
+
wandb_name: Annotated[
|
|
92
|
+
OptionalNullable[str],
|
|
93
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
94
|
+
] = UNSET
|
|
52
95
|
r"""The Weight and Biases run name to filter on. When set, the other results are not displayed."""
|
|
53
|
-
|
|
96
|
+
|
|
97
|
+
suffix: Annotated[
|
|
98
|
+
OptionalNullable[str],
|
|
99
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
100
|
+
] = UNSET
|
|
54
101
|
r"""The model suffix to filter on. When set, the other results are not displayed."""
|
|
55
|
-
|
|
102
|
+
|
|
56
103
|
@model_serializer(mode="wrap")
|
|
57
104
|
def serialize_model(self, handler):
|
|
58
|
-
optional_fields = [
|
|
59
|
-
|
|
105
|
+
optional_fields = [
|
|
106
|
+
"page",
|
|
107
|
+
"page_size",
|
|
108
|
+
"model",
|
|
109
|
+
"created_after",
|
|
110
|
+
"created_by_me",
|
|
111
|
+
"status",
|
|
112
|
+
"wandb_project",
|
|
113
|
+
"wandb_name",
|
|
114
|
+
"suffix",
|
|
115
|
+
]
|
|
116
|
+
nullable_fields = [
|
|
117
|
+
"model",
|
|
118
|
+
"created_after",
|
|
119
|
+
"status",
|
|
120
|
+
"wandb_project",
|
|
121
|
+
"wandb_name",
|
|
122
|
+
"suffix",
|
|
123
|
+
]
|
|
60
124
|
null_default_fields = []
|
|
61
125
|
|
|
62
126
|
serialized = handler(self)
|
|
@@ -66,9 +130,13 @@ class JobsAPIRoutesFineTuningGetFineTuningJobsRequest(BaseModel):
|
|
|
66
130
|
for n, f in self.model_fields.items():
|
|
67
131
|
k = f.alias or n
|
|
68
132
|
val = serialized.get(k)
|
|
133
|
+
serialized.pop(k, None)
|
|
69
134
|
|
|
70
135
|
optional_nullable = k in optional_fields and k in nullable_fields
|
|
71
|
-
is_set = (
|
|
136
|
+
is_set = (
|
|
137
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
138
|
+
or k in null_default_fields
|
|
139
|
+
) # pylint: disable=no-member
|
|
72
140
|
|
|
73
141
|
if val is not None and val != UNSET_SENTINEL:
|
|
74
142
|
m[k] = val
|
|
@@ -78,4 +146,3 @@ class JobsAPIRoutesFineTuningGetFineTuningJobsRequest(BaseModel):
|
|
|
78
146
|
m[k] = val
|
|
79
147
|
|
|
80
148
|
return m
|
|
81
|
-
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
5
|
from mistralai.utils import FieldMetadata, PathParamMetadata
|
|
6
|
-
from
|
|
7
|
-
from typing_extensions import Annotated
|
|
6
|
+
from typing_extensions import Annotated, TypedDict
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class JobsAPIRoutesFineTuningStartFineTuningJobRequestTypedDict(TypedDict):
|
|
11
10
|
job_id: str
|
|
12
|
-
|
|
11
|
+
|
|
13
12
|
|
|
14
13
|
class JobsAPIRoutesFineTuningStartFineTuningJobRequest(BaseModel):
|
|
15
|
-
job_id: Annotated[
|
|
16
|
-
|
|
14
|
+
job_id: Annotated[
|
|
15
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
16
|
+
]
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
5
|
from mistralai.utils import FieldMetadata, PathParamMetadata
|
|
6
|
-
from
|
|
7
|
-
from typing_extensions import Annotated
|
|
6
|
+
from typing_extensions import Annotated, TypedDict
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequestTypedDict(TypedDict):
|
|
11
10
|
model_id: str
|
|
12
11
|
r"""The ID of the model to unarchive."""
|
|
13
|
-
|
|
12
|
+
|
|
14
13
|
|
|
15
14
|
class JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequest(BaseModel):
|
|
16
|
-
model_id: Annotated[
|
|
15
|
+
model_id: Annotated[
|
|
16
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
17
|
+
]
|
|
17
18
|
r"""The ID of the model to unarchive."""
|
|
18
|
-
|
|
@@ -4,18 +4,22 @@ from __future__ import annotations
|
|
|
4
4
|
from .updateftmodelin import UpdateFTModelIn, UpdateFTModelInTypedDict
|
|
5
5
|
from mistralai.types import BaseModel
|
|
6
6
|
from mistralai.utils import FieldMetadata, PathParamMetadata, RequestMetadata
|
|
7
|
-
from
|
|
8
|
-
from typing_extensions import Annotated
|
|
7
|
+
from typing_extensions import Annotated, TypedDict
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
class JobsAPIRoutesFineTuningUpdateFineTunedModelRequestTypedDict(TypedDict):
|
|
12
11
|
model_id: str
|
|
13
12
|
r"""The ID of the model to update."""
|
|
14
13
|
update_ft_model_in: UpdateFTModelInTypedDict
|
|
15
|
-
|
|
14
|
+
|
|
16
15
|
|
|
17
16
|
class JobsAPIRoutesFineTuningUpdateFineTunedModelRequest(BaseModel):
|
|
18
|
-
model_id: Annotated[
|
|
17
|
+
model_id: Annotated[
|
|
18
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
19
|
+
]
|
|
19
20
|
r"""The ID of the model to update."""
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
update_ft_model_in: Annotated[
|
|
23
|
+
UpdateFTModelIn,
|
|
24
|
+
FieldMetadata(request=RequestMetadata(media_type="application/json")),
|
|
25
|
+
]
|
mistralai/models/jobsout.py
CHANGED
|
@@ -3,20 +3,28 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .jobout import JobOut, JobOutTypedDict
|
|
5
5
|
from mistralai.types import BaseModel
|
|
6
|
+
from mistralai.utils import validate_const
|
|
6
7
|
import pydantic
|
|
7
|
-
from
|
|
8
|
-
from
|
|
8
|
+
from pydantic.functional_validators import AfterValidator
|
|
9
|
+
from typing import List, Literal, Optional
|
|
10
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
JobsOutObject = Literal["list"]
|
|
12
14
|
|
|
15
|
+
|
|
13
16
|
class JobsOutTypedDict(TypedDict):
|
|
14
17
|
total: int
|
|
15
18
|
data: NotRequired[List[JobOutTypedDict]]
|
|
16
|
-
|
|
19
|
+
object: JobsOutObject
|
|
20
|
+
|
|
17
21
|
|
|
18
22
|
class JobsOut(BaseModel):
|
|
19
23
|
total: int
|
|
24
|
+
|
|
20
25
|
data: Optional[List[JobOut]] = None
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
|
|
27
|
+
OBJECT: Annotated[
|
|
28
|
+
Annotated[Optional[JobsOutObject], AfterValidator(validate_const("list"))],
|
|
29
|
+
pydantic.Field(alias="object"),
|
|
30
|
+
] = "list"
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
5
|
+
from mistralai.utils import validate_const
|
|
5
6
|
import pydantic
|
|
6
7
|
from pydantic import model_serializer
|
|
7
|
-
from
|
|
8
|
-
from
|
|
8
|
+
from pydantic.functional_validators import AfterValidator
|
|
9
|
+
from typing import Literal, Optional
|
|
10
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
LegacyJobMetadataOutObject = Literal["job.metadata"]
|
|
12
14
|
|
|
15
|
+
|
|
13
16
|
class LegacyJobMetadataOutTypedDict(TypedDict):
|
|
14
17
|
details: str
|
|
15
18
|
expected_duration_seconds: NotRequired[Nullable[int]]
|
|
@@ -30,34 +33,74 @@ class LegacyJobMetadataOutTypedDict(TypedDict):
|
|
|
30
33
|
r"""The number of complete passes through the entire training dataset."""
|
|
31
34
|
training_steps: NotRequired[Nullable[int]]
|
|
32
35
|
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."""
|
|
33
|
-
|
|
36
|
+
object: LegacyJobMetadataOutObject
|
|
37
|
+
|
|
34
38
|
|
|
35
39
|
class LegacyJobMetadataOut(BaseModel):
|
|
36
40
|
details: str
|
|
41
|
+
|
|
37
42
|
expected_duration_seconds: OptionalNullable[int] = UNSET
|
|
38
43
|
r"""The approximated time (in seconds) for the fine-tuning process to complete."""
|
|
44
|
+
|
|
39
45
|
cost: OptionalNullable[float] = UNSET
|
|
40
46
|
r"""The cost of the fine-tuning job."""
|
|
47
|
+
|
|
41
48
|
cost_currency: OptionalNullable[str] = UNSET
|
|
42
49
|
r"""The currency used for the fine-tuning job cost."""
|
|
50
|
+
|
|
43
51
|
train_tokens_per_step: OptionalNullable[int] = UNSET
|
|
44
52
|
r"""The number of tokens consumed by one training step."""
|
|
53
|
+
|
|
45
54
|
train_tokens: OptionalNullable[int] = UNSET
|
|
46
55
|
r"""The total number of tokens used during the fine-tuning process."""
|
|
56
|
+
|
|
47
57
|
data_tokens: OptionalNullable[int] = UNSET
|
|
48
58
|
r"""The total number of tokens in the training dataset."""
|
|
59
|
+
|
|
49
60
|
estimated_start_time: OptionalNullable[int] = UNSET
|
|
61
|
+
|
|
50
62
|
deprecated: Optional[bool] = True
|
|
63
|
+
|
|
51
64
|
epochs: OptionalNullable[float] = UNSET
|
|
52
65
|
r"""The number of complete passes through the entire training dataset."""
|
|
66
|
+
|
|
53
67
|
training_steps: OptionalNullable[int] = UNSET
|
|
54
68
|
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."""
|
|
55
|
-
|
|
56
|
-
|
|
69
|
+
|
|
70
|
+
OBJECT: Annotated[
|
|
71
|
+
Annotated[
|
|
72
|
+
Optional[LegacyJobMetadataOutObject],
|
|
73
|
+
AfterValidator(validate_const("job.metadata")),
|
|
74
|
+
],
|
|
75
|
+
pydantic.Field(alias="object"),
|
|
76
|
+
] = "job.metadata"
|
|
77
|
+
|
|
57
78
|
@model_serializer(mode="wrap")
|
|
58
79
|
def serialize_model(self, handler):
|
|
59
|
-
optional_fields = [
|
|
60
|
-
|
|
80
|
+
optional_fields = [
|
|
81
|
+
"expected_duration_seconds",
|
|
82
|
+
"cost",
|
|
83
|
+
"cost_currency",
|
|
84
|
+
"train_tokens_per_step",
|
|
85
|
+
"train_tokens",
|
|
86
|
+
"data_tokens",
|
|
87
|
+
"estimated_start_time",
|
|
88
|
+
"deprecated",
|
|
89
|
+
"epochs",
|
|
90
|
+
"training_steps",
|
|
91
|
+
"object",
|
|
92
|
+
]
|
|
93
|
+
nullable_fields = [
|
|
94
|
+
"expected_duration_seconds",
|
|
95
|
+
"cost",
|
|
96
|
+
"cost_currency",
|
|
97
|
+
"train_tokens_per_step",
|
|
98
|
+
"train_tokens",
|
|
99
|
+
"data_tokens",
|
|
100
|
+
"estimated_start_time",
|
|
101
|
+
"epochs",
|
|
102
|
+
"training_steps",
|
|
103
|
+
]
|
|
61
104
|
null_default_fields = []
|
|
62
105
|
|
|
63
106
|
serialized = handler(self)
|
|
@@ -67,9 +110,13 @@ class LegacyJobMetadataOut(BaseModel):
|
|
|
67
110
|
for n, f in self.model_fields.items():
|
|
68
111
|
k = f.alias or n
|
|
69
112
|
val = serialized.get(k)
|
|
113
|
+
serialized.pop(k, None)
|
|
70
114
|
|
|
71
115
|
optional_nullable = k in optional_fields and k in nullable_fields
|
|
72
|
-
is_set = (
|
|
116
|
+
is_set = (
|
|
117
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
118
|
+
or k in null_default_fields
|
|
119
|
+
) # pylint: disable=no-member
|
|
73
120
|
|
|
74
121
|
if val is not None and val != UNSET_SENTINEL:
|
|
75
122
|
m[k] = val
|
|
@@ -79,4 +126,3 @@ class LegacyJobMetadataOut(BaseModel):
|
|
|
79
126
|
m[k] = val
|
|
80
127
|
|
|
81
128
|
return m
|
|
82
|
-
|
mistralai/models/listfilesout.py
CHANGED
|
@@ -3,15 +3,19 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .fileschema import FileSchema, FileSchemaTypedDict
|
|
5
5
|
from mistralai.types import BaseModel
|
|
6
|
-
from typing import List
|
|
6
|
+
from typing import List
|
|
7
|
+
from typing_extensions import TypedDict
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class ListFilesOutTypedDict(TypedDict):
|
|
10
11
|
data: List[FileSchemaTypedDict]
|
|
11
12
|
object: str
|
|
12
|
-
|
|
13
|
+
total: int
|
|
14
|
+
|
|
13
15
|
|
|
14
16
|
class ListFilesOut(BaseModel):
|
|
15
17
|
data: List[FileSchema]
|
|
18
|
+
|
|
16
19
|
object: str
|
|
17
|
-
|
|
20
|
+
|
|
21
|
+
total: int
|
mistralai/models/metricout.py
CHANGED
|
@@ -3,25 +3,26 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
5
5
|
from pydantic import model_serializer
|
|
6
|
-
from
|
|
7
|
-
from typing_extensions import NotRequired
|
|
6
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class MetricOutTypedDict(TypedDict):
|
|
11
10
|
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
|
-
|
|
11
|
+
|
|
13
12
|
train_loss: NotRequired[Nullable[float]]
|
|
14
13
|
valid_loss: NotRequired[Nullable[float]]
|
|
15
14
|
valid_mean_token_accuracy: NotRequired[Nullable[float]]
|
|
16
|
-
|
|
15
|
+
|
|
17
16
|
|
|
18
17
|
class MetricOut(BaseModel):
|
|
19
18
|
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
|
-
|
|
19
|
+
|
|
21
20
|
train_loss: OptionalNullable[float] = UNSET
|
|
21
|
+
|
|
22
22
|
valid_loss: OptionalNullable[float] = UNSET
|
|
23
|
+
|
|
23
24
|
valid_mean_token_accuracy: OptionalNullable[float] = UNSET
|
|
24
|
-
|
|
25
|
+
|
|
25
26
|
@model_serializer(mode="wrap")
|
|
26
27
|
def serialize_model(self, handler):
|
|
27
28
|
optional_fields = ["train_loss", "valid_loss", "valid_mean_token_accuracy"]
|
|
@@ -35,9 +36,13 @@ class MetricOut(BaseModel):
|
|
|
35
36
|
for n, f in self.model_fields.items():
|
|
36
37
|
k = f.alias or n
|
|
37
38
|
val = serialized.get(k)
|
|
39
|
+
serialized.pop(k, None)
|
|
38
40
|
|
|
39
41
|
optional_nullable = k in optional_fields and k in nullable_fields
|
|
40
|
-
is_set = (
|
|
42
|
+
is_set = (
|
|
43
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
44
|
+
or k in null_default_fields
|
|
45
|
+
) # pylint: disable=no-member
|
|
41
46
|
|
|
42
47
|
if val is not None and val != UNSET_SENTINEL:
|
|
43
48
|
m[k] = val
|
|
@@ -47,4 +52,3 @@ class MetricOut(BaseModel):
|
|
|
47
52
|
m[k] = val
|
|
48
53
|
|
|
49
54
|
return m
|
|
50
|
-
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
|
-
from typing import Optional
|
|
6
|
-
from typing_extensions import NotRequired
|
|
5
|
+
from typing import Optional
|
|
6
|
+
from typing_extensions import NotRequired, TypedDict
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class ModelCapabilitiesTypedDict(TypedDict):
|
|
@@ -11,11 +11,16 @@ class ModelCapabilitiesTypedDict(TypedDict):
|
|
|
11
11
|
completion_fim: NotRequired[bool]
|
|
12
12
|
function_calling: NotRequired[bool]
|
|
13
13
|
fine_tuning: NotRequired[bool]
|
|
14
|
-
|
|
14
|
+
vision: NotRequired[bool]
|
|
15
|
+
|
|
15
16
|
|
|
16
17
|
class ModelCapabilities(BaseModel):
|
|
17
18
|
completion_chat: Optional[bool] = True
|
|
19
|
+
|
|
18
20
|
completion_fim: Optional[bool] = False
|
|
21
|
+
|
|
19
22
|
function_calling: Optional[bool] = True
|
|
23
|
+
|
|
20
24
|
fine_tuning: Optional[bool] = False
|
|
21
|
-
|
|
25
|
+
|
|
26
|
+
vision: Optional[bool] = False
|
mistralai/models/modellist.py
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from .
|
|
4
|
+
from .basemodelcard import BaseModelCard, BaseModelCardTypedDict
|
|
5
|
+
from .ftmodelcard import FTModelCard, FTModelCardTypedDict
|
|
5
6
|
from mistralai.types import BaseModel
|
|
6
|
-
from
|
|
7
|
-
from
|
|
7
|
+
from mistralai.utils import get_discriminator
|
|
8
|
+
from pydantic import Discriminator, Tag
|
|
9
|
+
from typing import List, Optional, Union
|
|
10
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
DataTypedDict = Union[BaseModelCardTypedDict, FTModelCardTypedDict]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Data = Annotated[
|
|
17
|
+
Union[
|
|
18
|
+
Annotated[BaseModelCard, Tag("base")], Annotated[FTModelCard, Tag("fine-tuned")]
|
|
19
|
+
],
|
|
20
|
+
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
|
21
|
+
]
|
|
8
22
|
|
|
9
23
|
|
|
10
24
|
class ModelListTypedDict(TypedDict):
|
|
11
25
|
object: NotRequired[str]
|
|
12
|
-
data: NotRequired[List[
|
|
13
|
-
|
|
26
|
+
data: NotRequired[List[DataTypedDict]]
|
|
27
|
+
|
|
14
28
|
|
|
15
29
|
class ModelList(BaseModel):
|
|
16
30
|
object: Optional[str] = "list"
|
|
17
|
-
|
|
18
|
-
|
|
31
|
+
|
|
32
|
+
data: Optional[List[Data]] = None
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .responseformats import ResponseFormats
|
|
4
5
|
from mistralai.types import BaseModel
|
|
5
|
-
from typing import
|
|
6
|
-
from typing_extensions import NotRequired
|
|
6
|
+
from typing import Optional
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
7
8
|
|
|
8
9
|
|
|
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
10
|
class ResponseFormatTypedDict(TypedDict):
|
|
13
11
|
type: NotRequired[ResponseFormats]
|
|
14
|
-
|
|
12
|
+
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."""
|
|
13
|
+
|
|
15
14
|
|
|
16
15
|
class ResponseFormat(BaseModel):
|
|
17
|
-
type: Optional[ResponseFormats] =
|
|
18
|
-
|
|
16
|
+
type: Optional[ResponseFormats] = None
|
|
17
|
+
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."""
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
ResponseFormats = Literal["text", "json_object"]
|
|
8
|
+
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."""
|
|
@@ -1,18 +1,37 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .basemodelcard import BaseModelCard, BaseModelCardTypedDict
|
|
5
|
+
from .ftmodelcard import FTModelCard, FTModelCardTypedDict
|
|
4
6
|
from mistralai.types import BaseModel
|
|
5
|
-
from mistralai.utils import FieldMetadata, PathParamMetadata
|
|
6
|
-
from
|
|
7
|
-
from
|
|
7
|
+
from mistralai.utils import FieldMetadata, PathParamMetadata, get_discriminator
|
|
8
|
+
from pydantic import Discriminator, Tag
|
|
9
|
+
from typing import Union
|
|
10
|
+
from typing_extensions import Annotated, TypedDict
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
class RetrieveModelV1ModelsModelIDGetRequestTypedDict(TypedDict):
|
|
11
14
|
model_id: str
|
|
12
15
|
r"""The ID of the model to retrieve."""
|
|
13
|
-
|
|
16
|
+
|
|
14
17
|
|
|
15
18
|
class RetrieveModelV1ModelsModelIDGetRequest(BaseModel):
|
|
16
|
-
model_id: Annotated[
|
|
19
|
+
model_id: Annotated[
|
|
20
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
21
|
+
]
|
|
17
22
|
r"""The ID of the model to retrieve."""
|
|
18
|
-
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
RetrieveModelV1ModelsModelIDGetResponseRetrieveModelV1ModelsModelIDGetTypedDict = Union[
|
|
26
|
+
BaseModelCardTypedDict, FTModelCardTypedDict
|
|
27
|
+
]
|
|
28
|
+
r"""Successful Response"""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
RetrieveModelV1ModelsModelIDGetResponseRetrieveModelV1ModelsModelIDGet = Annotated[
|
|
32
|
+
Union[
|
|
33
|
+
Annotated[BaseModelCard, Tag("base")], Annotated[FTModelCard, Tag("fine-tuned")]
|
|
34
|
+
],
|
|
35
|
+
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
|
36
|
+
]
|
|
37
|
+
r"""Successful Response"""
|