mistralai 1.5.2rc1__py3-none-any.whl → 1.7.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/_version.py +2 -2
- mistralai/agents.py +12 -0
- mistralai/chat.py +12 -0
- mistralai/classifiers.py +435 -23
- mistralai/embeddings.py +6 -2
- mistralai/jobs.py +84 -38
- mistralai/mistral_jobs.py +2 -2
- mistralai/models/__init__.py +197 -46
- mistralai/models/agentscompletionrequest.py +4 -0
- mistralai/models/agentscompletionstreamrequest.py +4 -0
- mistralai/models/archiveftmodelout.py +3 -11
- mistralai/models/batchjobout.py +3 -9
- mistralai/models/batchjobsout.py +3 -9
- mistralai/models/chatclassificationrequest.py +20 -0
- mistralai/models/chatcompletionrequest.py +4 -0
- mistralai/models/chatcompletionstreamrequest.py +4 -0
- mistralai/models/chatmoderationrequest.py +4 -7
- mistralai/models/classificationresponse.py +12 -9
- mistralai/models/classificationtargetresult.py +14 -0
- mistralai/models/classifierdetailedjobout.py +156 -0
- mistralai/models/classifierftmodelout.py +101 -0
- mistralai/models/classifierjobout.py +165 -0
- mistralai/models/classifiertargetin.py +55 -0
- mistralai/models/classifiertargetout.py +24 -0
- mistralai/models/classifiertrainingparameters.py +73 -0
- mistralai/models/classifiertrainingparametersin.py +85 -0
- mistralai/models/{detailedjobout.py → completiondetailedjobout.py} +34 -34
- mistralai/models/{ftmodelout.py → completionftmodelout.py} +12 -12
- mistralai/models/{jobout.py → completionjobout.py} +25 -24
- mistralai/models/{trainingparameters.py → completiontrainingparameters.py} +7 -7
- mistralai/models/{trainingparametersin.py → completiontrainingparametersin.py} +7 -7
- mistralai/models/embeddingrequest.py +6 -4
- mistralai/models/finetuneablemodeltype.py +7 -0
- mistralai/models/ftclassifierlossfunction.py +7 -0
- mistralai/models/ftmodelcapabilitiesout.py +3 -0
- mistralai/models/function.py +2 -2
- mistralai/models/githubrepositoryin.py +3 -11
- mistralai/models/githubrepositoryout.py +3 -11
- mistralai/models/inputs.py +54 -0
- mistralai/models/instructrequest.py +42 -0
- mistralai/models/jobin.py +52 -12
- mistralai/models/jobs_api_routes_batch_get_batch_jobsop.py +3 -3
- mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +29 -2
- mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +21 -4
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +29 -2
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +8 -0
- mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +29 -2
- mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +28 -2
- mistralai/models/jobsout.py +24 -13
- mistralai/models/jsonschema.py +1 -1
- mistralai/models/legacyjobmetadataout.py +3 -12
- mistralai/models/{classificationobject.py → moderationobject.py} +6 -6
- mistralai/models/moderationresponse.py +21 -0
- mistralai/models/unarchiveftmodelout.py +3 -11
- mistralai/models/wandbintegration.py +3 -11
- mistralai/models/wandbintegrationout.py +8 -13
- mistralai/models_.py +10 -4
- {mistralai-1.5.2rc1.dist-info → mistralai-1.7.0.dist-info}/METADATA +4 -2
- {mistralai-1.5.2rc1.dist-info → mistralai-1.7.0.dist-info}/RECORD +81 -63
- {mistralai-1.5.2rc1.dist-info → mistralai-1.7.0.dist-info}/WHEEL +1 -1
- mistralai_azure/_version.py +2 -2
- mistralai_azure/chat.py +12 -0
- mistralai_azure/models/__init__.py +15 -0
- mistralai_azure/models/chatcompletionrequest.py +4 -0
- mistralai_azure/models/chatcompletionstreamrequest.py +4 -0
- mistralai_azure/models/contentchunk.py +6 -2
- mistralai_azure/models/function.py +2 -2
- mistralai_azure/models/imageurl.py +53 -0
- mistralai_azure/models/imageurlchunk.py +33 -0
- mistralai_azure/models/jsonschema.py +1 -1
- mistralai_gcp/_version.py +2 -2
- mistralai_gcp/chat.py +12 -0
- mistralai_gcp/models/__init__.py +15 -0
- mistralai_gcp/models/chatcompletionrequest.py +4 -0
- mistralai_gcp/models/chatcompletionstreamrequest.py +4 -0
- mistralai_gcp/models/contentchunk.py +6 -2
- mistralai_gcp/models/function.py +2 -2
- mistralai_gcp/models/imageurl.py +53 -0
- mistralai_gcp/models/imageurlchunk.py +33 -0
- mistralai_gcp/models/jsonschema.py +1 -1
- {mistralai-1.5.2rc1.dist-info → mistralai-1.7.0.dist-info}/LICENSE +0 -0
|
@@ -2,12 +2,9 @@
|
|
|
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
|
|
6
|
-
import pydantic
|
|
7
5
|
from pydantic import model_serializer
|
|
8
|
-
from pydantic.functional_validators import AfterValidator
|
|
9
6
|
from typing import Literal, Optional
|
|
10
|
-
from typing_extensions import
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
11
8
|
|
|
12
9
|
|
|
13
10
|
GithubRepositoryOutType = Literal["github"]
|
|
@@ -17,7 +14,7 @@ class GithubRepositoryOutTypedDict(TypedDict):
|
|
|
17
14
|
name: str
|
|
18
15
|
owner: str
|
|
19
16
|
commit_id: str
|
|
20
|
-
type: GithubRepositoryOutType
|
|
17
|
+
type: NotRequired[GithubRepositoryOutType]
|
|
21
18
|
ref: NotRequired[Nullable[str]]
|
|
22
19
|
weight: NotRequired[float]
|
|
23
20
|
|
|
@@ -29,12 +26,7 @@ class GithubRepositoryOut(BaseModel):
|
|
|
29
26
|
|
|
30
27
|
commit_id: str
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
Annotated[
|
|
34
|
-
Optional[GithubRepositoryOutType], AfterValidator(validate_const("github"))
|
|
35
|
-
],
|
|
36
|
-
pydantic.Field(alias="type"),
|
|
37
|
-
] = "github"
|
|
29
|
+
type: Optional[GithubRepositoryOutType] = "github"
|
|
38
30
|
|
|
39
31
|
ref: OptionalNullable[str] = UNSET
|
|
40
32
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
|
|
5
|
+
from .instructrequest import InstructRequest, InstructRequestTypedDict
|
|
6
|
+
from .systemmessage import SystemMessage, SystemMessageTypedDict
|
|
7
|
+
from .toolmessage import ToolMessage, ToolMessageTypedDict
|
|
8
|
+
from .usermessage import UserMessage, UserMessageTypedDict
|
|
9
|
+
from mistralai.types import BaseModel
|
|
10
|
+
from mistralai.utils import get_discriminator
|
|
11
|
+
from pydantic import Discriminator, Tag
|
|
12
|
+
from typing import List, Union
|
|
13
|
+
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
InstructRequestInputsMessagesTypedDict = TypeAliasType(
|
|
17
|
+
"InstructRequestInputsMessagesTypedDict",
|
|
18
|
+
Union[
|
|
19
|
+
SystemMessageTypedDict,
|
|
20
|
+
UserMessageTypedDict,
|
|
21
|
+
AssistantMessageTypedDict,
|
|
22
|
+
ToolMessageTypedDict,
|
|
23
|
+
],
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
InstructRequestInputsMessages = Annotated[
|
|
28
|
+
Union[
|
|
29
|
+
Annotated[AssistantMessage, Tag("assistant")],
|
|
30
|
+
Annotated[SystemMessage, Tag("system")],
|
|
31
|
+
Annotated[ToolMessage, Tag("tool")],
|
|
32
|
+
Annotated[UserMessage, Tag("user")],
|
|
33
|
+
],
|
|
34
|
+
Discriminator(lambda m: get_discriminator(m, "role", "role")),
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class InstructRequestInputsTypedDict(TypedDict):
|
|
39
|
+
messages: List[InstructRequestInputsMessagesTypedDict]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class InstructRequestInputs(BaseModel):
|
|
43
|
+
messages: List[InstructRequestInputsMessages]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
InputsTypedDict = TypeAliasType(
|
|
47
|
+
"InputsTypedDict",
|
|
48
|
+
Union[InstructRequestInputsTypedDict, List[InstructRequestTypedDict]],
|
|
49
|
+
)
|
|
50
|
+
r"""Chat to classify"""
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
Inputs = TypeAliasType("Inputs", Union[InstructRequestInputs, List[InstructRequest]])
|
|
54
|
+
r"""Chat to classify"""
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
|
|
5
|
+
from .systemmessage import SystemMessage, SystemMessageTypedDict
|
|
6
|
+
from .toolmessage import ToolMessage, ToolMessageTypedDict
|
|
7
|
+
from .usermessage import UserMessage, UserMessageTypedDict
|
|
8
|
+
from mistralai.types import BaseModel
|
|
9
|
+
from mistralai.utils import get_discriminator
|
|
10
|
+
from pydantic import Discriminator, Tag
|
|
11
|
+
from typing import List, Union
|
|
12
|
+
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
InstructRequestMessagesTypedDict = TypeAliasType(
|
|
16
|
+
"InstructRequestMessagesTypedDict",
|
|
17
|
+
Union[
|
|
18
|
+
SystemMessageTypedDict,
|
|
19
|
+
UserMessageTypedDict,
|
|
20
|
+
AssistantMessageTypedDict,
|
|
21
|
+
ToolMessageTypedDict,
|
|
22
|
+
],
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
InstructRequestMessages = Annotated[
|
|
27
|
+
Union[
|
|
28
|
+
Annotated[AssistantMessage, Tag("assistant")],
|
|
29
|
+
Annotated[SystemMessage, Tag("system")],
|
|
30
|
+
Annotated[ToolMessage, Tag("tool")],
|
|
31
|
+
Annotated[UserMessage, Tag("user")],
|
|
32
|
+
],
|
|
33
|
+
Discriminator(lambda m: get_discriminator(m, "role", "role")),
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class InstructRequestTypedDict(TypedDict):
|
|
38
|
+
messages: List[InstructRequestMessagesTypedDict]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class InstructRequest(BaseModel):
|
|
42
|
+
messages: List[InstructRequestMessages]
|
mistralai/models/jobin.py
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .classifiertargetin import ClassifierTargetIn, ClassifierTargetInTypedDict
|
|
5
|
+
from .classifiertrainingparametersin import (
|
|
6
|
+
ClassifierTrainingParametersIn,
|
|
7
|
+
ClassifierTrainingParametersInTypedDict,
|
|
8
|
+
)
|
|
9
|
+
from .completiontrainingparametersin import (
|
|
10
|
+
CompletionTrainingParametersIn,
|
|
11
|
+
CompletionTrainingParametersInTypedDict,
|
|
12
|
+
)
|
|
13
|
+
from .finetuneablemodeltype import FineTuneableModelType
|
|
4
14
|
from .githubrepositoryin import GithubRepositoryIn, GithubRepositoryInTypedDict
|
|
5
15
|
from .trainingfile import TrainingFile, TrainingFileTypedDict
|
|
6
|
-
from .trainingparametersin import TrainingParametersIn, TrainingParametersInTypedDict
|
|
7
16
|
from .wandbintegration import WandbIntegration, WandbIntegrationTypedDict
|
|
8
17
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
9
18
|
from pydantic import model_serializer
|
|
10
|
-
from typing import List, Optional
|
|
11
|
-
from typing_extensions import NotRequired, TypedDict
|
|
19
|
+
from typing import List, Optional, Union
|
|
20
|
+
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
|
12
21
|
|
|
13
22
|
|
|
14
23
|
JobInIntegrationsTypedDict = WandbIntegrationTypedDict
|
|
@@ -17,6 +26,20 @@ JobInIntegrationsTypedDict = WandbIntegrationTypedDict
|
|
|
17
26
|
JobInIntegrations = WandbIntegration
|
|
18
27
|
|
|
19
28
|
|
|
29
|
+
HyperparametersTypedDict = TypeAliasType(
|
|
30
|
+
"HyperparametersTypedDict",
|
|
31
|
+
Union[
|
|
32
|
+
ClassifierTrainingParametersInTypedDict, CompletionTrainingParametersInTypedDict
|
|
33
|
+
],
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
Hyperparameters = TypeAliasType(
|
|
38
|
+
"Hyperparameters",
|
|
39
|
+
Union[ClassifierTrainingParametersIn, CompletionTrainingParametersIn],
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
20
43
|
JobInRepositoriesTypedDict = GithubRepositoryInTypedDict
|
|
21
44
|
|
|
22
45
|
|
|
@@ -26,8 +49,7 @@ JobInRepositories = GithubRepositoryIn
|
|
|
26
49
|
class JobInTypedDict(TypedDict):
|
|
27
50
|
model: str
|
|
28
51
|
r"""The name of the model to fine-tune."""
|
|
29
|
-
hyperparameters:
|
|
30
|
-
r"""The fine-tuning hyperparameter settings used in a fine-tune job."""
|
|
52
|
+
hyperparameters: HyperparametersTypedDict
|
|
31
53
|
training_files: NotRequired[List[TrainingFileTypedDict]]
|
|
32
54
|
validation_files: NotRequired[Nullable[List[str]]]
|
|
33
55
|
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."""
|
|
@@ -35,17 +57,19 @@ class JobInTypedDict(TypedDict):
|
|
|
35
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...`"""
|
|
36
58
|
integrations: NotRequired[Nullable[List[JobInIntegrationsTypedDict]]]
|
|
37
59
|
r"""A list of integrations to enable for your fine-tuning job."""
|
|
38
|
-
repositories: NotRequired[List[JobInRepositoriesTypedDict]]
|
|
39
60
|
auto_start: NotRequired[bool]
|
|
40
61
|
r"""This field will be required in a future release."""
|
|
62
|
+
invalid_sample_skip_percentage: NotRequired[float]
|
|
63
|
+
job_type: NotRequired[Nullable[FineTuneableModelType]]
|
|
64
|
+
repositories: NotRequired[Nullable[List[JobInRepositoriesTypedDict]]]
|
|
65
|
+
classifier_targets: NotRequired[Nullable[List[ClassifierTargetInTypedDict]]]
|
|
41
66
|
|
|
42
67
|
|
|
43
68
|
class JobIn(BaseModel):
|
|
44
69
|
model: str
|
|
45
70
|
r"""The name of the model to fine-tune."""
|
|
46
71
|
|
|
47
|
-
hyperparameters:
|
|
48
|
-
r"""The fine-tuning hyperparameter settings used in a fine-tune job."""
|
|
72
|
+
hyperparameters: Hyperparameters
|
|
49
73
|
|
|
50
74
|
training_files: Optional[List[TrainingFile]] = None
|
|
51
75
|
|
|
@@ -58,11 +82,17 @@ class JobIn(BaseModel):
|
|
|
58
82
|
integrations: OptionalNullable[List[JobInIntegrations]] = UNSET
|
|
59
83
|
r"""A list of integrations to enable for your fine-tuning job."""
|
|
60
84
|
|
|
61
|
-
repositories: Optional[List[JobInRepositories]] = None
|
|
62
|
-
|
|
63
85
|
auto_start: Optional[bool] = None
|
|
64
86
|
r"""This field will be required in a future release."""
|
|
65
87
|
|
|
88
|
+
invalid_sample_skip_percentage: Optional[float] = 0
|
|
89
|
+
|
|
90
|
+
job_type: OptionalNullable[FineTuneableModelType] = UNSET
|
|
91
|
+
|
|
92
|
+
repositories: OptionalNullable[List[JobInRepositories]] = UNSET
|
|
93
|
+
|
|
94
|
+
classifier_targets: OptionalNullable[List[ClassifierTargetIn]] = UNSET
|
|
95
|
+
|
|
66
96
|
@model_serializer(mode="wrap")
|
|
67
97
|
def serialize_model(self, handler):
|
|
68
98
|
optional_fields = [
|
|
@@ -70,10 +100,20 @@ class JobIn(BaseModel):
|
|
|
70
100
|
"validation_files",
|
|
71
101
|
"suffix",
|
|
72
102
|
"integrations",
|
|
73
|
-
"repositories",
|
|
74
103
|
"auto_start",
|
|
104
|
+
"invalid_sample_skip_percentage",
|
|
105
|
+
"job_type",
|
|
106
|
+
"repositories",
|
|
107
|
+
"classifier_targets",
|
|
108
|
+
]
|
|
109
|
+
nullable_fields = [
|
|
110
|
+
"validation_files",
|
|
111
|
+
"suffix",
|
|
112
|
+
"integrations",
|
|
113
|
+
"job_type",
|
|
114
|
+
"repositories",
|
|
115
|
+
"classifier_targets",
|
|
75
116
|
]
|
|
76
|
-
nullable_fields = ["validation_files", "suffix", "integrations"]
|
|
77
117
|
null_default_fields = []
|
|
78
118
|
|
|
79
119
|
serialized = handler(self)
|
|
@@ -6,7 +6,7 @@ from datetime import datetime
|
|
|
6
6
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
7
7
|
from mistralai.utils import FieldMetadata, QueryParamMetadata
|
|
8
8
|
from pydantic import model_serializer
|
|
9
|
-
from typing import Any, Dict, Optional
|
|
9
|
+
from typing import Any, Dict, List, Optional
|
|
10
10
|
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
11
11
|
|
|
12
12
|
|
|
@@ -17,7 +17,7 @@ class JobsAPIRoutesBatchGetBatchJobsRequestTypedDict(TypedDict):
|
|
|
17
17
|
metadata: NotRequired[Nullable[Dict[str, Any]]]
|
|
18
18
|
created_after: NotRequired[Nullable[datetime]]
|
|
19
19
|
created_by_me: NotRequired[bool]
|
|
20
|
-
status: NotRequired[Nullable[BatchJobStatus]]
|
|
20
|
+
status: NotRequired[Nullable[List[BatchJobStatus]]]
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class JobsAPIRoutesBatchGetBatchJobsRequest(BaseModel):
|
|
@@ -52,7 +52,7 @@ class JobsAPIRoutesBatchGetBatchJobsRequest(BaseModel):
|
|
|
52
52
|
] = False
|
|
53
53
|
|
|
54
54
|
status: Annotated[
|
|
55
|
-
OptionalNullable[BatchJobStatus],
|
|
55
|
+
OptionalNullable[List[BatchJobStatus]],
|
|
56
56
|
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
57
57
|
] = UNSET
|
|
58
58
|
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .classifierdetailedjobout import (
|
|
5
|
+
ClassifierDetailedJobOut,
|
|
6
|
+
ClassifierDetailedJobOutTypedDict,
|
|
7
|
+
)
|
|
8
|
+
from .completiondetailedjobout import (
|
|
9
|
+
CompletionDetailedJobOut,
|
|
10
|
+
CompletionDetailedJobOutTypedDict,
|
|
11
|
+
)
|
|
4
12
|
from mistralai.types import BaseModel
|
|
5
|
-
from mistralai.utils import FieldMetadata, PathParamMetadata
|
|
6
|
-
from
|
|
13
|
+
from mistralai.utils import FieldMetadata, PathParamMetadata, get_discriminator
|
|
14
|
+
from pydantic import Discriminator, Tag
|
|
15
|
+
from typing import Union
|
|
16
|
+
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
|
7
17
|
|
|
8
18
|
|
|
9
19
|
class JobsAPIRoutesFineTuningCancelFineTuningJobRequestTypedDict(TypedDict):
|
|
@@ -16,3 +26,20 @@ class JobsAPIRoutesFineTuningCancelFineTuningJobRequest(BaseModel):
|
|
|
16
26
|
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
17
27
|
]
|
|
18
28
|
r"""The ID of the job to cancel."""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
JobsAPIRoutesFineTuningCancelFineTuningJobResponseTypedDict = TypeAliasType(
|
|
32
|
+
"JobsAPIRoutesFineTuningCancelFineTuningJobResponseTypedDict",
|
|
33
|
+
Union[CompletionDetailedJobOutTypedDict, ClassifierDetailedJobOutTypedDict],
|
|
34
|
+
)
|
|
35
|
+
r"""OK"""
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
JobsAPIRoutesFineTuningCancelFineTuningJobResponse = Annotated[
|
|
39
|
+
Union[
|
|
40
|
+
Annotated[ClassifierDetailedJobOut, Tag("classifier")],
|
|
41
|
+
Annotated[CompletionDetailedJobOut, Tag("completion")],
|
|
42
|
+
],
|
|
43
|
+
Discriminator(lambda m: get_discriminator(m, "job_type", "job_type")),
|
|
44
|
+
]
|
|
45
|
+
r"""OK"""
|
|
@@ -1,21 +1,38 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from .
|
|
4
|
+
from .classifierjobout import ClassifierJobOut, ClassifierJobOutTypedDict
|
|
5
|
+
from .completionjobout import CompletionJobOut, CompletionJobOutTypedDict
|
|
5
6
|
from .legacyjobmetadataout import LegacyJobMetadataOut, LegacyJobMetadataOutTypedDict
|
|
7
|
+
from mistralai.utils import get_discriminator
|
|
8
|
+
from pydantic import Discriminator, Tag
|
|
6
9
|
from typing import Union
|
|
7
|
-
from typing_extensions import TypeAliasType
|
|
10
|
+
from typing_extensions import Annotated, TypeAliasType
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Response1TypedDict = TypeAliasType(
|
|
14
|
+
"Response1TypedDict", Union[ClassifierJobOutTypedDict, CompletionJobOutTypedDict]
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
Response1 = Annotated[
|
|
19
|
+
Union[
|
|
20
|
+
Annotated[ClassifierJobOut, Tag("classifier")],
|
|
21
|
+
Annotated[CompletionJobOut, Tag("completion")],
|
|
22
|
+
],
|
|
23
|
+
Discriminator(lambda m: get_discriminator(m, "job_type", "job_type")),
|
|
24
|
+
]
|
|
8
25
|
|
|
9
26
|
|
|
10
27
|
JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict = TypeAliasType(
|
|
11
28
|
"JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict",
|
|
12
|
-
Union[LegacyJobMetadataOutTypedDict,
|
|
29
|
+
Union[LegacyJobMetadataOutTypedDict, Response1TypedDict],
|
|
13
30
|
)
|
|
14
31
|
r"""OK"""
|
|
15
32
|
|
|
16
33
|
|
|
17
34
|
JobsAPIRoutesFineTuningCreateFineTuningJobResponse = TypeAliasType(
|
|
18
35
|
"JobsAPIRoutesFineTuningCreateFineTuningJobResponse",
|
|
19
|
-
Union[LegacyJobMetadataOut,
|
|
36
|
+
Union[LegacyJobMetadataOut, Response1],
|
|
20
37
|
)
|
|
21
38
|
r"""OK"""
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .classifierdetailedjobout import (
|
|
5
|
+
ClassifierDetailedJobOut,
|
|
6
|
+
ClassifierDetailedJobOutTypedDict,
|
|
7
|
+
)
|
|
8
|
+
from .completiondetailedjobout import (
|
|
9
|
+
CompletionDetailedJobOut,
|
|
10
|
+
CompletionDetailedJobOutTypedDict,
|
|
11
|
+
)
|
|
4
12
|
from mistralai.types import BaseModel
|
|
5
|
-
from mistralai.utils import FieldMetadata, PathParamMetadata
|
|
6
|
-
from
|
|
13
|
+
from mistralai.utils import FieldMetadata, PathParamMetadata, get_discriminator
|
|
14
|
+
from pydantic import Discriminator, Tag
|
|
15
|
+
from typing import Union
|
|
16
|
+
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
|
7
17
|
|
|
8
18
|
|
|
9
19
|
class JobsAPIRoutesFineTuningGetFineTuningJobRequestTypedDict(TypedDict):
|
|
@@ -16,3 +26,20 @@ class JobsAPIRoutesFineTuningGetFineTuningJobRequest(BaseModel):
|
|
|
16
26
|
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
17
27
|
]
|
|
18
28
|
r"""The ID of the job to analyse."""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
JobsAPIRoutesFineTuningGetFineTuningJobResponseTypedDict = TypeAliasType(
|
|
32
|
+
"JobsAPIRoutesFineTuningGetFineTuningJobResponseTypedDict",
|
|
33
|
+
Union[CompletionDetailedJobOutTypedDict, ClassifierDetailedJobOutTypedDict],
|
|
34
|
+
)
|
|
35
|
+
r"""OK"""
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
JobsAPIRoutesFineTuningGetFineTuningJobResponse = Annotated[
|
|
39
|
+
Union[
|
|
40
|
+
Annotated[ClassifierDetailedJobOut, Tag("classifier")],
|
|
41
|
+
Annotated[CompletionDetailedJobOut, Tag("completion")],
|
|
42
|
+
],
|
|
43
|
+
Discriminator(lambda m: get_discriminator(m, "job_type", "job_type")),
|
|
44
|
+
]
|
|
45
|
+
r"""OK"""
|
|
@@ -33,6 +33,7 @@ class JobsAPIRoutesFineTuningGetFineTuningJobsRequestTypedDict(TypedDict):
|
|
|
33
33
|
r"""The model name used for fine-tuning to filter on. When set, the other results are not displayed."""
|
|
34
34
|
created_after: NotRequired[Nullable[datetime]]
|
|
35
35
|
r"""The date/time to filter on. When set, the results for previous creation times are not displayed."""
|
|
36
|
+
created_before: NotRequired[Nullable[datetime]]
|
|
36
37
|
created_by_me: NotRequired[bool]
|
|
37
38
|
r"""When set, only return results for jobs created by the API caller. Other results are not displayed."""
|
|
38
39
|
status: NotRequired[Nullable[QueryParamStatus]]
|
|
@@ -70,6 +71,11 @@ class JobsAPIRoutesFineTuningGetFineTuningJobsRequest(BaseModel):
|
|
|
70
71
|
] = UNSET
|
|
71
72
|
r"""The date/time to filter on. When set, the results for previous creation times are not displayed."""
|
|
72
73
|
|
|
74
|
+
created_before: Annotated[
|
|
75
|
+
OptionalNullable[datetime],
|
|
76
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
77
|
+
] = UNSET
|
|
78
|
+
|
|
73
79
|
created_by_me: Annotated[
|
|
74
80
|
Optional[bool],
|
|
75
81
|
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
@@ -107,6 +113,7 @@ class JobsAPIRoutesFineTuningGetFineTuningJobsRequest(BaseModel):
|
|
|
107
113
|
"page_size",
|
|
108
114
|
"model",
|
|
109
115
|
"created_after",
|
|
116
|
+
"created_before",
|
|
110
117
|
"created_by_me",
|
|
111
118
|
"status",
|
|
112
119
|
"wandb_project",
|
|
@@ -116,6 +123,7 @@ class JobsAPIRoutesFineTuningGetFineTuningJobsRequest(BaseModel):
|
|
|
116
123
|
nullable_fields = [
|
|
117
124
|
"model",
|
|
118
125
|
"created_after",
|
|
126
|
+
"created_before",
|
|
119
127
|
"status",
|
|
120
128
|
"wandb_project",
|
|
121
129
|
"wandb_name",
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .classifierdetailedjobout import (
|
|
5
|
+
ClassifierDetailedJobOut,
|
|
6
|
+
ClassifierDetailedJobOutTypedDict,
|
|
7
|
+
)
|
|
8
|
+
from .completiondetailedjobout import (
|
|
9
|
+
CompletionDetailedJobOut,
|
|
10
|
+
CompletionDetailedJobOutTypedDict,
|
|
11
|
+
)
|
|
4
12
|
from mistralai.types import BaseModel
|
|
5
|
-
from mistralai.utils import FieldMetadata, PathParamMetadata
|
|
6
|
-
from
|
|
13
|
+
from mistralai.utils import FieldMetadata, PathParamMetadata, get_discriminator
|
|
14
|
+
from pydantic import Discriminator, Tag
|
|
15
|
+
from typing import Union
|
|
16
|
+
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
|
7
17
|
|
|
8
18
|
|
|
9
19
|
class JobsAPIRoutesFineTuningStartFineTuningJobRequestTypedDict(TypedDict):
|
|
@@ -14,3 +24,20 @@ class JobsAPIRoutesFineTuningStartFineTuningJobRequest(BaseModel):
|
|
|
14
24
|
job_id: Annotated[
|
|
15
25
|
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
16
26
|
]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
JobsAPIRoutesFineTuningStartFineTuningJobResponseTypedDict = TypeAliasType(
|
|
30
|
+
"JobsAPIRoutesFineTuningStartFineTuningJobResponseTypedDict",
|
|
31
|
+
Union[CompletionDetailedJobOutTypedDict, ClassifierDetailedJobOutTypedDict],
|
|
32
|
+
)
|
|
33
|
+
r"""OK"""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
JobsAPIRoutesFineTuningStartFineTuningJobResponse = Annotated[
|
|
37
|
+
Union[
|
|
38
|
+
Annotated[ClassifierDetailedJobOut, Tag("classifier")],
|
|
39
|
+
Annotated[CompletionDetailedJobOut, Tag("completion")],
|
|
40
|
+
],
|
|
41
|
+
Discriminator(lambda m: get_discriminator(m, "job_type", "job_type")),
|
|
42
|
+
]
|
|
43
|
+
r"""OK"""
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .classifierftmodelout import ClassifierFTModelOut, ClassifierFTModelOutTypedDict
|
|
5
|
+
from .completionftmodelout import CompletionFTModelOut, CompletionFTModelOutTypedDict
|
|
4
6
|
from .updateftmodelin import UpdateFTModelIn, UpdateFTModelInTypedDict
|
|
5
7
|
from mistralai.types import BaseModel
|
|
6
|
-
from mistralai.utils import
|
|
7
|
-
|
|
8
|
+
from mistralai.utils import (
|
|
9
|
+
FieldMetadata,
|
|
10
|
+
PathParamMetadata,
|
|
11
|
+
RequestMetadata,
|
|
12
|
+
get_discriminator,
|
|
13
|
+
)
|
|
14
|
+
from pydantic import Discriminator, Tag
|
|
15
|
+
from typing import Union
|
|
16
|
+
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
|
8
17
|
|
|
9
18
|
|
|
10
19
|
class JobsAPIRoutesFineTuningUpdateFineTunedModelRequestTypedDict(TypedDict):
|
|
@@ -23,3 +32,20 @@ class JobsAPIRoutesFineTuningUpdateFineTunedModelRequest(BaseModel):
|
|
|
23
32
|
UpdateFTModelIn,
|
|
24
33
|
FieldMetadata(request=RequestMetadata(media_type="application/json")),
|
|
25
34
|
]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
JobsAPIRoutesFineTuningUpdateFineTunedModelResponseTypedDict = TypeAliasType(
|
|
38
|
+
"JobsAPIRoutesFineTuningUpdateFineTunedModelResponseTypedDict",
|
|
39
|
+
Union[CompletionFTModelOutTypedDict, ClassifierFTModelOutTypedDict],
|
|
40
|
+
)
|
|
41
|
+
r"""OK"""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
JobsAPIRoutesFineTuningUpdateFineTunedModelResponse = Annotated[
|
|
45
|
+
Union[
|
|
46
|
+
Annotated[ClassifierFTModelOut, Tag("classifier")],
|
|
47
|
+
Annotated[CompletionFTModelOut, Tag("completion")],
|
|
48
|
+
],
|
|
49
|
+
Discriminator(lambda m: get_discriminator(m, "model_type", "model_type")),
|
|
50
|
+
]
|
|
51
|
+
r"""OK"""
|
mistralai/models/jobsout.py
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from .
|
|
4
|
+
from .classifierjobout import ClassifierJobOut, ClassifierJobOutTypedDict
|
|
5
|
+
from .completionjobout import CompletionJobOut, CompletionJobOutTypedDict
|
|
5
6
|
from mistralai.types import BaseModel
|
|
6
|
-
from mistralai.utils import
|
|
7
|
-
import
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
|
|
7
|
+
from mistralai.utils import get_discriminator
|
|
8
|
+
from pydantic import Discriminator, Tag
|
|
9
|
+
from typing import List, Literal, Optional, Union
|
|
10
|
+
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
JobsOutDataTypedDict = TypeAliasType(
|
|
14
|
+
"JobsOutDataTypedDict", Union[ClassifierJobOutTypedDict, CompletionJobOutTypedDict]
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
JobsOutData = Annotated[
|
|
19
|
+
Union[
|
|
20
|
+
Annotated[ClassifierJobOut, Tag("classifier")],
|
|
21
|
+
Annotated[CompletionJobOut, Tag("completion")],
|
|
22
|
+
],
|
|
23
|
+
Discriminator(lambda m: get_discriminator(m, "job_type", "job_type")),
|
|
24
|
+
]
|
|
11
25
|
|
|
12
26
|
|
|
13
27
|
JobsOutObject = Literal["list"]
|
|
@@ -15,16 +29,13 @@ JobsOutObject = Literal["list"]
|
|
|
15
29
|
|
|
16
30
|
class JobsOutTypedDict(TypedDict):
|
|
17
31
|
total: int
|
|
18
|
-
data: NotRequired[List[
|
|
19
|
-
object: JobsOutObject
|
|
32
|
+
data: NotRequired[List[JobsOutDataTypedDict]]
|
|
33
|
+
object: NotRequired[JobsOutObject]
|
|
20
34
|
|
|
21
35
|
|
|
22
36
|
class JobsOut(BaseModel):
|
|
23
37
|
total: int
|
|
24
38
|
|
|
25
|
-
data: Optional[List[
|
|
39
|
+
data: Optional[List[JobsOutData]] = None
|
|
26
40
|
|
|
27
|
-
|
|
28
|
-
Annotated[Optional[JobsOutObject], AfterValidator(validate_const("list"))],
|
|
29
|
-
pydantic.Field(alias="object"),
|
|
30
|
-
] = "list"
|
|
41
|
+
object: Optional[JobsOutObject] = "list"
|
mistralai/models/jsonschema.py
CHANGED
|
@@ -2,12 +2,9 @@
|
|
|
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
|
|
6
|
-
import pydantic
|
|
7
5
|
from pydantic import model_serializer
|
|
8
|
-
from pydantic.functional_validators import AfterValidator
|
|
9
6
|
from typing import Literal, Optional
|
|
10
|
-
from typing_extensions import
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
11
8
|
|
|
12
9
|
|
|
13
10
|
LegacyJobMetadataOutObject = Literal["job.metadata"]
|
|
@@ -33,7 +30,7 @@ class LegacyJobMetadataOutTypedDict(TypedDict):
|
|
|
33
30
|
r"""The number of complete passes through the entire training dataset."""
|
|
34
31
|
training_steps: NotRequired[Nullable[int]]
|
|
35
32
|
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
|
|
33
|
+
object: NotRequired[LegacyJobMetadataOutObject]
|
|
37
34
|
|
|
38
35
|
|
|
39
36
|
class LegacyJobMetadataOut(BaseModel):
|
|
@@ -67,13 +64,7 @@ class LegacyJobMetadataOut(BaseModel):
|
|
|
67
64
|
training_steps: OptionalNullable[int] = UNSET
|
|
68
65
|
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."""
|
|
69
66
|
|
|
70
|
-
|
|
71
|
-
Annotated[
|
|
72
|
-
Optional[LegacyJobMetadataOutObject],
|
|
73
|
-
AfterValidator(validate_const("job.metadata")),
|
|
74
|
-
],
|
|
75
|
-
pydantic.Field(alias="object"),
|
|
76
|
-
] = "job.metadata"
|
|
67
|
+
object: Optional[LegacyJobMetadataOutObject] = "job.metadata"
|
|
77
68
|
|
|
78
69
|
@model_serializer(mode="wrap")
|
|
79
70
|
def serialize_model(self, handler):
|
|
@@ -6,16 +6,16 @@ from typing import Dict, Optional
|
|
|
6
6
|
from typing_extensions import NotRequired, TypedDict
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class ModerationObjectTypedDict(TypedDict):
|
|
10
10
|
categories: NotRequired[Dict[str, bool]]
|
|
11
|
-
r"""
|
|
11
|
+
r"""Moderation result thresholds"""
|
|
12
12
|
category_scores: NotRequired[Dict[str, float]]
|
|
13
|
-
r"""
|
|
13
|
+
r"""Moderation result"""
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
class
|
|
16
|
+
class ModerationObject(BaseModel):
|
|
17
17
|
categories: Optional[Dict[str, bool]] = None
|
|
18
|
-
r"""
|
|
18
|
+
r"""Moderation result thresholds"""
|
|
19
19
|
|
|
20
20
|
category_scores: Optional[Dict[str, float]] = None
|
|
21
|
-
r"""
|
|
21
|
+
r"""Moderation result"""
|