mistralai 1.1.0__py3-none-any.whl → 1.2.1__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/_version.py +12 -0
- mistralai/agents.py +56 -22
- mistralai/batch.py +17 -0
- mistralai/chat.py +64 -30
- mistralai/classifiers.py +396 -0
- mistralai/embeddings.py +10 -6
- mistralai/files.py +252 -19
- mistralai/fim.py +40 -30
- mistralai/jobs.py +40 -20
- mistralai/mistral_jobs.py +733 -0
- mistralai/models/__init__.py +108 -18
- mistralai/models/agentscompletionrequest.py +27 -10
- mistralai/models/agentscompletionstreamrequest.py +27 -10
- mistralai/models/apiendpoint.py +9 -0
- mistralai/models/archiveftmodelout.py +11 -5
- mistralai/models/assistantmessage.py +11 -6
- mistralai/models/basemodelcard.py +22 -6
- 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 +9 -4
- mistralai/models/chatcompletionrequest.py +32 -13
- mistralai/models/chatcompletionresponse.py +2 -2
- mistralai/models/chatcompletionstreamrequest.py +32 -13
- mistralai/models/checkpointout.py +1 -1
- mistralai/models/classificationobject.py +21 -0
- mistralai/models/classificationrequest.py +59 -0
- mistralai/models/classificationresponse.py +21 -0
- mistralai/models/completionchunk.py +2 -2
- mistralai/models/completionevent.py +1 -1
- mistralai/models/completionresponsestreamchoice.py +11 -5
- mistralai/models/delete_model_v1_models_model_id_deleteop.py +1 -2
- mistralai/models/deletefileout.py +1 -1
- mistralai/models/deletemodelout.py +2 -2
- mistralai/models/deltamessage.py +14 -7
- mistralai/models/detailedjobout.py +11 -5
- mistralai/models/embeddingrequest.py +5 -5
- mistralai/models/embeddingresponse.py +2 -1
- mistralai/models/embeddingresponsedata.py +2 -2
- mistralai/models/eventout.py +2 -2
- mistralai/models/filepurpose.py +8 -0
- mistralai/models/files_api_routes_delete_fileop.py +1 -2
- 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 +1 -2
- mistralai/models/files_api_routes_upload_fileop.py +9 -9
- mistralai/models/fileschema.py +7 -21
- mistralai/models/fimcompletionrequest.py +20 -13
- mistralai/models/fimcompletionresponse.py +2 -2
- mistralai/models/fimcompletionstreamrequest.py +20 -13
- mistralai/models/ftmodelcapabilitiesout.py +2 -2
- mistralai/models/ftmodelcard.py +24 -6
- mistralai/models/ftmodelout.py +9 -5
- mistralai/models/function.py +2 -2
- mistralai/models/functioncall.py +2 -1
- mistralai/models/functionname.py +1 -1
- mistralai/models/githubrepositoryin.py +11 -5
- mistralai/models/githubrepositoryout.py +11 -5
- mistralai/models/httpvalidationerror.py +0 -2
- mistralai/models/imageurl.py +1 -2
- mistralai/models/imageurlchunk.py +11 -5
- mistralai/models/jobin.py +2 -2
- mistralai/models/jobmetadataout.py +1 -2
- mistralai/models/jobout.py +10 -5
- 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 +1 -2
- mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +1 -2
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +1 -2
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +2 -2
- mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +1 -2
- mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +1 -2
- mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +1 -2
- mistralai/models/jobsout.py +9 -5
- mistralai/models/legacyjobmetadataout.py +12 -5
- mistralai/models/listfilesout.py +5 -1
- mistralai/models/metricout.py +1 -2
- mistralai/models/modelcapabilities.py +2 -2
- mistralai/models/modellist.py +2 -2
- mistralai/models/responseformat.py +2 -2
- mistralai/models/retrieve_model_v1_models_model_id_getop.py +2 -2
- mistralai/models/retrievefileout.py +10 -21
- mistralai/models/sampletype.py +6 -2
- mistralai/models/security.py +2 -2
- mistralai/models/source.py +3 -2
- mistralai/models/systemmessage.py +6 -6
- mistralai/models/textchunk.py +9 -5
- mistralai/models/tool.py +2 -2
- mistralai/models/toolcall.py +2 -2
- mistralai/models/toolchoice.py +2 -2
- mistralai/models/toolmessage.py +2 -2
- mistralai/models/trainingfile.py +2 -2
- mistralai/models/trainingparameters.py +7 -2
- mistralai/models/trainingparametersin.py +7 -2
- mistralai/models/unarchiveftmodelout.py +11 -5
- mistralai/models/updateftmodelin.py +1 -2
- mistralai/models/uploadfileout.py +7 -21
- mistralai/models/usageinfo.py +1 -1
- mistralai/models/usermessage.py +36 -5
- mistralai/models/validationerror.py +2 -1
- mistralai/models/wandbintegration.py +11 -5
- mistralai/models/wandbintegrationout.py +12 -6
- mistralai/models_.py +48 -24
- mistralai/sdk.py +7 -0
- mistralai/sdkconfiguration.py +7 -7
- mistralai/utils/__init__.py +8 -0
- mistralai/utils/annotations.py +13 -2
- mistralai/utils/serializers.py +25 -0
- {mistralai-1.1.0.dist-info → mistralai-1.2.1.dist-info}/METADATA +90 -14
- mistralai-1.2.1.dist-info/RECORD +276 -0
- {mistralai-1.1.0.dist-info → mistralai-1.2.1.dist-info}/WHEEL +1 -1
- mistralai_azure/__init__.py +4 -0
- mistralai_azure/_version.py +12 -0
- mistralai_azure/chat.py +64 -30
- mistralai_azure/models/__init__.py +9 -3
- mistralai_azure/models/assistantmessage.py +11 -6
- mistralai_azure/models/chatcompletionchoice.py +10 -5
- mistralai_azure/models/chatcompletionrequest.py +32 -13
- mistralai_azure/models/chatcompletionresponse.py +2 -2
- mistralai_azure/models/chatcompletionstreamrequest.py +32 -13
- mistralai_azure/models/completionchunk.py +2 -2
- mistralai_azure/models/completionevent.py +1 -1
- mistralai_azure/models/completionresponsestreamchoice.py +9 -4
- mistralai_azure/models/deltamessage.py +14 -7
- mistralai_azure/models/function.py +2 -2
- mistralai_azure/models/functioncall.py +2 -1
- mistralai_azure/models/functionname.py +1 -1
- mistralai_azure/models/httpvalidationerror.py +0 -2
- mistralai_azure/models/responseformat.py +2 -2
- mistralai_azure/models/security.py +1 -2
- mistralai_azure/models/systemmessage.py +6 -6
- mistralai_azure/models/textchunk.py +9 -5
- mistralai_azure/models/tool.py +2 -2
- mistralai_azure/models/toolcall.py +2 -2
- mistralai_azure/models/toolchoice.py +2 -2
- mistralai_azure/models/toolmessage.py +2 -2
- mistralai_azure/models/usageinfo.py +1 -1
- mistralai_azure/models/usermessage.py +36 -5
- mistralai_azure/models/validationerror.py +2 -1
- mistralai_azure/sdkconfiguration.py +7 -7
- mistralai_azure/utils/__init__.py +8 -0
- mistralai_azure/utils/annotations.py +13 -2
- mistralai_azure/utils/serializers.py +25 -0
- mistralai_gcp/__init__.py +4 -0
- mistralai_gcp/_version.py +12 -0
- mistralai_gcp/chat.py +64 -30
- mistralai_gcp/fim.py +40 -30
- mistralai_gcp/models/__init__.py +9 -3
- mistralai_gcp/models/assistantmessage.py +11 -6
- mistralai_gcp/models/chatcompletionchoice.py +10 -5
- mistralai_gcp/models/chatcompletionrequest.py +32 -13
- mistralai_gcp/models/chatcompletionresponse.py +2 -2
- mistralai_gcp/models/chatcompletionstreamrequest.py +32 -13
- mistralai_gcp/models/completionchunk.py +2 -2
- mistralai_gcp/models/completionevent.py +1 -1
- mistralai_gcp/models/completionresponsestreamchoice.py +9 -4
- mistralai_gcp/models/deltamessage.py +14 -7
- mistralai_gcp/models/fimcompletionrequest.py +20 -13
- mistralai_gcp/models/fimcompletionresponse.py +2 -2
- mistralai_gcp/models/fimcompletionstreamrequest.py +20 -13
- mistralai_gcp/models/function.py +2 -2
- mistralai_gcp/models/functioncall.py +2 -1
- mistralai_gcp/models/functionname.py +1 -1
- mistralai_gcp/models/httpvalidationerror.py +0 -2
- mistralai_gcp/models/responseformat.py +2 -2
- mistralai_gcp/models/security.py +1 -2
- mistralai_gcp/models/systemmessage.py +6 -6
- mistralai_gcp/models/textchunk.py +9 -5
- mistralai_gcp/models/tool.py +2 -2
- mistralai_gcp/models/toolcall.py +2 -2
- mistralai_gcp/models/toolchoice.py +2 -2
- mistralai_gcp/models/toolmessage.py +2 -2
- mistralai_gcp/models/usageinfo.py +1 -1
- mistralai_gcp/models/usermessage.py +36 -5
- mistralai_gcp/models/validationerror.py +2 -1
- mistralai_gcp/sdk.py +20 -11
- mistralai_gcp/sdkconfiguration.py +7 -7
- mistralai_gcp/utils/__init__.py +8 -0
- mistralai_gcp/utils/annotations.py +13 -2
- mistralai_gcp/utils/serializers.py +25 -0
- mistralai-1.1.0.dist-info/RECORD +0 -254
- {mistralai-1.1.0.dist-info → mistralai-1.2.1.dist-info}/LICENSE +0 -0
mistralai/models/jobsout.py
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
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"]
|
|
@@ -14,6 +16,7 @@ JobsOutObject = Literal["list"]
|
|
|
14
16
|
class JobsOutTypedDict(TypedDict):
|
|
15
17
|
total: int
|
|
16
18
|
data: NotRequired[List[JobOutTypedDict]]
|
|
19
|
+
object: JobsOutObject
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
class JobsOut(BaseModel):
|
|
@@ -21,6 +24,7 @@ class JobsOut(BaseModel):
|
|
|
21
24
|
|
|
22
25
|
data: Optional[List[JobOut]] = None
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
OBJECT: Annotated[
|
|
28
|
+
Annotated[Optional[JobsOutObject], AfterValidator(validate_const("list"))],
|
|
29
|
+
pydantic.Field(alias="object"),
|
|
30
|
+
] = "list"
|
|
@@ -2,10 +2,12 @@
|
|
|
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"]
|
|
@@ -31,6 +33,7 @@ class LegacyJobMetadataOutTypedDict(TypedDict):
|
|
|
31
33
|
r"""The number of complete passes through the entire training dataset."""
|
|
32
34
|
training_steps: NotRequired[Nullable[int]]
|
|
33
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."""
|
|
36
|
+
object: LegacyJobMetadataOutObject
|
|
34
37
|
|
|
35
38
|
|
|
36
39
|
class LegacyJobMetadataOut(BaseModel):
|
|
@@ -64,9 +67,13 @@ class LegacyJobMetadataOut(BaseModel):
|
|
|
64
67
|
training_steps: OptionalNullable[int] = UNSET
|
|
65
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."""
|
|
66
69
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
OBJECT: Annotated[
|
|
71
|
+
Annotated[
|
|
72
|
+
Optional[LegacyJobMetadataOutObject],
|
|
73
|
+
AfterValidator(validate_const("job.metadata")),
|
|
74
|
+
],
|
|
75
|
+
pydantic.Field(alias="object"),
|
|
76
|
+
] = "job.metadata"
|
|
70
77
|
|
|
71
78
|
@model_serializer(mode="wrap")
|
|
72
79
|
def serialize_model(self, handler):
|
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
|
|
13
|
+
total: int
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
class ListFilesOut(BaseModel):
|
|
15
17
|
data: List[FileSchema]
|
|
16
18
|
|
|
17
19
|
object: str
|
|
20
|
+
|
|
21
|
+
total: int
|
mistralai/models/metricout.py
CHANGED
|
@@ -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 MetricOutTypedDict(TypedDict):
|
|
@@ -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):
|
mistralai/models/modellist.py
CHANGED
|
@@ -6,8 +6,8 @@ from .ftmodelcard import FTModelCard, FTModelCardTypedDict
|
|
|
6
6
|
from mistralai.types import BaseModel
|
|
7
7
|
from mistralai.utils import get_discriminator
|
|
8
8
|
from pydantic import Discriminator, Tag
|
|
9
|
-
from typing import List, Optional,
|
|
10
|
-
from typing_extensions import Annotated, NotRequired
|
|
9
|
+
from typing import List, Optional, Union
|
|
10
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
DataTypedDict = Union[BaseModelCardTypedDict, FTModelCardTypedDict]
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .responseformats import ResponseFormats
|
|
5
5
|
from mistralai.types import BaseModel
|
|
6
|
-
from typing import Optional
|
|
7
|
-
from typing_extensions import NotRequired
|
|
6
|
+
from typing import Optional
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class ResponseFormatTypedDict(TypedDict):
|
|
@@ -6,8 +6,8 @@ from .ftmodelcard import FTModelCard, FTModelCardTypedDict
|
|
|
6
6
|
from mistralai.types import BaseModel
|
|
7
7
|
from mistralai.utils import FieldMetadata, PathParamMetadata, get_discriminator
|
|
8
8
|
from pydantic import Discriminator, Tag
|
|
9
|
-
from typing import
|
|
10
|
-
from typing_extensions import Annotated
|
|
9
|
+
from typing import Union
|
|
10
|
+
from typing_extensions import Annotated, TypedDict
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class RetrieveModelV1ModelsModelIDGetRequestTypedDict(TypedDict):
|
|
@@ -1,26 +1,14 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .filepurpose import FilePurpose
|
|
4
5
|
from .sampletype import SampleType
|
|
5
6
|
from .source import Source
|
|
6
|
-
from mistralai.types import
|
|
7
|
-
BaseModel,
|
|
8
|
-
Nullable,
|
|
9
|
-
OptionalNullable,
|
|
10
|
-
UNSET,
|
|
11
|
-
UNSET_SENTINEL,
|
|
12
|
-
UnrecognizedStr,
|
|
13
|
-
)
|
|
7
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
14
8
|
from mistralai.utils import validate_open_enum
|
|
15
|
-
import pydantic
|
|
16
9
|
from pydantic import model_serializer
|
|
17
10
|
from pydantic.functional_validators import PlainValidator
|
|
18
|
-
from
|
|
19
|
-
from typing_extensions import Annotated, NotRequired
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
RetrieveFileOutPurpose = Union[Literal["fine-tune"], UnrecognizedStr]
|
|
23
|
-
r"""The intended purpose of the uploaded file. Only accepts fine-tuning (`fine-tune`) for now."""
|
|
11
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
24
12
|
|
|
25
13
|
|
|
26
14
|
class RetrieveFileOutTypedDict(TypedDict):
|
|
@@ -34,8 +22,10 @@ class RetrieveFileOutTypedDict(TypedDict):
|
|
|
34
22
|
r"""The UNIX timestamp (in seconds) of the event."""
|
|
35
23
|
filename: str
|
|
36
24
|
r"""The name of the uploaded file."""
|
|
25
|
+
purpose: FilePurpose
|
|
37
26
|
sample_type: SampleType
|
|
38
27
|
source: Source
|
|
28
|
+
deleted: bool
|
|
39
29
|
num_lines: NotRequired[Nullable[int]]
|
|
40
30
|
|
|
41
31
|
|
|
@@ -55,14 +45,13 @@ class RetrieveFileOut(BaseModel):
|
|
|
55
45
|
filename: str
|
|
56
46
|
r"""The name of the uploaded file."""
|
|
57
47
|
|
|
58
|
-
|
|
48
|
+
purpose: Annotated[FilePurpose, PlainValidator(validate_open_enum(False))]
|
|
59
49
|
|
|
60
|
-
|
|
50
|
+
sample_type: Annotated[SampleType, PlainValidator(validate_open_enum(False))]
|
|
51
|
+
|
|
52
|
+
source: Annotated[Source, PlainValidator(validate_open_enum(False))]
|
|
61
53
|
|
|
62
|
-
|
|
63
|
-
PURPOSE: Annotated[Final[Annotated[RetrieveFileOutPurpose, PlainValidator(validate_open_enum(False))]], pydantic.Field(alias="purpose")] = "fine-tune" # type: ignore
|
|
64
|
-
# fmt: on
|
|
65
|
-
r"""The intended purpose of the uploaded file. Only accepts fine-tuning (`fine-tune`) for now."""
|
|
54
|
+
deleted: bool
|
|
66
55
|
|
|
67
56
|
num_lines: OptionalNullable[int] = UNSET
|
|
68
57
|
|
mistralai/models/sampletype.py
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from
|
|
4
|
+
from mistralai.types import UnrecognizedStr
|
|
5
|
+
from typing import Literal, Union
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
SampleType =
|
|
8
|
+
SampleType = Union[
|
|
9
|
+
Literal["pretrain", "instruct", "batch_request", "batch_result", "batch_error"],
|
|
10
|
+
UnrecognizedStr,
|
|
11
|
+
]
|
mistralai/models/security.py
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
5
|
from mistralai.utils import FieldMetadata, SecurityMetadata
|
|
6
|
-
from typing import Optional
|
|
7
|
-
from typing_extensions import Annotated, NotRequired
|
|
6
|
+
from typing import Optional
|
|
7
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class SecurityTypedDict(TypedDict):
|
mistralai/models/source.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from
|
|
4
|
+
from mistralai.types import UnrecognizedStr
|
|
5
|
+
from typing import Literal, Union
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
Source = Literal["upload", "repository"]
|
|
8
|
+
Source = Union[Literal["upload", "repository", "mistral"], UnrecognizedStr]
|
|
@@ -3,25 +3,25 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .textchunk import TextChunk, TextChunkTypedDict
|
|
5
5
|
from mistralai.types import BaseModel
|
|
6
|
-
from typing import List, Literal, Optional,
|
|
7
|
-
from typing_extensions import NotRequired
|
|
6
|
+
from typing import List, Literal, Optional, Union
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
SystemMessageContentTypedDict = Union[str, List[TextChunkTypedDict]]
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
SystemMessageContent = Union[str, List[TextChunk]]
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
Role = Literal["system"]
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class SystemMessageTypedDict(TypedDict):
|
|
20
|
-
content:
|
|
20
|
+
content: SystemMessageContentTypedDict
|
|
21
21
|
role: NotRequired[Role]
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class SystemMessage(BaseModel):
|
|
25
|
-
content:
|
|
25
|
+
content: SystemMessageContent
|
|
26
26
|
|
|
27
27
|
role: Optional[Role] = "system"
|
mistralai/models/textchunk.py
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
|
+
from mistralai.utils import validate_const
|
|
5
6
|
import pydantic
|
|
6
|
-
from
|
|
7
|
-
from
|
|
7
|
+
from pydantic.functional_validators import AfterValidator
|
|
8
|
+
from typing import Literal, Optional
|
|
9
|
+
from typing_extensions import Annotated, TypedDict
|
|
8
10
|
|
|
9
11
|
|
|
10
12
|
TextChunkType = Literal["text"]
|
|
@@ -12,11 +14,13 @@ TextChunkType = Literal["text"]
|
|
|
12
14
|
|
|
13
15
|
class TextChunkTypedDict(TypedDict):
|
|
14
16
|
text: str
|
|
17
|
+
type: TextChunkType
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
class TextChunk(BaseModel):
|
|
18
21
|
text: str
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
TYPE: Annotated[
|
|
24
|
+
Annotated[Optional[TextChunkType], AfterValidator(validate_const("text"))],
|
|
25
|
+
pydantic.Field(alias="type"),
|
|
26
|
+
] = "text"
|
mistralai/models/tool.py
CHANGED
|
@@ -6,8 +6,8 @@ from .tooltypes import ToolTypes
|
|
|
6
6
|
from mistralai.types import BaseModel
|
|
7
7
|
from mistralai.utils import validate_open_enum
|
|
8
8
|
from pydantic.functional_validators import PlainValidator
|
|
9
|
-
from typing import Optional
|
|
10
|
-
from typing_extensions import Annotated, NotRequired
|
|
9
|
+
from typing import Optional
|
|
10
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class ToolTypedDict(TypedDict):
|
mistralai/models/toolcall.py
CHANGED
|
@@ -6,8 +6,8 @@ from .tooltypes import ToolTypes
|
|
|
6
6
|
from mistralai.types import BaseModel
|
|
7
7
|
from mistralai.utils import validate_open_enum
|
|
8
8
|
from pydantic.functional_validators import PlainValidator
|
|
9
|
-
from typing import Optional
|
|
10
|
-
from typing_extensions import Annotated, NotRequired
|
|
9
|
+
from typing import Optional
|
|
10
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class ToolCallTypedDict(TypedDict):
|
mistralai/models/toolchoice.py
CHANGED
|
@@ -6,8 +6,8 @@ from .tooltypes import ToolTypes
|
|
|
6
6
|
from mistralai.types import BaseModel
|
|
7
7
|
from mistralai.utils import validate_open_enum
|
|
8
8
|
from pydantic.functional_validators import PlainValidator
|
|
9
|
-
from typing import Optional
|
|
10
|
-
from typing_extensions import Annotated, NotRequired
|
|
9
|
+
from typing import Optional
|
|
10
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class ToolChoiceTypedDict(TypedDict):
|
mistralai/models/toolmessage.py
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
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 typing import Literal, Optional
|
|
7
|
-
from typing_extensions import NotRequired
|
|
6
|
+
from typing import Literal, Optional
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
ToolMessageRole = Literal["tool"]
|
mistralai/models/trainingfile.py
CHANGED
|
@@ -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 TrainingFileTypedDict(TypedDict):
|
|
@@ -3,8 +3,8 @@
|
|
|
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 typing import Optional
|
|
7
|
-
from typing_extensions import NotRequired
|
|
6
|
+
from typing import Optional
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class TrainingParametersTypedDict(TypedDict):
|
|
@@ -14,6 +14,7 @@ class TrainingParametersTypedDict(TypedDict):
|
|
|
14
14
|
warmup_fraction: NotRequired[Nullable[float]]
|
|
15
15
|
epochs: NotRequired[Nullable[float]]
|
|
16
16
|
fim_ratio: NotRequired[Nullable[float]]
|
|
17
|
+
seq_len: NotRequired[Nullable[int]]
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
class TrainingParameters(BaseModel):
|
|
@@ -29,6 +30,8 @@ class TrainingParameters(BaseModel):
|
|
|
29
30
|
|
|
30
31
|
fim_ratio: OptionalNullable[float] = UNSET
|
|
31
32
|
|
|
33
|
+
seq_len: OptionalNullable[int] = UNSET
|
|
34
|
+
|
|
32
35
|
@model_serializer(mode="wrap")
|
|
33
36
|
def serialize_model(self, handler):
|
|
34
37
|
optional_fields = [
|
|
@@ -38,6 +41,7 @@ class TrainingParameters(BaseModel):
|
|
|
38
41
|
"warmup_fraction",
|
|
39
42
|
"epochs",
|
|
40
43
|
"fim_ratio",
|
|
44
|
+
"seq_len",
|
|
41
45
|
]
|
|
42
46
|
nullable_fields = [
|
|
43
47
|
"training_steps",
|
|
@@ -45,6 +49,7 @@ class TrainingParameters(BaseModel):
|
|
|
45
49
|
"warmup_fraction",
|
|
46
50
|
"epochs",
|
|
47
51
|
"fim_ratio",
|
|
52
|
+
"seq_len",
|
|
48
53
|
]
|
|
49
54
|
null_default_fields = []
|
|
50
55
|
|
|
@@ -3,8 +3,8 @@
|
|
|
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 typing import Optional
|
|
7
|
-
from typing_extensions import NotRequired
|
|
6
|
+
from typing import Optional
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class TrainingParametersInTypedDict(TypedDict):
|
|
@@ -20,6 +20,7 @@ class TrainingParametersInTypedDict(TypedDict):
|
|
|
20
20
|
r"""(Advanced Usage) A parameter that specifies the percentage of the total training steps at which the learning rate warm-up phase ends. During this phase, the learning rate gradually increases from a small value to the initial learning rate, helping to stabilize the training process and improve convergence. Similar to `pct_start` in [mistral-finetune](https://github.com/mistralai/mistral-finetune)"""
|
|
21
21
|
epochs: NotRequired[Nullable[float]]
|
|
22
22
|
fim_ratio: NotRequired[Nullable[float]]
|
|
23
|
+
seq_len: NotRequired[Nullable[int]]
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
class TrainingParametersIn(BaseModel):
|
|
@@ -41,6 +42,8 @@ class TrainingParametersIn(BaseModel):
|
|
|
41
42
|
|
|
42
43
|
fim_ratio: OptionalNullable[float] = UNSET
|
|
43
44
|
|
|
45
|
+
seq_len: OptionalNullable[int] = UNSET
|
|
46
|
+
|
|
44
47
|
@model_serializer(mode="wrap")
|
|
45
48
|
def serialize_model(self, handler):
|
|
46
49
|
optional_fields = [
|
|
@@ -50,6 +53,7 @@ class TrainingParametersIn(BaseModel):
|
|
|
50
53
|
"warmup_fraction",
|
|
51
54
|
"epochs",
|
|
52
55
|
"fim_ratio",
|
|
56
|
+
"seq_len",
|
|
53
57
|
]
|
|
54
58
|
nullable_fields = [
|
|
55
59
|
"training_steps",
|
|
@@ -57,6 +61,7 @@ class TrainingParametersIn(BaseModel):
|
|
|
57
61
|
"warmup_fraction",
|
|
58
62
|
"epochs",
|
|
59
63
|
"fim_ratio",
|
|
64
|
+
"seq_len",
|
|
60
65
|
]
|
|
61
66
|
null_default_fields = []
|
|
62
67
|
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
|
+
from mistralai.utils import validate_const
|
|
5
6
|
import pydantic
|
|
6
|
-
from
|
|
7
|
-
from
|
|
7
|
+
from pydantic.functional_validators import AfterValidator
|
|
8
|
+
from typing import Literal, Optional
|
|
9
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
8
10
|
|
|
9
11
|
|
|
10
12
|
UnarchiveFTModelOutObject = Literal["model"]
|
|
@@ -12,14 +14,18 @@ UnarchiveFTModelOutObject = Literal["model"]
|
|
|
12
14
|
|
|
13
15
|
class UnarchiveFTModelOutTypedDict(TypedDict):
|
|
14
16
|
id: str
|
|
17
|
+
object: UnarchiveFTModelOutObject
|
|
15
18
|
archived: NotRequired[bool]
|
|
16
19
|
|
|
17
20
|
|
|
18
21
|
class UnarchiveFTModelOut(BaseModel):
|
|
19
22
|
id: str
|
|
20
23
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
OBJECT: Annotated[
|
|
25
|
+
Annotated[
|
|
26
|
+
Optional[UnarchiveFTModelOutObject], AfterValidator(validate_const("model"))
|
|
27
|
+
],
|
|
28
|
+
pydantic.Field(alias="object"),
|
|
29
|
+
] = "model"
|
|
24
30
|
|
|
25
31
|
archived: Optional[bool] = False
|
|
@@ -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 UpdateFTModelInTypedDict(TypedDict):
|
|
@@ -1,26 +1,14 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .filepurpose import FilePurpose
|
|
4
5
|
from .sampletype import SampleType
|
|
5
6
|
from .source import Source
|
|
6
|
-
from mistralai.types import
|
|
7
|
-
BaseModel,
|
|
8
|
-
Nullable,
|
|
9
|
-
OptionalNullable,
|
|
10
|
-
UNSET,
|
|
11
|
-
UNSET_SENTINEL,
|
|
12
|
-
UnrecognizedStr,
|
|
13
|
-
)
|
|
7
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
14
8
|
from mistralai.utils import validate_open_enum
|
|
15
|
-
import pydantic
|
|
16
9
|
from pydantic import model_serializer
|
|
17
10
|
from pydantic.functional_validators import PlainValidator
|
|
18
|
-
from
|
|
19
|
-
from typing_extensions import Annotated, NotRequired
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Purpose = Union[Literal["fine-tune"], UnrecognizedStr]
|
|
23
|
-
r"""The intended purpose of the uploaded file. Only accepts fine-tuning (`fine-tune`) for now."""
|
|
11
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
24
12
|
|
|
25
13
|
|
|
26
14
|
class UploadFileOutTypedDict(TypedDict):
|
|
@@ -34,6 +22,7 @@ class UploadFileOutTypedDict(TypedDict):
|
|
|
34
22
|
r"""The UNIX timestamp (in seconds) of the event."""
|
|
35
23
|
filename: str
|
|
36
24
|
r"""The name of the uploaded file."""
|
|
25
|
+
purpose: FilePurpose
|
|
37
26
|
sample_type: SampleType
|
|
38
27
|
source: Source
|
|
39
28
|
num_lines: NotRequired[Nullable[int]]
|
|
@@ -55,14 +44,11 @@ class UploadFileOut(BaseModel):
|
|
|
55
44
|
filename: str
|
|
56
45
|
r"""The name of the uploaded file."""
|
|
57
46
|
|
|
58
|
-
|
|
47
|
+
purpose: Annotated[FilePurpose, PlainValidator(validate_open_enum(False))]
|
|
59
48
|
|
|
60
|
-
|
|
49
|
+
sample_type: Annotated[SampleType, PlainValidator(validate_open_enum(False))]
|
|
61
50
|
|
|
62
|
-
|
|
63
|
-
PURPOSE: Annotated[Final[Annotated[Purpose, PlainValidator(validate_open_enum(False))]], pydantic.Field(alias="purpose")] = "fine-tune" # type: ignore
|
|
64
|
-
# fmt: on
|
|
65
|
-
r"""The intended purpose of the uploaded file. Only accepts fine-tuning (`fine-tune`) for now."""
|
|
51
|
+
source: Annotated[Source, PlainValidator(validate_open_enum(False))]
|
|
66
52
|
|
|
67
53
|
num_lines: OptionalNullable[int] = UNSET
|
|
68
54
|
|
mistralai/models/usageinfo.py
CHANGED
mistralai/models/usermessage.py
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .contentchunk import ContentChunk, ContentChunkTypedDict
|
|
5
|
-
from mistralai.types import BaseModel
|
|
6
|
-
from
|
|
7
|
-
from
|
|
5
|
+
from mistralai.types import BaseModel, Nullable, UNSET_SENTINEL
|
|
6
|
+
from pydantic import model_serializer
|
|
7
|
+
from typing import List, Literal, Optional, Union
|
|
8
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
UserMessageContentTypedDict = Union[str, List[ContentChunkTypedDict]]
|
|
@@ -17,11 +18,41 @@ UserMessageRole = Literal["user"]
|
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
class UserMessageTypedDict(TypedDict):
|
|
20
|
-
content: UserMessageContentTypedDict
|
|
21
|
+
content: Nullable[UserMessageContentTypedDict]
|
|
21
22
|
role: NotRequired[UserMessageRole]
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
class UserMessage(BaseModel):
|
|
25
|
-
content: UserMessageContent
|
|
26
|
+
content: Nullable[UserMessageContent]
|
|
26
27
|
|
|
27
28
|
role: Optional[UserMessageRole] = "user"
|
|
29
|
+
|
|
30
|
+
@model_serializer(mode="wrap")
|
|
31
|
+
def serialize_model(self, handler):
|
|
32
|
+
optional_fields = ["role"]
|
|
33
|
+
nullable_fields = ["content"]
|
|
34
|
+
null_default_fields = []
|
|
35
|
+
|
|
36
|
+
serialized = handler(self)
|
|
37
|
+
|
|
38
|
+
m = {}
|
|
39
|
+
|
|
40
|
+
for n, f in self.model_fields.items():
|
|
41
|
+
k = f.alias or n
|
|
42
|
+
val = serialized.get(k)
|
|
43
|
+
serialized.pop(k, None)
|
|
44
|
+
|
|
45
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
46
|
+
is_set = (
|
|
47
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
48
|
+
or k in null_default_fields
|
|
49
|
+
) # pylint: disable=no-member
|
|
50
|
+
|
|
51
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
52
|
+
m[k] = val
|
|
53
|
+
elif val != UNSET_SENTINEL and (
|
|
54
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
55
|
+
):
|
|
56
|
+
m[k] = val
|
|
57
|
+
|
|
58
|
+
return m
|