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
|
@@ -2,30 +2,44 @@
|
|
|
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
|
GithubRepositoryOutType = Literal["github"]
|
|
12
14
|
|
|
15
|
+
|
|
13
16
|
class GithubRepositoryOutTypedDict(TypedDict):
|
|
14
17
|
name: str
|
|
15
18
|
owner: str
|
|
16
19
|
commit_id: str
|
|
20
|
+
type: GithubRepositoryOutType
|
|
17
21
|
ref: NotRequired[Nullable[str]]
|
|
18
22
|
weight: NotRequired[float]
|
|
19
|
-
|
|
23
|
+
|
|
20
24
|
|
|
21
25
|
class GithubRepositoryOut(BaseModel):
|
|
22
26
|
name: str
|
|
27
|
+
|
|
23
28
|
owner: str
|
|
29
|
+
|
|
24
30
|
commit_id: str
|
|
25
|
-
|
|
31
|
+
|
|
32
|
+
TYPE: Annotated[
|
|
33
|
+
Annotated[
|
|
34
|
+
Optional[GithubRepositoryOutType], AfterValidator(validate_const("github"))
|
|
35
|
+
],
|
|
36
|
+
pydantic.Field(alias="type"),
|
|
37
|
+
] = "github"
|
|
38
|
+
|
|
26
39
|
ref: OptionalNullable[str] = UNSET
|
|
40
|
+
|
|
27
41
|
weight: Optional[float] = 1
|
|
28
|
-
|
|
42
|
+
|
|
29
43
|
@model_serializer(mode="wrap")
|
|
30
44
|
def serialize_model(self, handler):
|
|
31
45
|
optional_fields = ["type", "ref", "weight"]
|
|
@@ -39,9 +53,13 @@ class GithubRepositoryOut(BaseModel):
|
|
|
39
53
|
for n, f in self.model_fields.items():
|
|
40
54
|
k = f.alias or n
|
|
41
55
|
val = serialized.get(k)
|
|
56
|
+
serialized.pop(k, None)
|
|
42
57
|
|
|
43
58
|
optional_nullable = k in optional_fields and k in nullable_fields
|
|
44
|
-
is_set = (
|
|
59
|
+
is_set = (
|
|
60
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
61
|
+
or k in null_default_fields
|
|
62
|
+
) # pylint: disable=no-member
|
|
45
63
|
|
|
46
64
|
if val is not None and val != UNSET_SENTINEL:
|
|
47
65
|
m[k] = val
|
|
@@ -51,4 +69,3 @@ class GithubRepositoryOut(BaseModel):
|
|
|
51
69
|
m[k] = val
|
|
52
70
|
|
|
53
71
|
return m
|
|
54
|
-
|
|
@@ -6,13 +6,12 @@ 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
|
-
r"""Validation Error"""
|
|
16
15
|
data: HTTPValidationErrorData
|
|
17
16
|
|
|
18
17
|
def __init__(self, data: HTTPValidationErrorData):
|
|
@@ -20,4 +19,3 @@ class HTTPValidationError(Exception):
|
|
|
20
19
|
|
|
21
20
|
def __str__(self) -> str:
|
|
22
21
|
return utils.marshal_json(self.data, HTTPValidationErrorData)
|
|
23
|
-
|
|
@@ -0,0 +1,47 @@
|
|
|
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_extensions import NotRequired, TypedDict
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ImageURLTypedDict(TypedDict):
|
|
10
|
+
url: str
|
|
11
|
+
detail: NotRequired[Nullable[str]]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ImageURL(BaseModel):
|
|
15
|
+
url: str
|
|
16
|
+
|
|
17
|
+
detail: OptionalNullable[str] = UNSET
|
|
18
|
+
|
|
19
|
+
@model_serializer(mode="wrap")
|
|
20
|
+
def serialize_model(self, handler):
|
|
21
|
+
optional_fields = ["detail"]
|
|
22
|
+
nullable_fields = ["detail"]
|
|
23
|
+
null_default_fields = []
|
|
24
|
+
|
|
25
|
+
serialized = handler(self)
|
|
26
|
+
|
|
27
|
+
m = {}
|
|
28
|
+
|
|
29
|
+
for n, f in self.model_fields.items():
|
|
30
|
+
k = f.alias or n
|
|
31
|
+
val = serialized.get(k)
|
|
32
|
+
serialized.pop(k, None)
|
|
33
|
+
|
|
34
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
35
|
+
is_set = (
|
|
36
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
37
|
+
or k in null_default_fields
|
|
38
|
+
) # pylint: disable=no-member
|
|
39
|
+
|
|
40
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
41
|
+
m[k] = val
|
|
42
|
+
elif val != UNSET_SENTINEL and (
|
|
43
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
44
|
+
):
|
|
45
|
+
m[k] = val
|
|
46
|
+
|
|
47
|
+
return m
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
from mistralai.utils import validate_const
|
|
7
|
+
import pydantic
|
|
8
|
+
from pydantic.functional_validators import AfterValidator
|
|
9
|
+
from typing import Literal, Optional, Union
|
|
10
|
+
from typing_extensions import Annotated, TypedDict
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
ImageURLChunkType = Literal["image_url"]
|
|
14
|
+
|
|
15
|
+
ImageURLChunkImageURLTypedDict = Union[ImageURLTypedDict, str]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
ImageURLChunkImageURL = Union[ImageURL, str]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ImageURLChunkTypedDict(TypedDict):
|
|
22
|
+
r"""{\"type\":\"image_url\",\"image_url\":{\"url\":\"data:image/png;base64,iVBORw0"""
|
|
23
|
+
|
|
24
|
+
image_url: ImageURLChunkImageURLTypedDict
|
|
25
|
+
type: ImageURLChunkType
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ImageURLChunk(BaseModel):
|
|
29
|
+
r"""{\"type\":\"image_url\",\"image_url\":{\"url\":\"data:image/png;base64,iVBORw0"""
|
|
30
|
+
|
|
31
|
+
image_url: ImageURLChunkImageURL
|
|
32
|
+
|
|
33
|
+
TYPE: Annotated[
|
|
34
|
+
Annotated[
|
|
35
|
+
Optional[ImageURLChunkType], AfterValidator(validate_const("image_url"))
|
|
36
|
+
],
|
|
37
|
+
pydantic.Field(alias="type"),
|
|
38
|
+
] = "image_url"
|
mistralai/models/jobin.py
CHANGED
|
@@ -8,8 +8,8 @@ from .trainingparametersin import TrainingParametersIn, TrainingParametersInType
|
|
|
8
8
|
from .wandbintegration import WandbIntegration, WandbIntegrationTypedDict
|
|
9
9
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
10
10
|
from pydantic import model_serializer
|
|
11
|
-
from typing import List, Optional
|
|
12
|
-
from typing_extensions import NotRequired
|
|
11
|
+
from typing import List, Optional
|
|
12
|
+
from typing_extensions import NotRequired, TypedDict
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
JobInIntegrationsTypedDict = WandbIntegrationTypedDict
|
|
@@ -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
|
-
|
|
@@ -3,8 +3,7 @@
|
|
|
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 JobMetadataOutTypedDict(TypedDict):
|
|
@@ -15,21 +14,43 @@ class JobMetadataOutTypedDict(TypedDict):
|
|
|
15
14
|
train_tokens: NotRequired[Nullable[int]]
|
|
16
15
|
data_tokens: NotRequired[Nullable[int]]
|
|
17
16
|
estimated_start_time: NotRequired[Nullable[int]]
|
|
18
|
-
|
|
17
|
+
|
|
19
18
|
|
|
20
19
|
class JobMetadataOut(BaseModel):
|
|
21
20
|
expected_duration_seconds: OptionalNullable[int] = UNSET
|
|
21
|
+
|
|
22
22
|
cost: OptionalNullable[float] = UNSET
|
|
23
|
+
|
|
23
24
|
cost_currency: OptionalNullable[str] = UNSET
|
|
25
|
+
|
|
24
26
|
train_tokens_per_step: OptionalNullable[int] = UNSET
|
|
27
|
+
|
|
25
28
|
train_tokens: OptionalNullable[int] = UNSET
|
|
29
|
+
|
|
26
30
|
data_tokens: OptionalNullable[int] = UNSET
|
|
31
|
+
|
|
27
32
|
estimated_start_time: OptionalNullable[int] = UNSET
|
|
28
|
-
|
|
33
|
+
|
|
29
34
|
@model_serializer(mode="wrap")
|
|
30
35
|
def serialize_model(self, handler):
|
|
31
|
-
optional_fields = [
|
|
32
|
-
|
|
36
|
+
optional_fields = [
|
|
37
|
+
"expected_duration_seconds",
|
|
38
|
+
"cost",
|
|
39
|
+
"cost_currency",
|
|
40
|
+
"train_tokens_per_step",
|
|
41
|
+
"train_tokens",
|
|
42
|
+
"data_tokens",
|
|
43
|
+
"estimated_start_time",
|
|
44
|
+
]
|
|
45
|
+
nullable_fields = [
|
|
46
|
+
"expected_duration_seconds",
|
|
47
|
+
"cost",
|
|
48
|
+
"cost_currency",
|
|
49
|
+
"train_tokens_per_step",
|
|
50
|
+
"train_tokens",
|
|
51
|
+
"data_tokens",
|
|
52
|
+
"estimated_start_time",
|
|
53
|
+
]
|
|
33
54
|
null_default_fields = []
|
|
34
55
|
|
|
35
56
|
serialized = handler(self)
|
|
@@ -39,9 +60,13 @@ class JobMetadataOut(BaseModel):
|
|
|
39
60
|
for n, f in self.model_fields.items():
|
|
40
61
|
k = f.alias or n
|
|
41
62
|
val = serialized.get(k)
|
|
63
|
+
serialized.pop(k, None)
|
|
42
64
|
|
|
43
65
|
optional_nullable = k in optional_fields and k in nullable_fields
|
|
44
|
-
is_set = (
|
|
66
|
+
is_set = (
|
|
67
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
68
|
+
or k in null_default_fields
|
|
69
|
+
) # pylint: disable=no-member
|
|
45
70
|
|
|
46
71
|
if val is not None and val != UNSET_SENTINEL:
|
|
47
72
|
m[k] = val
|
|
@@ -51,4 +76,3 @@ class JobMetadataOut(BaseModel):
|
|
|
51
76
|
m[k] = val
|
|
52
77
|
|
|
53
78
|
return m
|
|
54
|
-
|
mistralai/models/jobout.py
CHANGED
|
@@ -7,13 +7,26 @@ from .jobmetadataout import JobMetadataOut, JobMetadataOutTypedDict
|
|
|
7
7
|
from .trainingparameters import TrainingParameters, TrainingParametersTypedDict
|
|
8
8
|
from .wandbintegrationout import WandbIntegrationOut, WandbIntegrationOutTypedDict
|
|
9
9
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
10
|
+
from mistralai.utils import validate_const
|
|
10
11
|
import pydantic
|
|
11
12
|
from pydantic import model_serializer
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
from pydantic.functional_validators import AfterValidator
|
|
14
|
+
from typing import List, Literal, Optional
|
|
15
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
Status = Literal[
|
|
19
|
+
"QUEUED",
|
|
20
|
+
"STARTED",
|
|
21
|
+
"VALIDATING",
|
|
22
|
+
"VALIDATED",
|
|
23
|
+
"RUNNING",
|
|
24
|
+
"FAILED_VALIDATION",
|
|
25
|
+
"FAILED",
|
|
26
|
+
"SUCCESS",
|
|
27
|
+
"CANCELLED",
|
|
28
|
+
"CANCELLATION_REQUESTED",
|
|
29
|
+
]
|
|
17
30
|
r"""The current status of the fine-tuning job."""
|
|
18
31
|
|
|
19
32
|
Object = Literal["job"]
|
|
@@ -50,6 +63,8 @@ class JobOutTypedDict(TypedDict):
|
|
|
50
63
|
r"""A list containing the IDs of uploaded files that contain training data."""
|
|
51
64
|
validation_files: NotRequired[Nullable[List[str]]]
|
|
52
65
|
r"""A list containing the IDs of uploaded files that contain validation data."""
|
|
66
|
+
object: Object
|
|
67
|
+
r"""The object type of the fine-tuning job."""
|
|
53
68
|
fine_tuned_model: NotRequired[Nullable[str]]
|
|
54
69
|
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."""
|
|
55
70
|
suffix: NotRequired[Nullable[str]]
|
|
@@ -60,44 +75,79 @@ class JobOutTypedDict(TypedDict):
|
|
|
60
75
|
r"""Total number of tokens trained."""
|
|
61
76
|
repositories: NotRequired[List[RepositoriesTypedDict]]
|
|
62
77
|
metadata: NotRequired[Nullable[JobMetadataOutTypedDict]]
|
|
63
|
-
|
|
78
|
+
|
|
64
79
|
|
|
65
80
|
class JobOut(BaseModel):
|
|
66
81
|
id: str
|
|
67
82
|
r"""The ID of the job."""
|
|
83
|
+
|
|
68
84
|
auto_start: bool
|
|
85
|
+
|
|
69
86
|
hyperparameters: TrainingParameters
|
|
87
|
+
|
|
70
88
|
model: FineTuneableModel
|
|
71
89
|
r"""The name of the model to fine-tune."""
|
|
90
|
+
|
|
72
91
|
status: Status
|
|
73
92
|
r"""The current status of the fine-tuning job."""
|
|
93
|
+
|
|
74
94
|
job_type: str
|
|
75
95
|
r"""The type of job (`FT` for fine-tuning)."""
|
|
96
|
+
|
|
76
97
|
created_at: int
|
|
77
98
|
r"""The UNIX timestamp (in seconds) for when the fine-tuning job was created."""
|
|
99
|
+
|
|
78
100
|
modified_at: int
|
|
79
101
|
r"""The UNIX timestamp (in seconds) for when the fine-tuning job was last modified."""
|
|
102
|
+
|
|
80
103
|
training_files: List[str]
|
|
81
104
|
r"""A list containing the IDs of uploaded files that contain training data."""
|
|
105
|
+
|
|
82
106
|
validation_files: OptionalNullable[List[str]] = UNSET
|
|
83
107
|
r"""A list containing the IDs of uploaded files that contain validation data."""
|
|
84
|
-
|
|
108
|
+
|
|
109
|
+
OBJECT: Annotated[
|
|
110
|
+
Annotated[Optional[Object], AfterValidator(validate_const("job"))],
|
|
111
|
+
pydantic.Field(alias="object"),
|
|
112
|
+
] = "job"
|
|
85
113
|
r"""The object type of the fine-tuning job."""
|
|
114
|
+
|
|
86
115
|
fine_tuned_model: OptionalNullable[str] = UNSET
|
|
87
116
|
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."""
|
|
117
|
+
|
|
88
118
|
suffix: OptionalNullable[str] = UNSET
|
|
89
119
|
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`."""
|
|
120
|
+
|
|
90
121
|
integrations: OptionalNullable[List[Integrations]] = UNSET
|
|
91
122
|
r"""A list of integrations enabled for your fine-tuning job."""
|
|
123
|
+
|
|
92
124
|
trained_tokens: OptionalNullable[int] = UNSET
|
|
93
125
|
r"""Total number of tokens trained."""
|
|
126
|
+
|
|
94
127
|
repositories: Optional[List[Repositories]] = None
|
|
128
|
+
|
|
95
129
|
metadata: OptionalNullable[JobMetadataOut] = UNSET
|
|
96
|
-
|
|
130
|
+
|
|
97
131
|
@model_serializer(mode="wrap")
|
|
98
132
|
def serialize_model(self, handler):
|
|
99
|
-
optional_fields = [
|
|
100
|
-
|
|
133
|
+
optional_fields = [
|
|
134
|
+
"validation_files",
|
|
135
|
+
"object",
|
|
136
|
+
"fine_tuned_model",
|
|
137
|
+
"suffix",
|
|
138
|
+
"integrations",
|
|
139
|
+
"trained_tokens",
|
|
140
|
+
"repositories",
|
|
141
|
+
"metadata",
|
|
142
|
+
]
|
|
143
|
+
nullable_fields = [
|
|
144
|
+
"validation_files",
|
|
145
|
+
"fine_tuned_model",
|
|
146
|
+
"suffix",
|
|
147
|
+
"integrations",
|
|
148
|
+
"trained_tokens",
|
|
149
|
+
"metadata",
|
|
150
|
+
]
|
|
101
151
|
null_default_fields = []
|
|
102
152
|
|
|
103
153
|
serialized = handler(self)
|
|
@@ -107,9 +157,13 @@ class JobOut(BaseModel):
|
|
|
107
157
|
for n, f in self.model_fields.items():
|
|
108
158
|
k = f.alias or n
|
|
109
159
|
val = serialized.get(k)
|
|
160
|
+
serialized.pop(k, None)
|
|
110
161
|
|
|
111
162
|
optional_nullable = k in optional_fields and k in nullable_fields
|
|
112
|
-
is_set = (
|
|
163
|
+
is_set = (
|
|
164
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
165
|
+
or k in null_default_fields
|
|
166
|
+
) # pylint: disable=no-member
|
|
113
167
|
|
|
114
168
|
if val is not None and val != UNSET_SENTINEL:
|
|
115
169
|
m[k] = val
|
|
@@ -119,4 +173,3 @@ class JobOut(BaseModel):
|
|
|
119
173
|
m[k] = val
|
|
120
174
|
|
|
121
175
|
return m
|
|
122
|
-
|
|
@@ -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_extensions import Annotated, TypedDict
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class JobsAPIRoutesBatchCancelBatchJobRequestTypedDict(TypedDict):
|
|
10
|
+
job_id: str
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class JobsAPIRoutesBatchCancelBatchJobRequest(BaseModel):
|
|
14
|
+
job_id: Annotated[
|
|
15
|
+
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_extensions import Annotated, TypedDict
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class JobsAPIRoutesBatchGetBatchJobRequestTypedDict(TypedDict):
|
|
10
|
+
job_id: str
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class JobsAPIRoutesBatchGetBatchJobRequest(BaseModel):
|
|
14
|
+
job_id: Annotated[
|
|
15
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
16
|
+
]
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .batchjobstatus import BatchJobStatus
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
7
|
+
from mistralai.utils import FieldMetadata, QueryParamMetadata
|
|
8
|
+
from pydantic import model_serializer
|
|
9
|
+
from typing import Any, Dict, Optional
|
|
10
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class JobsAPIRoutesBatchGetBatchJobsRequestTypedDict(TypedDict):
|
|
14
|
+
page: NotRequired[int]
|
|
15
|
+
page_size: NotRequired[int]
|
|
16
|
+
model: NotRequired[Nullable[str]]
|
|
17
|
+
metadata: NotRequired[Nullable[Dict[str, Any]]]
|
|
18
|
+
created_after: NotRequired[Nullable[datetime]]
|
|
19
|
+
created_by_me: NotRequired[bool]
|
|
20
|
+
status: NotRequired[Nullable[BatchJobStatus]]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class JobsAPIRoutesBatchGetBatchJobsRequest(BaseModel):
|
|
24
|
+
page: Annotated[
|
|
25
|
+
Optional[int],
|
|
26
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
27
|
+
] = 0
|
|
28
|
+
|
|
29
|
+
page_size: Annotated[
|
|
30
|
+
Optional[int],
|
|
31
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
32
|
+
] = 100
|
|
33
|
+
|
|
34
|
+
model: Annotated[
|
|
35
|
+
OptionalNullable[str],
|
|
36
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
37
|
+
] = UNSET
|
|
38
|
+
|
|
39
|
+
metadata: Annotated[
|
|
40
|
+
OptionalNullable[Dict[str, Any]],
|
|
41
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
42
|
+
] = UNSET
|
|
43
|
+
|
|
44
|
+
created_after: Annotated[
|
|
45
|
+
OptionalNullable[datetime],
|
|
46
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
47
|
+
] = UNSET
|
|
48
|
+
|
|
49
|
+
created_by_me: Annotated[
|
|
50
|
+
Optional[bool],
|
|
51
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
52
|
+
] = False
|
|
53
|
+
|
|
54
|
+
status: Annotated[
|
|
55
|
+
OptionalNullable[BatchJobStatus],
|
|
56
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
57
|
+
] = UNSET
|
|
58
|
+
|
|
59
|
+
@model_serializer(mode="wrap")
|
|
60
|
+
def serialize_model(self, handler):
|
|
61
|
+
optional_fields = [
|
|
62
|
+
"page",
|
|
63
|
+
"page_size",
|
|
64
|
+
"model",
|
|
65
|
+
"metadata",
|
|
66
|
+
"created_after",
|
|
67
|
+
"created_by_me",
|
|
68
|
+
"status",
|
|
69
|
+
]
|
|
70
|
+
nullable_fields = ["model", "metadata", "created_after", "status"]
|
|
71
|
+
null_default_fields = []
|
|
72
|
+
|
|
73
|
+
serialized = handler(self)
|
|
74
|
+
|
|
75
|
+
m = {}
|
|
76
|
+
|
|
77
|
+
for n, f in self.model_fields.items():
|
|
78
|
+
k = f.alias or n
|
|
79
|
+
val = serialized.get(k)
|
|
80
|
+
serialized.pop(k, None)
|
|
81
|
+
|
|
82
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
83
|
+
is_set = (
|
|
84
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
85
|
+
or k in null_default_fields
|
|
86
|
+
) # pylint: disable=no-member
|
|
87
|
+
|
|
88
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
89
|
+
m[k] = val
|
|
90
|
+
elif val != UNSET_SENTINEL and (
|
|
91
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
92
|
+
):
|
|
93
|
+
m[k] = val
|
|
94
|
+
|
|
95
|
+
return m
|
|
@@ -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 JobsAPIRoutesFineTuningArchiveFineTunedModelRequestTypedDict(TypedDict):
|
|
11
10
|
model_id: str
|
|
12
11
|
r"""The ID of the model to archive."""
|
|
13
|
-
|
|
12
|
+
|
|
14
13
|
|
|
15
14
|
class JobsAPIRoutesFineTuningArchiveFineTunedModelRequest(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 archive."""
|
|
18
|
-
|
|
@@ -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 JobsAPIRoutesFineTuningCancelFineTuningJobRequestTypedDict(TypedDict):
|
|
11
10
|
job_id: str
|
|
12
11
|
r"""The ID of the job to cancel."""
|
|
13
|
-
|
|
12
|
+
|
|
14
13
|
|
|
15
14
|
class JobsAPIRoutesFineTuningCancelFineTuningJobRequest(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 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
|
-
|