mistralai 1.6.0__py3-none-any.whl → 1.7.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/_version.py +3 -3
- mistralai/classifiers.py +431 -19
- mistralai/embeddings.py +6 -2
- mistralai/extra/utils/_pydantic_helper.py +2 -1
- mistralai/jobs.py +84 -38
- mistralai/mistral_jobs.py +2 -2
- mistralai/models/__init__.py +197 -46
- 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/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/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/legacyjobmetadataout.py +3 -12
- mistralai/models/{classificationobject.py → moderationobject.py} +6 -6
- mistralai/models/moderationresponse.py +21 -0
- mistralai/models/ocrimageobject.py +7 -1
- mistralai/models/ocrrequest.py +15 -0
- mistralai/models/ocrresponse.py +38 -2
- mistralai/models/unarchiveftmodelout.py +3 -11
- mistralai/models/wandbintegration.py +3 -11
- mistralai/models/wandbintegrationout.py +8 -13
- mistralai/models_.py +10 -4
- mistralai/ocr.py +28 -0
- {mistralai-1.6.0.dist-info → mistralai-1.7.1.dist-info}/METADATA +3 -1
- {mistralai-1.6.0.dist-info → mistralai-1.7.1.dist-info}/RECORD +58 -44
- {mistralai-1.6.0.dist-info → mistralai-1.7.1.dist-info}/WHEEL +1 -1
- {mistralai-1.6.0.dist-info → mistralai-1.7.1.dist-info}/LICENSE +0 -0
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .checkpointout import CheckpointOut, CheckpointOutTypedDict
|
|
5
|
+
from .completiontrainingparameters import (
|
|
6
|
+
CompletionTrainingParameters,
|
|
7
|
+
CompletionTrainingParametersTypedDict,
|
|
8
|
+
)
|
|
5
9
|
from .eventout import EventOut, EventOutTypedDict
|
|
6
10
|
from .githubrepositoryout import GithubRepositoryOut, GithubRepositoryOutTypedDict
|
|
7
11
|
from .jobmetadataout import JobMetadataOut, JobMetadataOutTypedDict
|
|
8
|
-
from .trainingparameters import TrainingParameters, TrainingParametersTypedDict
|
|
9
12
|
from .wandbintegrationout import WandbIntegrationOut, WandbIntegrationOutTypedDict
|
|
10
13
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
11
|
-
from mistralai.utils import validate_const
|
|
12
|
-
import pydantic
|
|
13
14
|
from pydantic import model_serializer
|
|
14
|
-
from pydantic.functional_validators import AfterValidator
|
|
15
15
|
from typing import List, Literal, Optional
|
|
16
|
-
from typing_extensions import
|
|
16
|
+
from typing_extensions import NotRequired, TypedDict
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
CompletionDetailedJobOutStatus = Literal[
|
|
20
20
|
"QUEUED",
|
|
21
21
|
"STARTED",
|
|
22
22
|
"VALIDATING",
|
|
@@ -29,57 +29,57 @@ DetailedJobOutStatus = Literal[
|
|
|
29
29
|
"CANCELLATION_REQUESTED",
|
|
30
30
|
]
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
CompletionDetailedJobOutObject = Literal["job"]
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
CompletionDetailedJobOutIntegrationsTypedDict = WandbIntegrationOutTypedDict
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
CompletionDetailedJobOutIntegrations = WandbIntegrationOut
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
CompletionDetailedJobOutJobType = Literal["completion"]
|
|
41
41
|
|
|
42
|
+
CompletionDetailedJobOutRepositoriesTypedDict = GithubRepositoryOutTypedDict
|
|
42
43
|
|
|
43
|
-
DetailedJobOutRepositories = GithubRepositoryOut
|
|
44
44
|
|
|
45
|
+
CompletionDetailedJobOutRepositories = GithubRepositoryOut
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
|
|
48
|
+
class CompletionDetailedJobOutTypedDict(TypedDict):
|
|
47
49
|
id: str
|
|
48
50
|
auto_start: bool
|
|
49
|
-
hyperparameters: TrainingParametersTypedDict
|
|
50
51
|
model: str
|
|
51
52
|
r"""The name of the model to fine-tune."""
|
|
52
|
-
status:
|
|
53
|
-
job_type: str
|
|
53
|
+
status: CompletionDetailedJobOutStatus
|
|
54
54
|
created_at: int
|
|
55
55
|
modified_at: int
|
|
56
56
|
training_files: List[str]
|
|
57
|
+
hyperparameters: CompletionTrainingParametersTypedDict
|
|
57
58
|
validation_files: NotRequired[Nullable[List[str]]]
|
|
58
|
-
object:
|
|
59
|
+
object: NotRequired[CompletionDetailedJobOutObject]
|
|
59
60
|
fine_tuned_model: NotRequired[Nullable[str]]
|
|
60
61
|
suffix: NotRequired[Nullable[str]]
|
|
61
|
-
integrations: NotRequired[
|
|
62
|
+
integrations: NotRequired[
|
|
63
|
+
Nullable[List[CompletionDetailedJobOutIntegrationsTypedDict]]
|
|
64
|
+
]
|
|
62
65
|
trained_tokens: NotRequired[Nullable[int]]
|
|
63
|
-
repositories: NotRequired[List[DetailedJobOutRepositoriesTypedDict]]
|
|
64
66
|
metadata: NotRequired[Nullable[JobMetadataOutTypedDict]]
|
|
67
|
+
job_type: NotRequired[CompletionDetailedJobOutJobType]
|
|
68
|
+
repositories: NotRequired[List[CompletionDetailedJobOutRepositoriesTypedDict]]
|
|
65
69
|
events: NotRequired[List[EventOutTypedDict]]
|
|
66
70
|
r"""Event items are created every time the status of a fine-tuning job changes. The timestamped list of all events is accessible here."""
|
|
67
71
|
checkpoints: NotRequired[List[CheckpointOutTypedDict]]
|
|
68
72
|
|
|
69
73
|
|
|
70
|
-
class
|
|
74
|
+
class CompletionDetailedJobOut(BaseModel):
|
|
71
75
|
id: str
|
|
72
76
|
|
|
73
77
|
auto_start: bool
|
|
74
78
|
|
|
75
|
-
hyperparameters: TrainingParameters
|
|
76
|
-
|
|
77
79
|
model: str
|
|
78
80
|
r"""The name of the model to fine-tune."""
|
|
79
81
|
|
|
80
|
-
status:
|
|
81
|
-
|
|
82
|
-
job_type: str
|
|
82
|
+
status: CompletionDetailedJobOutStatus
|
|
83
83
|
|
|
84
84
|
created_at: int
|
|
85
85
|
|
|
@@ -87,27 +87,26 @@ class DetailedJobOut(BaseModel):
|
|
|
87
87
|
|
|
88
88
|
training_files: List[str]
|
|
89
89
|
|
|
90
|
+
hyperparameters: CompletionTrainingParameters
|
|
91
|
+
|
|
90
92
|
validation_files: OptionalNullable[List[str]] = UNSET
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
Annotated[
|
|
94
|
-
Optional[DetailedJobOutObject], AfterValidator(validate_const("job"))
|
|
95
|
-
],
|
|
96
|
-
pydantic.Field(alias="object"),
|
|
97
|
-
] = "job"
|
|
94
|
+
object: Optional[CompletionDetailedJobOutObject] = "job"
|
|
98
95
|
|
|
99
96
|
fine_tuned_model: OptionalNullable[str] = UNSET
|
|
100
97
|
|
|
101
98
|
suffix: OptionalNullable[str] = UNSET
|
|
102
99
|
|
|
103
|
-
integrations: OptionalNullable[List[
|
|
100
|
+
integrations: OptionalNullable[List[CompletionDetailedJobOutIntegrations]] = UNSET
|
|
104
101
|
|
|
105
102
|
trained_tokens: OptionalNullable[int] = UNSET
|
|
106
103
|
|
|
107
|
-
repositories: Optional[List[DetailedJobOutRepositories]] = None
|
|
108
|
-
|
|
109
104
|
metadata: OptionalNullable[JobMetadataOut] = UNSET
|
|
110
105
|
|
|
106
|
+
job_type: Optional[CompletionDetailedJobOutJobType] = "completion"
|
|
107
|
+
|
|
108
|
+
repositories: Optional[List[CompletionDetailedJobOutRepositories]] = None
|
|
109
|
+
|
|
111
110
|
events: Optional[List[EventOut]] = None
|
|
112
111
|
r"""Event items are created every time the status of a fine-tuning job changes. The timestamped list of all events is accessible here."""
|
|
113
112
|
|
|
@@ -122,8 +121,9 @@ class DetailedJobOut(BaseModel):
|
|
|
122
121
|
"suffix",
|
|
123
122
|
"integrations",
|
|
124
123
|
"trained_tokens",
|
|
125
|
-
"repositories",
|
|
126
124
|
"metadata",
|
|
125
|
+
"job_type",
|
|
126
|
+
"repositories",
|
|
127
127
|
"events",
|
|
128
128
|
"checkpoints",
|
|
129
129
|
]
|
|
@@ -6,18 +6,17 @@ from .ftmodelcapabilitiesout import (
|
|
|
6
6
|
FTModelCapabilitiesOutTypedDict,
|
|
7
7
|
)
|
|
8
8
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
9
|
-
from mistralai.utils import validate_const
|
|
10
|
-
import pydantic
|
|
11
9
|
from pydantic import model_serializer
|
|
12
|
-
from pydantic.functional_validators import AfterValidator
|
|
13
10
|
from typing import List, Literal, Optional
|
|
14
|
-
from typing_extensions import
|
|
11
|
+
from typing_extensions import NotRequired, TypedDict
|
|
15
12
|
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
CompletionFTModelOutObject = Literal["model"]
|
|
18
15
|
|
|
16
|
+
ModelType = Literal["completion"]
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
|
|
19
|
+
class CompletionFTModelOutTypedDict(TypedDict):
|
|
21
20
|
id: str
|
|
22
21
|
created: int
|
|
23
22
|
owned_by: str
|
|
@@ -25,14 +24,15 @@ class FTModelOutTypedDict(TypedDict):
|
|
|
25
24
|
archived: bool
|
|
26
25
|
capabilities: FTModelCapabilitiesOutTypedDict
|
|
27
26
|
job: str
|
|
28
|
-
object:
|
|
27
|
+
object: NotRequired[CompletionFTModelOutObject]
|
|
29
28
|
name: NotRequired[Nullable[str]]
|
|
30
29
|
description: NotRequired[Nullable[str]]
|
|
31
30
|
max_context_length: NotRequired[int]
|
|
32
31
|
aliases: NotRequired[List[str]]
|
|
32
|
+
model_type: NotRequired[ModelType]
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
class
|
|
35
|
+
class CompletionFTModelOut(BaseModel):
|
|
36
36
|
id: str
|
|
37
37
|
|
|
38
38
|
created: int
|
|
@@ -47,10 +47,7 @@ class FTModelOut(BaseModel):
|
|
|
47
47
|
|
|
48
48
|
job: str
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
Annotated[Optional[FTModelOutObject], AfterValidator(validate_const("model"))],
|
|
52
|
-
pydantic.Field(alias="object"),
|
|
53
|
-
] = "model"
|
|
50
|
+
object: Optional[CompletionFTModelOutObject] = "model"
|
|
54
51
|
|
|
55
52
|
name: OptionalNullable[str] = UNSET
|
|
56
53
|
|
|
@@ -60,6 +57,8 @@ class FTModelOut(BaseModel):
|
|
|
60
57
|
|
|
61
58
|
aliases: Optional[List[str]] = None
|
|
62
59
|
|
|
60
|
+
model_type: Optional[ModelType] = "completion"
|
|
61
|
+
|
|
63
62
|
@model_serializer(mode="wrap")
|
|
64
63
|
def serialize_model(self, handler):
|
|
65
64
|
optional_fields = [
|
|
@@ -68,6 +67,7 @@ class FTModelOut(BaseModel):
|
|
|
68
67
|
"description",
|
|
69
68
|
"max_context_length",
|
|
70
69
|
"aliases",
|
|
70
|
+
"model_type",
|
|
71
71
|
]
|
|
72
72
|
nullable_fields = ["name", "description"]
|
|
73
73
|
null_default_fields = []
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .completiontrainingparameters import (
|
|
5
|
+
CompletionTrainingParameters,
|
|
6
|
+
CompletionTrainingParametersTypedDict,
|
|
7
|
+
)
|
|
4
8
|
from .githubrepositoryout import GithubRepositoryOut, GithubRepositoryOutTypedDict
|
|
5
9
|
from .jobmetadataout import JobMetadataOut, JobMetadataOutTypedDict
|
|
6
|
-
from .trainingparameters import TrainingParameters, TrainingParametersTypedDict
|
|
7
10
|
from .wandbintegrationout import WandbIntegrationOut, WandbIntegrationOutTypedDict
|
|
8
11
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
9
|
-
from mistralai.utils import validate_const
|
|
10
|
-
import pydantic
|
|
11
12
|
from pydantic import model_serializer
|
|
12
|
-
from pydantic.functional_validators import AfterValidator
|
|
13
13
|
from typing import List, Literal, Optional
|
|
14
|
-
from typing_extensions import
|
|
14
|
+
from typing_extensions import NotRequired, TypedDict
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
Status = Literal[
|
|
@@ -37,32 +37,33 @@ IntegrationsTypedDict = WandbIntegrationOutTypedDict
|
|
|
37
37
|
Integrations = WandbIntegrationOut
|
|
38
38
|
|
|
39
39
|
|
|
40
|
+
JobType = Literal["completion"]
|
|
41
|
+
r"""The type of job (`FT` for fine-tuning)."""
|
|
42
|
+
|
|
40
43
|
RepositoriesTypedDict = GithubRepositoryOutTypedDict
|
|
41
44
|
|
|
42
45
|
|
|
43
46
|
Repositories = GithubRepositoryOut
|
|
44
47
|
|
|
45
48
|
|
|
46
|
-
class
|
|
49
|
+
class CompletionJobOutTypedDict(TypedDict):
|
|
47
50
|
id: str
|
|
48
51
|
r"""The ID of the job."""
|
|
49
52
|
auto_start: bool
|
|
50
|
-
hyperparameters: TrainingParametersTypedDict
|
|
51
53
|
model: str
|
|
52
54
|
r"""The name of the model to fine-tune."""
|
|
53
55
|
status: Status
|
|
54
56
|
r"""The current status of the fine-tuning job."""
|
|
55
|
-
job_type: str
|
|
56
|
-
r"""The type of job (`FT` for fine-tuning)."""
|
|
57
57
|
created_at: int
|
|
58
58
|
r"""The UNIX timestamp (in seconds) for when the fine-tuning job was created."""
|
|
59
59
|
modified_at: int
|
|
60
60
|
r"""The UNIX timestamp (in seconds) for when the fine-tuning job was last modified."""
|
|
61
61
|
training_files: List[str]
|
|
62
62
|
r"""A list containing the IDs of uploaded files that contain training data."""
|
|
63
|
+
hyperparameters: CompletionTrainingParametersTypedDict
|
|
63
64
|
validation_files: NotRequired[Nullable[List[str]]]
|
|
64
65
|
r"""A list containing the IDs of uploaded files that contain validation data."""
|
|
65
|
-
object: Object
|
|
66
|
+
object: NotRequired[Object]
|
|
66
67
|
r"""The object type of the fine-tuning job."""
|
|
67
68
|
fine_tuned_model: NotRequired[Nullable[str]]
|
|
68
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."""
|
|
@@ -72,27 +73,24 @@ class JobOutTypedDict(TypedDict):
|
|
|
72
73
|
r"""A list of integrations enabled for your fine-tuning job."""
|
|
73
74
|
trained_tokens: NotRequired[Nullable[int]]
|
|
74
75
|
r"""Total number of tokens trained."""
|
|
75
|
-
repositories: NotRequired[List[RepositoriesTypedDict]]
|
|
76
76
|
metadata: NotRequired[Nullable[JobMetadataOutTypedDict]]
|
|
77
|
+
job_type: NotRequired[JobType]
|
|
78
|
+
r"""The type of job (`FT` for fine-tuning)."""
|
|
79
|
+
repositories: NotRequired[List[RepositoriesTypedDict]]
|
|
77
80
|
|
|
78
81
|
|
|
79
|
-
class
|
|
82
|
+
class CompletionJobOut(BaseModel):
|
|
80
83
|
id: str
|
|
81
84
|
r"""The ID of the job."""
|
|
82
85
|
|
|
83
86
|
auto_start: bool
|
|
84
87
|
|
|
85
|
-
hyperparameters: TrainingParameters
|
|
86
|
-
|
|
87
88
|
model: str
|
|
88
89
|
r"""The name of the model to fine-tune."""
|
|
89
90
|
|
|
90
91
|
status: Status
|
|
91
92
|
r"""The current status of the fine-tuning job."""
|
|
92
93
|
|
|
93
|
-
job_type: str
|
|
94
|
-
r"""The type of job (`FT` for fine-tuning)."""
|
|
95
|
-
|
|
96
94
|
created_at: int
|
|
97
95
|
r"""The UNIX timestamp (in seconds) for when the fine-tuning job was created."""
|
|
98
96
|
|
|
@@ -102,13 +100,12 @@ class JobOut(BaseModel):
|
|
|
102
100
|
training_files: List[str]
|
|
103
101
|
r"""A list containing the IDs of uploaded files that contain training data."""
|
|
104
102
|
|
|
103
|
+
hyperparameters: CompletionTrainingParameters
|
|
104
|
+
|
|
105
105
|
validation_files: OptionalNullable[List[str]] = UNSET
|
|
106
106
|
r"""A list containing the IDs of uploaded files that contain validation data."""
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
Annotated[Optional[Object], AfterValidator(validate_const("job"))],
|
|
110
|
-
pydantic.Field(alias="object"),
|
|
111
|
-
] = "job"
|
|
108
|
+
object: Optional[Object] = "job"
|
|
112
109
|
r"""The object type of the fine-tuning job."""
|
|
113
110
|
|
|
114
111
|
fine_tuned_model: OptionalNullable[str] = UNSET
|
|
@@ -123,10 +120,13 @@ class JobOut(BaseModel):
|
|
|
123
120
|
trained_tokens: OptionalNullable[int] = UNSET
|
|
124
121
|
r"""Total number of tokens trained."""
|
|
125
122
|
|
|
126
|
-
repositories: Optional[List[Repositories]] = None
|
|
127
|
-
|
|
128
123
|
metadata: OptionalNullable[JobMetadataOut] = UNSET
|
|
129
124
|
|
|
125
|
+
job_type: Optional[JobType] = "completion"
|
|
126
|
+
r"""The type of job (`FT` for fine-tuning)."""
|
|
127
|
+
|
|
128
|
+
repositories: Optional[List[Repositories]] = None
|
|
129
|
+
|
|
130
130
|
@model_serializer(mode="wrap")
|
|
131
131
|
def serialize_model(self, handler):
|
|
132
132
|
optional_fields = [
|
|
@@ -136,8 +136,9 @@ class JobOut(BaseModel):
|
|
|
136
136
|
"suffix",
|
|
137
137
|
"integrations",
|
|
138
138
|
"trained_tokens",
|
|
139
|
-
"repositories",
|
|
140
139
|
"metadata",
|
|
140
|
+
"job_type",
|
|
141
|
+
"repositories",
|
|
141
142
|
]
|
|
142
143
|
nullable_fields = [
|
|
143
144
|
"validation_files",
|
|
@@ -7,17 +7,17 @@ from typing import Optional
|
|
|
7
7
|
from typing_extensions import NotRequired, TypedDict
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class
|
|
10
|
+
class CompletionTrainingParametersTypedDict(TypedDict):
|
|
11
11
|
training_steps: NotRequired[Nullable[int]]
|
|
12
12
|
learning_rate: NotRequired[float]
|
|
13
13
|
weight_decay: NotRequired[Nullable[float]]
|
|
14
14
|
warmup_fraction: NotRequired[Nullable[float]]
|
|
15
15
|
epochs: NotRequired[Nullable[float]]
|
|
16
|
-
fim_ratio: NotRequired[Nullable[float]]
|
|
17
16
|
seq_len: NotRequired[Nullable[int]]
|
|
17
|
+
fim_ratio: NotRequired[Nullable[float]]
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
class
|
|
20
|
+
class CompletionTrainingParameters(BaseModel):
|
|
21
21
|
training_steps: OptionalNullable[int] = UNSET
|
|
22
22
|
|
|
23
23
|
learning_rate: Optional[float] = 0.0001
|
|
@@ -28,10 +28,10 @@ class TrainingParameters(BaseModel):
|
|
|
28
28
|
|
|
29
29
|
epochs: OptionalNullable[float] = UNSET
|
|
30
30
|
|
|
31
|
-
fim_ratio: OptionalNullable[float] = UNSET
|
|
32
|
-
|
|
33
31
|
seq_len: OptionalNullable[int] = UNSET
|
|
34
32
|
|
|
33
|
+
fim_ratio: OptionalNullable[float] = UNSET
|
|
34
|
+
|
|
35
35
|
@model_serializer(mode="wrap")
|
|
36
36
|
def serialize_model(self, handler):
|
|
37
37
|
optional_fields = [
|
|
@@ -40,16 +40,16 @@ class TrainingParameters(BaseModel):
|
|
|
40
40
|
"weight_decay",
|
|
41
41
|
"warmup_fraction",
|
|
42
42
|
"epochs",
|
|
43
|
-
"fim_ratio",
|
|
44
43
|
"seq_len",
|
|
44
|
+
"fim_ratio",
|
|
45
45
|
]
|
|
46
46
|
nullable_fields = [
|
|
47
47
|
"training_steps",
|
|
48
48
|
"weight_decay",
|
|
49
49
|
"warmup_fraction",
|
|
50
50
|
"epochs",
|
|
51
|
-
"fim_ratio",
|
|
52
51
|
"seq_len",
|
|
52
|
+
"fim_ratio",
|
|
53
53
|
]
|
|
54
54
|
null_default_fields = []
|
|
55
55
|
|
|
@@ -7,7 +7,7 @@ from typing import Optional
|
|
|
7
7
|
from typing_extensions import NotRequired, TypedDict
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class
|
|
10
|
+
class CompletionTrainingParametersInTypedDict(TypedDict):
|
|
11
11
|
r"""The fine-tuning hyperparameter settings used in a fine-tune job."""
|
|
12
12
|
|
|
13
13
|
training_steps: NotRequired[Nullable[int]]
|
|
@@ -19,11 +19,11 @@ class TrainingParametersInTypedDict(TypedDict):
|
|
|
19
19
|
warmup_fraction: NotRequired[Nullable[float]]
|
|
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
|
-
fim_ratio: NotRequired[Nullable[float]]
|
|
23
22
|
seq_len: NotRequired[Nullable[int]]
|
|
23
|
+
fim_ratio: NotRequired[Nullable[float]]
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
class
|
|
26
|
+
class CompletionTrainingParametersIn(BaseModel):
|
|
27
27
|
r"""The fine-tuning hyperparameter settings used in a fine-tune job."""
|
|
28
28
|
|
|
29
29
|
training_steps: OptionalNullable[int] = UNSET
|
|
@@ -40,10 +40,10 @@ class TrainingParametersIn(BaseModel):
|
|
|
40
40
|
|
|
41
41
|
epochs: OptionalNullable[float] = UNSET
|
|
42
42
|
|
|
43
|
-
fim_ratio: OptionalNullable[float] = UNSET
|
|
44
|
-
|
|
45
43
|
seq_len: OptionalNullable[int] = UNSET
|
|
46
44
|
|
|
45
|
+
fim_ratio: OptionalNullable[float] = UNSET
|
|
46
|
+
|
|
47
47
|
@model_serializer(mode="wrap")
|
|
48
48
|
def serialize_model(self, handler):
|
|
49
49
|
optional_fields = [
|
|
@@ -52,16 +52,16 @@ class TrainingParametersIn(BaseModel):
|
|
|
52
52
|
"weight_decay",
|
|
53
53
|
"warmup_fraction",
|
|
54
54
|
"epochs",
|
|
55
|
-
"fim_ratio",
|
|
56
55
|
"seq_len",
|
|
56
|
+
"fim_ratio",
|
|
57
57
|
]
|
|
58
58
|
nullable_fields = [
|
|
59
59
|
"training_steps",
|
|
60
60
|
"weight_decay",
|
|
61
61
|
"warmup_fraction",
|
|
62
62
|
"epochs",
|
|
63
|
-
"fim_ratio",
|
|
64
63
|
"seq_len",
|
|
64
|
+
"fim_ratio",
|
|
65
65
|
]
|
|
66
66
|
null_default_fields = []
|
|
67
67
|
|
|
@@ -7,18 +7,20 @@ from typing import List, Union
|
|
|
7
7
|
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
EmbeddingRequestInputsTypedDict = TypeAliasType(
|
|
11
|
+
"EmbeddingRequestInputsTypedDict", Union[str, List[str]]
|
|
12
|
+
)
|
|
11
13
|
r"""Text to embed."""
|
|
12
14
|
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
EmbeddingRequestInputs = TypeAliasType("EmbeddingRequestInputs", Union[str, List[str]])
|
|
15
17
|
r"""Text to embed."""
|
|
16
18
|
|
|
17
19
|
|
|
18
20
|
class EmbeddingRequestTypedDict(TypedDict):
|
|
19
21
|
model: str
|
|
20
22
|
r"""ID of the model to use."""
|
|
21
|
-
inputs:
|
|
23
|
+
inputs: EmbeddingRequestInputsTypedDict
|
|
22
24
|
r"""Text to embed."""
|
|
23
25
|
|
|
24
26
|
|
|
@@ -26,5 +28,5 @@ class EmbeddingRequest(BaseModel):
|
|
|
26
28
|
model: str
|
|
27
29
|
r"""ID of the model to use."""
|
|
28
30
|
|
|
29
|
-
inputs: Annotated[
|
|
31
|
+
inputs: Annotated[EmbeddingRequestInputs, pydantic.Field(alias="input")]
|
|
30
32
|
r"""Text to embed."""
|
|
@@ -11,6 +11,7 @@ class FTModelCapabilitiesOutTypedDict(TypedDict):
|
|
|
11
11
|
completion_fim: NotRequired[bool]
|
|
12
12
|
function_calling: NotRequired[bool]
|
|
13
13
|
fine_tuning: NotRequired[bool]
|
|
14
|
+
classification: NotRequired[bool]
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
class FTModelCapabilitiesOut(BaseModel):
|
|
@@ -21,3 +22,5 @@ class FTModelCapabilitiesOut(BaseModel):
|
|
|
21
22
|
function_calling: Optional[bool] = False
|
|
22
23
|
|
|
23
24
|
fine_tuning: Optional[bool] = False
|
|
25
|
+
|
|
26
|
+
classification: Optional[bool] = False
|
|
@@ -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
|
GithubRepositoryInType = Literal["github"]
|
|
@@ -17,7 +14,7 @@ class GithubRepositoryInTypedDict(TypedDict):
|
|
|
17
14
|
name: str
|
|
18
15
|
owner: str
|
|
19
16
|
token: str
|
|
20
|
-
type: GithubRepositoryInType
|
|
17
|
+
type: NotRequired[GithubRepositoryInType]
|
|
21
18
|
ref: NotRequired[Nullable[str]]
|
|
22
19
|
weight: NotRequired[float]
|
|
23
20
|
|
|
@@ -29,12 +26,7 @@ class GithubRepositoryIn(BaseModel):
|
|
|
29
26
|
|
|
30
27
|
token: str
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
Annotated[
|
|
34
|
-
Optional[GithubRepositoryInType], AfterValidator(validate_const("github"))
|
|
35
|
-
],
|
|
36
|
-
pydantic.Field(alias="type"),
|
|
37
|
-
] = "github"
|
|
29
|
+
type: Optional[GithubRepositoryInType] = "github"
|
|
38
30
|
|
|
39
31
|
ref: OptionalNullable[str] = UNSET
|
|
40
32
|
|
|
@@ -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"""
|