mistralai 1.0.2__py3-none-any.whl → 1.1.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/_hooks/sdkhooks.py +23 -4
- mistralai/_hooks/types.py +27 -9
- mistralai/agents.py +286 -150
- mistralai/basesdk.py +90 -5
- mistralai/chat.py +260 -144
- mistralai/embeddings.py +73 -53
- mistralai/files.py +252 -192
- mistralai/fim.py +174 -110
- mistralai/fine_tuning.py +3 -2
- mistralai/jobs.py +372 -263
- mistralai/models/__init__.py +499 -46
- mistralai/models/agentscompletionrequest.py +47 -11
- mistralai/models/agentscompletionstreamrequest.py +49 -11
- mistralai/models/archiveftmodelout.py +6 -2
- mistralai/models/assistantmessage.py +11 -4
- mistralai/models/{modelcard.py → basemodelcard.py} +37 -14
- mistralai/models/chatcompletionchoice.py +4 -2
- mistralai/models/chatcompletionrequest.py +57 -11
- mistralai/models/chatcompletionresponse.py +6 -2
- mistralai/models/chatcompletionstreamrequest.py +59 -11
- mistralai/models/checkpointout.py +3 -2
- mistralai/models/completionchunk.py +10 -3
- mistralai/models/completionevent.py +1 -2
- mistralai/models/completionresponsestreamchoice.py +13 -5
- mistralai/models/contentchunk.py +13 -10
- mistralai/models/delete_model_v1_models_model_id_deleteop.py +4 -3
- mistralai/models/deletefileout.py +3 -2
- mistralai/models/deletemodelout.py +3 -2
- mistralai/models/deltamessage.py +9 -4
- mistralai/models/detailedjobout.py +59 -7
- mistralai/models/embeddingrequest.py +9 -4
- mistralai/models/embeddingresponse.py +5 -2
- mistralai/models/embeddingresponsedata.py +3 -2
- mistralai/models/eventout.py +9 -4
- mistralai/models/files_api_routes_delete_fileop.py +4 -3
- mistralai/models/files_api_routes_retrieve_fileop.py +4 -3
- mistralai/models/files_api_routes_upload_fileop.py +27 -8
- mistralai/models/fileschema.py +26 -5
- mistralai/models/fimcompletionrequest.py +26 -5
- mistralai/models/fimcompletionresponse.py +6 -2
- mistralai/models/fimcompletionstreamrequest.py +26 -5
- mistralai/models/finetuneablemodel.py +7 -1
- mistralai/models/ftmodelcapabilitiesout.py +4 -2
- mistralai/models/ftmodelcard.py +103 -0
- mistralai/models/ftmodelout.py +32 -6
- mistralai/models/function.py +3 -2
- mistralai/models/functioncall.py +2 -2
- mistralai/models/functionname.py +17 -0
- mistralai/models/githubrepositoryin.py +15 -4
- mistralai/models/githubrepositoryout.py +15 -4
- mistralai/models/httpvalidationerror.py +2 -2
- mistralai/models/imageurl.py +48 -0
- mistralai/models/imageurlchunk.py +32 -0
- mistralai/models/jobin.py +22 -5
- mistralai/models/jobmetadataout.py +31 -6
- mistralai/models/jobout.py +55 -7
- mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +4 -3
- mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +4 -3
- 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 +4 -3
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +83 -16
- mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +4 -3
- mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +4 -3
- mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +9 -4
- mistralai/models/jobsout.py +6 -2
- mistralai/models/legacyjobmetadataout.py +45 -6
- mistralai/models/listfilesout.py +2 -2
- mistralai/models/metricout.py +11 -6
- mistralai/models/modelcapabilities.py +7 -2
- mistralai/models/modellist.py +21 -7
- mistralai/models/responseformat.py +6 -7
- mistralai/models/responseformats.py +8 -0
- mistralai/models/retrieve_model_v1_models_model_id_getop.py +24 -5
- mistralai/models/retrievefileout.py +26 -5
- mistralai/models/security.py +12 -3
- mistralai/models/systemmessage.py +6 -5
- mistralai/models/textchunk.py +9 -4
- mistralai/models/tool.py +9 -8
- mistralai/models/toolcall.py +9 -7
- mistralai/models/toolchoice.py +29 -0
- mistralai/models/toolchoiceenum.py +7 -0
- mistralai/models/toolmessage.py +11 -4
- mistralai/models/tooltypes.py +8 -0
- mistralai/models/trainingfile.py +2 -2
- mistralai/models/trainingparameters.py +27 -6
- mistralai/models/trainingparametersin.py +29 -8
- mistralai/models/unarchiveftmodelout.py +6 -2
- mistralai/models/updateftmodelin.py +8 -4
- mistralai/models/uploadfileout.py +26 -5
- mistralai/models/usageinfo.py +3 -2
- mistralai/models/usermessage.py +6 -5
- mistralai/models/validationerror.py +3 -2
- mistralai/models/wandbintegration.py +14 -4
- mistralai/models/wandbintegrationout.py +13 -4
- mistralai/models_.py +392 -294
- mistralai/sdk.py +24 -19
- mistralai/sdkconfiguration.py +6 -8
- mistralai/utils/__init__.py +6 -1
- mistralai/utils/logger.py +4 -1
- mistralai/utils/retries.py +2 -1
- mistralai/utils/security.py +13 -6
- {mistralai-1.0.2.dist-info → mistralai-1.1.0.dist-info}/METADATA +103 -74
- mistralai-1.1.0.dist-info/RECORD +254 -0
- mistralai_azure/_hooks/sdkhooks.py +23 -4
- mistralai_azure/_hooks/types.py +27 -9
- mistralai_azure/basesdk.py +91 -6
- mistralai_azure/chat.py +252 -144
- mistralai_azure/models/__init__.py +157 -15
- mistralai_azure/models/assistantmessage.py +18 -5
- mistralai_azure/models/chatcompletionchoice.py +7 -3
- mistralai_azure/models/chatcompletionrequest.py +65 -12
- mistralai_azure/models/chatcompletionresponse.py +6 -2
- mistralai_azure/models/chatcompletionstreamrequest.py +67 -12
- mistralai_azure/models/completionchunk.py +10 -3
- mistralai_azure/models/completionevent.py +1 -2
- mistralai_azure/models/completionresponsestreamchoice.py +10 -4
- mistralai_azure/models/contentchunk.py +4 -11
- mistralai_azure/models/deltamessage.py +16 -5
- mistralai_azure/models/function.py +3 -2
- mistralai_azure/models/functioncall.py +2 -2
- mistralai_azure/models/functionname.py +17 -0
- mistralai_azure/models/httpvalidationerror.py +2 -2
- mistralai_azure/models/responseformat.py +6 -7
- mistralai_azure/models/responseformats.py +8 -0
- mistralai_azure/models/security.py +12 -3
- mistralai_azure/models/systemmessage.py +6 -5
- mistralai_azure/models/textchunk.py +9 -4
- mistralai_azure/models/tool.py +9 -8
- mistralai_azure/models/toolcall.py +9 -7
- mistralai_azure/models/toolchoice.py +29 -0
- mistralai_azure/models/toolchoiceenum.py +7 -0
- mistralai_azure/models/toolmessage.py +18 -5
- mistralai_azure/models/tooltypes.py +8 -0
- mistralai_azure/models/usageinfo.py +3 -2
- mistralai_azure/models/usermessage.py +6 -5
- mistralai_azure/models/validationerror.py +3 -2
- mistralai_azure/sdkconfiguration.py +6 -8
- mistralai_azure/utils/__init__.py +8 -3
- 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 +17 -8
- mistralai_azure/utils/url.py +13 -8
- mistralai_azure/utils/values.py +6 -0
- mistralai_gcp/_hooks/sdkhooks.py +23 -4
- mistralai_gcp/_hooks/types.py +27 -9
- mistralai_gcp/basesdk.py +91 -6
- mistralai_gcp/chat.py +252 -144
- mistralai_gcp/fim.py +166 -110
- mistralai_gcp/models/__init__.py +179 -17
- mistralai_gcp/models/assistantmessage.py +18 -5
- mistralai_gcp/models/chatcompletionchoice.py +7 -3
- mistralai_gcp/models/chatcompletionrequest.py +62 -12
- mistralai_gcp/models/chatcompletionresponse.py +6 -2
- mistralai_gcp/models/chatcompletionstreamrequest.py +64 -12
- mistralai_gcp/models/completionchunk.py +10 -3
- mistralai_gcp/models/completionevent.py +1 -2
- mistralai_gcp/models/completionresponsestreamchoice.py +10 -4
- mistralai_gcp/models/contentchunk.py +4 -11
- mistralai_gcp/models/deltamessage.py +16 -5
- mistralai_gcp/models/fimcompletionrequest.py +33 -6
- mistralai_gcp/models/fimcompletionresponse.py +6 -2
- mistralai_gcp/models/fimcompletionstreamrequest.py +33 -6
- mistralai_gcp/models/function.py +3 -2
- mistralai_gcp/models/functioncall.py +2 -2
- mistralai_gcp/models/functionname.py +17 -0
- mistralai_gcp/models/httpvalidationerror.py +2 -2
- mistralai_gcp/models/responseformat.py +6 -7
- mistralai_gcp/models/responseformats.py +8 -0
- mistralai_gcp/models/security.py +12 -3
- mistralai_gcp/models/systemmessage.py +6 -5
- mistralai_gcp/models/textchunk.py +9 -4
- mistralai_gcp/models/tool.py +9 -8
- mistralai_gcp/models/toolcall.py +9 -7
- mistralai_gcp/models/toolchoice.py +29 -0
- mistralai_gcp/models/toolchoiceenum.py +7 -0
- mistralai_gcp/models/toolmessage.py +18 -5
- mistralai_gcp/models/tooltypes.py +8 -0
- mistralai_gcp/models/usageinfo.py +3 -2
- mistralai_gcp/models/usermessage.py +6 -5
- mistralai_gcp/models/validationerror.py +3 -2
- mistralai_gcp/sdk.py +14 -10
- mistralai_gcp/sdkconfiguration.py +6 -8
- mistralai_gcp/utils/__init__.py +8 -3
- 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 +17 -8
- mistralai_gcp/utils/url.py +13 -8
- mistralai_gcp/utils/values.py +6 -0
- mistralai-1.0.2.dist-info/RECORD +0 -236
- {mistralai-1.0.2.dist-info → mistralai-1.1.0.dist-info}/LICENSE +0 -0
- {mistralai-1.0.2.dist-info → mistralai-1.1.0.dist-info}/WHEEL +0 -0
|
@@ -10,22 +10,30 @@ from typing_extensions import Annotated, NotRequired
|
|
|
10
10
|
|
|
11
11
|
GithubRepositoryOutType = Literal["github"]
|
|
12
12
|
|
|
13
|
+
|
|
13
14
|
class GithubRepositoryOutTypedDict(TypedDict):
|
|
14
15
|
name: str
|
|
15
16
|
owner: str
|
|
16
17
|
commit_id: str
|
|
17
18
|
ref: NotRequired[Nullable[str]]
|
|
18
19
|
weight: NotRequired[float]
|
|
19
|
-
|
|
20
|
+
|
|
20
21
|
|
|
21
22
|
class GithubRepositoryOut(BaseModel):
|
|
22
23
|
name: str
|
|
24
|
+
|
|
23
25
|
owner: str
|
|
26
|
+
|
|
24
27
|
commit_id: str
|
|
28
|
+
|
|
29
|
+
# fmt: off
|
|
25
30
|
TYPE: Annotated[Final[Optional[GithubRepositoryOutType]], pydantic.Field(alias="type")] = "github" # type: ignore
|
|
31
|
+
# fmt: on
|
|
32
|
+
|
|
26
33
|
ref: OptionalNullable[str] = UNSET
|
|
34
|
+
|
|
27
35
|
weight: Optional[float] = 1
|
|
28
|
-
|
|
36
|
+
|
|
29
37
|
@model_serializer(mode="wrap")
|
|
30
38
|
def serialize_model(self, handler):
|
|
31
39
|
optional_fields = ["type", "ref", "weight"]
|
|
@@ -39,9 +47,13 @@ class GithubRepositoryOut(BaseModel):
|
|
|
39
47
|
for n, f in self.model_fields.items():
|
|
40
48
|
k = f.alias or n
|
|
41
49
|
val = serialized.get(k)
|
|
50
|
+
serialized.pop(k, None)
|
|
42
51
|
|
|
43
52
|
optional_nullable = k in optional_fields and k in nullable_fields
|
|
44
|
-
is_set = (
|
|
53
|
+
is_set = (
|
|
54
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
55
|
+
or k in null_default_fields
|
|
56
|
+
) # pylint: disable=no-member
|
|
45
57
|
|
|
46
58
|
if val is not None and val != UNSET_SENTINEL:
|
|
47
59
|
m[k] = val
|
|
@@ -51,4 +63,3 @@ class GithubRepositoryOut(BaseModel):
|
|
|
51
63
|
m[k] = val
|
|
52
64
|
|
|
53
65
|
return m
|
|
54
|
-
|
|
@@ -6,13 +6,14 @@ from mistralai import utils
|
|
|
6
6
|
from mistralai.types import BaseModel
|
|
7
7
|
from typing import List, Optional
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
class HTTPValidationErrorData(BaseModel):
|
|
10
11
|
detail: Optional[List[ValidationError]] = None
|
|
11
|
-
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class HTTPValidationError(Exception):
|
|
15
15
|
r"""Validation Error"""
|
|
16
|
+
|
|
16
17
|
data: HTTPValidationErrorData
|
|
17
18
|
|
|
18
19
|
def __init__(self, data: HTTPValidationErrorData):
|
|
@@ -20,4 +21,3 @@ class HTTPValidationError(Exception):
|
|
|
20
21
|
|
|
21
22
|
def __str__(self) -> str:
|
|
22
23
|
return utils.marshal_json(self.data, HTTPValidationErrorData)
|
|
23
|
-
|
|
@@ -0,0 +1,48 @@
|
|
|
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 ImageURLTypedDict(TypedDict):
|
|
11
|
+
url: str
|
|
12
|
+
detail: NotRequired[Nullable[str]]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ImageURL(BaseModel):
|
|
16
|
+
url: str
|
|
17
|
+
|
|
18
|
+
detail: OptionalNullable[str] = UNSET
|
|
19
|
+
|
|
20
|
+
@model_serializer(mode="wrap")
|
|
21
|
+
def serialize_model(self, handler):
|
|
22
|
+
optional_fields = ["detail"]
|
|
23
|
+
nullable_fields = ["detail"]
|
|
24
|
+
null_default_fields = []
|
|
25
|
+
|
|
26
|
+
serialized = handler(self)
|
|
27
|
+
|
|
28
|
+
m = {}
|
|
29
|
+
|
|
30
|
+
for n, f in self.model_fields.items():
|
|
31
|
+
k = f.alias or n
|
|
32
|
+
val = serialized.get(k)
|
|
33
|
+
serialized.pop(k, None)
|
|
34
|
+
|
|
35
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
36
|
+
is_set = (
|
|
37
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
38
|
+
or k in null_default_fields
|
|
39
|
+
) # pylint: disable=no-member
|
|
40
|
+
|
|
41
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
42
|
+
m[k] = val
|
|
43
|
+
elif val != UNSET_SENTINEL and (
|
|
44
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
45
|
+
):
|
|
46
|
+
m[k] = val
|
|
47
|
+
|
|
48
|
+
return m
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .imageurl import ImageURL, ImageURLTypedDict
|
|
5
|
+
from mistralai.types import BaseModel
|
|
6
|
+
import pydantic
|
|
7
|
+
from typing import Final, Literal, Optional, TypedDict, Union
|
|
8
|
+
from typing_extensions import Annotated
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
ImageURLChunkType = Literal["image_url"]
|
|
12
|
+
|
|
13
|
+
ImageURLChunkImageURLTypedDict = Union[ImageURLTypedDict, str]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
ImageURLChunkImageURL = Union[ImageURL, str]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ImageURLChunkTypedDict(TypedDict):
|
|
20
|
+
r"""{\"type\":\"image_url\",\"image_url\":{\"url\":\"data:image/png;base64,iVBORw0"""
|
|
21
|
+
|
|
22
|
+
image_url: ImageURLChunkImageURLTypedDict
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ImageURLChunk(BaseModel):
|
|
26
|
+
r"""{\"type\":\"image_url\",\"image_url\":{\"url\":\"data:image/png;base64,iVBORw0"""
|
|
27
|
+
|
|
28
|
+
image_url: ImageURLChunkImageURL
|
|
29
|
+
|
|
30
|
+
# fmt: off
|
|
31
|
+
TYPE: Annotated[Final[Optional[ImageURLChunkType]], pydantic.Field(alias="type")] = "image_url" # type: ignore
|
|
32
|
+
# fmt: on
|
mistralai/models/jobin.py
CHANGED
|
@@ -39,27 +39,41 @@ class JobInTypedDict(TypedDict):
|
|
|
39
39
|
repositories: NotRequired[List[JobInRepositoriesTypedDict]]
|
|
40
40
|
auto_start: NotRequired[bool]
|
|
41
41
|
r"""This field will be required in a future release."""
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
|
|
44
44
|
class JobIn(BaseModel):
|
|
45
45
|
model: FineTuneableModel
|
|
46
46
|
r"""The name of the model to fine-tune."""
|
|
47
|
+
|
|
47
48
|
hyperparameters: TrainingParametersIn
|
|
48
49
|
r"""The fine-tuning hyperparameter settings used in a fine-tune job."""
|
|
50
|
+
|
|
49
51
|
training_files: Optional[List[TrainingFile]] = None
|
|
52
|
+
|
|
50
53
|
validation_files: OptionalNullable[List[str]] = UNSET
|
|
51
54
|
r"""A list containing the IDs of uploaded files that contain validation data. If you provide these files, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in `checkpoints` when getting the status of a running fine-tuning job. The same data should not be present in both train and validation files."""
|
|
55
|
+
|
|
52
56
|
suffix: OptionalNullable[str] = UNSET
|
|
53
57
|
r"""A string that will be added to your fine-tuning model name. For example, a suffix of \"my-great-model\" would produce a model name like `ft:open-mistral-7b:my-great-model:xxx...`"""
|
|
58
|
+
|
|
54
59
|
integrations: OptionalNullable[List[JobInIntegrations]] = UNSET
|
|
55
60
|
r"""A list of integrations to enable for your fine-tuning job."""
|
|
61
|
+
|
|
56
62
|
repositories: Optional[List[JobInRepositories]] = None
|
|
63
|
+
|
|
57
64
|
auto_start: Optional[bool] = None
|
|
58
65
|
r"""This field will be required in a future release."""
|
|
59
|
-
|
|
66
|
+
|
|
60
67
|
@model_serializer(mode="wrap")
|
|
61
68
|
def serialize_model(self, handler):
|
|
62
|
-
optional_fields = [
|
|
69
|
+
optional_fields = [
|
|
70
|
+
"training_files",
|
|
71
|
+
"validation_files",
|
|
72
|
+
"suffix",
|
|
73
|
+
"integrations",
|
|
74
|
+
"repositories",
|
|
75
|
+
"auto_start",
|
|
76
|
+
]
|
|
63
77
|
nullable_fields = ["validation_files", "suffix", "integrations"]
|
|
64
78
|
null_default_fields = []
|
|
65
79
|
|
|
@@ -70,9 +84,13 @@ class JobIn(BaseModel):
|
|
|
70
84
|
for n, f in self.model_fields.items():
|
|
71
85
|
k = f.alias or n
|
|
72
86
|
val = serialized.get(k)
|
|
87
|
+
serialized.pop(k, None)
|
|
73
88
|
|
|
74
89
|
optional_nullable = k in optional_fields and k in nullable_fields
|
|
75
|
-
is_set = (
|
|
90
|
+
is_set = (
|
|
91
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
92
|
+
or k in null_default_fields
|
|
93
|
+
) # pylint: disable=no-member
|
|
76
94
|
|
|
77
95
|
if val is not None and val != UNSET_SENTINEL:
|
|
78
96
|
m[k] = val
|
|
@@ -82,4 +100,3 @@ class JobIn(BaseModel):
|
|
|
82
100
|
m[k] = val
|
|
83
101
|
|
|
84
102
|
return m
|
|
85
|
-
|
|
@@ -15,21 +15,43 @@ class JobMetadataOutTypedDict(TypedDict):
|
|
|
15
15
|
train_tokens: NotRequired[Nullable[int]]
|
|
16
16
|
data_tokens: NotRequired[Nullable[int]]
|
|
17
17
|
estimated_start_time: NotRequired[Nullable[int]]
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
|
|
20
20
|
class JobMetadataOut(BaseModel):
|
|
21
21
|
expected_duration_seconds: OptionalNullable[int] = UNSET
|
|
22
|
+
|
|
22
23
|
cost: OptionalNullable[float] = UNSET
|
|
24
|
+
|
|
23
25
|
cost_currency: OptionalNullable[str] = UNSET
|
|
26
|
+
|
|
24
27
|
train_tokens_per_step: OptionalNullable[int] = UNSET
|
|
28
|
+
|
|
25
29
|
train_tokens: OptionalNullable[int] = UNSET
|
|
30
|
+
|
|
26
31
|
data_tokens: OptionalNullable[int] = UNSET
|
|
32
|
+
|
|
27
33
|
estimated_start_time: OptionalNullable[int] = UNSET
|
|
28
|
-
|
|
34
|
+
|
|
29
35
|
@model_serializer(mode="wrap")
|
|
30
36
|
def serialize_model(self, handler):
|
|
31
|
-
optional_fields = [
|
|
32
|
-
|
|
37
|
+
optional_fields = [
|
|
38
|
+
"expected_duration_seconds",
|
|
39
|
+
"cost",
|
|
40
|
+
"cost_currency",
|
|
41
|
+
"train_tokens_per_step",
|
|
42
|
+
"train_tokens",
|
|
43
|
+
"data_tokens",
|
|
44
|
+
"estimated_start_time",
|
|
45
|
+
]
|
|
46
|
+
nullable_fields = [
|
|
47
|
+
"expected_duration_seconds",
|
|
48
|
+
"cost",
|
|
49
|
+
"cost_currency",
|
|
50
|
+
"train_tokens_per_step",
|
|
51
|
+
"train_tokens",
|
|
52
|
+
"data_tokens",
|
|
53
|
+
"estimated_start_time",
|
|
54
|
+
]
|
|
33
55
|
null_default_fields = []
|
|
34
56
|
|
|
35
57
|
serialized = handler(self)
|
|
@@ -39,9 +61,13 @@ class JobMetadataOut(BaseModel):
|
|
|
39
61
|
for n, f in self.model_fields.items():
|
|
40
62
|
k = f.alias or n
|
|
41
63
|
val = serialized.get(k)
|
|
64
|
+
serialized.pop(k, None)
|
|
42
65
|
|
|
43
66
|
optional_nullable = k in optional_fields and k in nullable_fields
|
|
44
|
-
is_set = (
|
|
67
|
+
is_set = (
|
|
68
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
69
|
+
or k in null_default_fields
|
|
70
|
+
) # pylint: disable=no-member
|
|
45
71
|
|
|
46
72
|
if val is not None and val != UNSET_SENTINEL:
|
|
47
73
|
m[k] = val
|
|
@@ -51,4 +77,3 @@ class JobMetadataOut(BaseModel):
|
|
|
51
77
|
m[k] = val
|
|
52
78
|
|
|
53
79
|
return m
|
|
54
|
-
|
mistralai/models/jobout.py
CHANGED
|
@@ -13,7 +13,18 @@ from typing import Final, List, Literal, Optional, TypedDict
|
|
|
13
13
|
from typing_extensions import Annotated, NotRequired
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
Status = Literal[
|
|
16
|
+
Status = Literal[
|
|
17
|
+
"QUEUED",
|
|
18
|
+
"STARTED",
|
|
19
|
+
"VALIDATING",
|
|
20
|
+
"VALIDATED",
|
|
21
|
+
"RUNNING",
|
|
22
|
+
"FAILED_VALIDATION",
|
|
23
|
+
"FAILED",
|
|
24
|
+
"SUCCESS",
|
|
25
|
+
"CANCELLED",
|
|
26
|
+
"CANCELLATION_REQUESTED",
|
|
27
|
+
]
|
|
17
28
|
r"""The current status of the fine-tuning job."""
|
|
18
29
|
|
|
19
30
|
Object = Literal["job"]
|
|
@@ -60,44 +71,78 @@ class JobOutTypedDict(TypedDict):
|
|
|
60
71
|
r"""Total number of tokens trained."""
|
|
61
72
|
repositories: NotRequired[List[RepositoriesTypedDict]]
|
|
62
73
|
metadata: NotRequired[Nullable[JobMetadataOutTypedDict]]
|
|
63
|
-
|
|
74
|
+
|
|
64
75
|
|
|
65
76
|
class JobOut(BaseModel):
|
|
66
77
|
id: str
|
|
67
78
|
r"""The ID of the job."""
|
|
79
|
+
|
|
68
80
|
auto_start: bool
|
|
81
|
+
|
|
69
82
|
hyperparameters: TrainingParameters
|
|
83
|
+
|
|
70
84
|
model: FineTuneableModel
|
|
71
85
|
r"""The name of the model to fine-tune."""
|
|
86
|
+
|
|
72
87
|
status: Status
|
|
73
88
|
r"""The current status of the fine-tuning job."""
|
|
89
|
+
|
|
74
90
|
job_type: str
|
|
75
91
|
r"""The type of job (`FT` for fine-tuning)."""
|
|
92
|
+
|
|
76
93
|
created_at: int
|
|
77
94
|
r"""The UNIX timestamp (in seconds) for when the fine-tuning job was created."""
|
|
95
|
+
|
|
78
96
|
modified_at: int
|
|
79
97
|
r"""The UNIX timestamp (in seconds) for when the fine-tuning job was last modified."""
|
|
98
|
+
|
|
80
99
|
training_files: List[str]
|
|
81
100
|
r"""A list containing the IDs of uploaded files that contain training data."""
|
|
101
|
+
|
|
82
102
|
validation_files: OptionalNullable[List[str]] = UNSET
|
|
83
103
|
r"""A list containing the IDs of uploaded files that contain validation data."""
|
|
104
|
+
|
|
105
|
+
# fmt: off
|
|
84
106
|
OBJECT: Annotated[Final[Optional[Object]], pydantic.Field(alias="object")] = "job" # type: ignore
|
|
107
|
+
# fmt: on
|
|
85
108
|
r"""The object type of the fine-tuning job."""
|
|
109
|
+
|
|
86
110
|
fine_tuned_model: OptionalNullable[str] = UNSET
|
|
87
111
|
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."""
|
|
112
|
+
|
|
88
113
|
suffix: OptionalNullable[str] = UNSET
|
|
89
114
|
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`."""
|
|
115
|
+
|
|
90
116
|
integrations: OptionalNullable[List[Integrations]] = UNSET
|
|
91
117
|
r"""A list of integrations enabled for your fine-tuning job."""
|
|
118
|
+
|
|
92
119
|
trained_tokens: OptionalNullable[int] = UNSET
|
|
93
120
|
r"""Total number of tokens trained."""
|
|
121
|
+
|
|
94
122
|
repositories: Optional[List[Repositories]] = None
|
|
123
|
+
|
|
95
124
|
metadata: OptionalNullable[JobMetadataOut] = UNSET
|
|
96
|
-
|
|
125
|
+
|
|
97
126
|
@model_serializer(mode="wrap")
|
|
98
127
|
def serialize_model(self, handler):
|
|
99
|
-
optional_fields = [
|
|
100
|
-
|
|
128
|
+
optional_fields = [
|
|
129
|
+
"validation_files",
|
|
130
|
+
"object",
|
|
131
|
+
"fine_tuned_model",
|
|
132
|
+
"suffix",
|
|
133
|
+
"integrations",
|
|
134
|
+
"trained_tokens",
|
|
135
|
+
"repositories",
|
|
136
|
+
"metadata",
|
|
137
|
+
]
|
|
138
|
+
nullable_fields = [
|
|
139
|
+
"validation_files",
|
|
140
|
+
"fine_tuned_model",
|
|
141
|
+
"suffix",
|
|
142
|
+
"integrations",
|
|
143
|
+
"trained_tokens",
|
|
144
|
+
"metadata",
|
|
145
|
+
]
|
|
101
146
|
null_default_fields = []
|
|
102
147
|
|
|
103
148
|
serialized = handler(self)
|
|
@@ -107,9 +152,13 @@ class JobOut(BaseModel):
|
|
|
107
152
|
for n, f in self.model_fields.items():
|
|
108
153
|
k = f.alias or n
|
|
109
154
|
val = serialized.get(k)
|
|
155
|
+
serialized.pop(k, None)
|
|
110
156
|
|
|
111
157
|
optional_nullable = k in optional_fields and k in nullable_fields
|
|
112
|
-
is_set = (
|
|
158
|
+
is_set = (
|
|
159
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
160
|
+
or k in null_default_fields
|
|
161
|
+
) # pylint: disable=no-member
|
|
113
162
|
|
|
114
163
|
if val is not None and val != UNSET_SENTINEL:
|
|
115
164
|
m[k] = val
|
|
@@ -119,4 +168,3 @@ class JobOut(BaseModel):
|
|
|
119
168
|
m[k] = val
|
|
120
169
|
|
|
121
170
|
return m
|
|
122
|
-
|
|
@@ -10,9 +10,10 @@ from typing_extensions import Annotated
|
|
|
10
10
|
class JobsAPIRoutesFineTuningArchiveFineTunedModelRequestTypedDict(TypedDict):
|
|
11
11
|
model_id: str
|
|
12
12
|
r"""The ID of the model to archive."""
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
|
|
15
15
|
class JobsAPIRoutesFineTuningArchiveFineTunedModelRequest(BaseModel):
|
|
16
|
-
model_id: Annotated[
|
|
16
|
+
model_id: Annotated[
|
|
17
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
18
|
+
]
|
|
17
19
|
r"""The ID of the model to archive."""
|
|
18
|
-
|
|
@@ -10,9 +10,10 @@ from typing_extensions import Annotated
|
|
|
10
10
|
class JobsAPIRoutesFineTuningCancelFineTuningJobRequestTypedDict(TypedDict):
|
|
11
11
|
job_id: str
|
|
12
12
|
r"""The ID of the job to cancel."""
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
|
|
15
15
|
class JobsAPIRoutesFineTuningCancelFineTuningJobRequest(BaseModel):
|
|
16
|
-
job_id: Annotated[
|
|
16
|
+
job_id: Annotated[
|
|
17
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
18
|
+
]
|
|
17
19
|
r"""The ID of the job to cancel."""
|
|
18
|
-
|
|
@@ -6,10 +6,11 @@ from .legacyjobmetadataout import LegacyJobMetadataOut, LegacyJobMetadataOutType
|
|
|
6
6
|
from typing import Union
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict = Union[
|
|
9
|
+
JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict = Union[
|
|
10
|
+
LegacyJobMetadataOutTypedDict, JobOutTypedDict
|
|
11
|
+
]
|
|
10
12
|
r"""OK"""
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
JobsAPIRoutesFineTuningCreateFineTuningJobResponse = Union[LegacyJobMetadataOut, JobOut]
|
|
14
16
|
r"""OK"""
|
|
15
|
-
|
|
@@ -10,9 +10,10 @@ from typing_extensions import Annotated
|
|
|
10
10
|
class JobsAPIRoutesFineTuningGetFineTuningJobRequestTypedDict(TypedDict):
|
|
11
11
|
job_id: str
|
|
12
12
|
r"""The ID of the job to analyse."""
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
|
|
15
15
|
class JobsAPIRoutesFineTuningGetFineTuningJobRequest(BaseModel):
|
|
16
|
-
job_id: Annotated[
|
|
16
|
+
job_id: Annotated[
|
|
17
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
18
|
+
]
|
|
17
19
|
r"""The ID of the job to analyse."""
|
|
18
|
-
|
|
@@ -9,9 +9,21 @@ from typing import Literal, Optional, TypedDict
|
|
|
9
9
|
from typing_extensions import Annotated, NotRequired
|
|
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
|
-
|
|
@@ -9,8 +9,9 @@ from typing_extensions import Annotated
|
|
|
9
9
|
|
|
10
10
|
class JobsAPIRoutesFineTuningStartFineTuningJobRequestTypedDict(TypedDict):
|
|
11
11
|
job_id: str
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
|
|
14
14
|
class JobsAPIRoutesFineTuningStartFineTuningJobRequest(BaseModel):
|
|
15
|
-
job_id: Annotated[
|
|
16
|
-
|
|
15
|
+
job_id: Annotated[
|
|
16
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
17
|
+
]
|
|
@@ -10,9 +10,10 @@ from typing_extensions import Annotated
|
|
|
10
10
|
class JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequestTypedDict(TypedDict):
|
|
11
11
|
model_id: str
|
|
12
12
|
r"""The ID of the model to unarchive."""
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
|
|
15
15
|
class JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequest(BaseModel):
|
|
16
|
-
model_id: Annotated[
|
|
16
|
+
model_id: Annotated[
|
|
17
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
18
|
+
]
|
|
17
19
|
r"""The ID of the model to unarchive."""
|
|
18
|
-
|
|
@@ -12,10 +12,15 @@ class JobsAPIRoutesFineTuningUpdateFineTunedModelRequestTypedDict(TypedDict):
|
|
|
12
12
|
model_id: str
|
|
13
13
|
r"""The ID of the model to update."""
|
|
14
14
|
update_ft_model_in: UpdateFTModelInTypedDict
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
|
|
17
17
|
class JobsAPIRoutesFineTuningUpdateFineTunedModelRequest(BaseModel):
|
|
18
|
-
model_id: Annotated[
|
|
18
|
+
model_id: Annotated[
|
|
19
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
20
|
+
]
|
|
19
21
|
r"""The ID of the model to update."""
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
|
|
23
|
+
update_ft_model_in: Annotated[
|
|
24
|
+
UpdateFTModelIn,
|
|
25
|
+
FieldMetadata(request=RequestMetadata(media_type="application/json")),
|
|
26
|
+
]
|