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
|
@@ -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 List, Optional,
|
|
7
|
-
from typing_extensions import NotRequired
|
|
6
|
+
from typing import List, Optional, Union
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
FIMCompletionStreamRequestStopTypedDict = Union[str, List[str]]
|
|
@@ -23,14 +23,12 @@ class FIMCompletionStreamRequestTypedDict(TypedDict):
|
|
|
23
23
|
"""
|
|
24
24
|
prompt: str
|
|
25
25
|
r"""The text/code to complete."""
|
|
26
|
-
temperature: NotRequired[float]
|
|
27
|
-
r"""What sampling temperature to use, between 0.0 and
|
|
26
|
+
temperature: NotRequired[Nullable[float]]
|
|
27
|
+
r"""What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value."""
|
|
28
28
|
top_p: NotRequired[float]
|
|
29
29
|
r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both."""
|
|
30
30
|
max_tokens: NotRequired[Nullable[int]]
|
|
31
31
|
r"""The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length."""
|
|
32
|
-
min_tokens: NotRequired[Nullable[int]]
|
|
33
|
-
r"""The minimum number of tokens to generate in the completion."""
|
|
34
32
|
stream: NotRequired[bool]
|
|
35
33
|
stop: NotRequired[FIMCompletionStreamRequestStopTypedDict]
|
|
36
34
|
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
|
|
@@ -38,6 +36,8 @@ class FIMCompletionStreamRequestTypedDict(TypedDict):
|
|
|
38
36
|
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
39
37
|
suffix: NotRequired[Nullable[str]]
|
|
40
38
|
r"""Optional text/code that adds more context for the model. When given a `prompt` and a `suffix` the model will fill what is between them. When `suffix` is not provided, the model will simply execute completion starting with `prompt`."""
|
|
39
|
+
min_tokens: NotRequired[Nullable[int]]
|
|
40
|
+
r"""The minimum number of tokens to generate in the completion."""
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
class FIMCompletionStreamRequest(BaseModel):
|
|
@@ -50,8 +50,8 @@ class FIMCompletionStreamRequest(BaseModel):
|
|
|
50
50
|
prompt: str
|
|
51
51
|
r"""The text/code to complete."""
|
|
52
52
|
|
|
53
|
-
temperature:
|
|
54
|
-
r"""What sampling temperature to use, between 0.0 and
|
|
53
|
+
temperature: OptionalNullable[float] = UNSET
|
|
54
|
+
r"""What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value."""
|
|
55
55
|
|
|
56
56
|
top_p: Optional[float] = 1
|
|
57
57
|
r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both."""
|
|
@@ -59,9 +59,6 @@ class FIMCompletionStreamRequest(BaseModel):
|
|
|
59
59
|
max_tokens: OptionalNullable[int] = UNSET
|
|
60
60
|
r"""The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length."""
|
|
61
61
|
|
|
62
|
-
min_tokens: OptionalNullable[int] = UNSET
|
|
63
|
-
r"""The minimum number of tokens to generate in the completion."""
|
|
64
|
-
|
|
65
62
|
stream: Optional[bool] = True
|
|
66
63
|
|
|
67
64
|
stop: Optional[FIMCompletionStreamRequestStop] = None
|
|
@@ -73,19 +70,29 @@ class FIMCompletionStreamRequest(BaseModel):
|
|
|
73
70
|
suffix: OptionalNullable[str] = UNSET
|
|
74
71
|
r"""Optional text/code that adds more context for the model. When given a `prompt` and a `suffix` the model will fill what is between them. When `suffix` is not provided, the model will simply execute completion starting with `prompt`."""
|
|
75
72
|
|
|
73
|
+
min_tokens: OptionalNullable[int] = UNSET
|
|
74
|
+
r"""The minimum number of tokens to generate in the completion."""
|
|
75
|
+
|
|
76
76
|
@model_serializer(mode="wrap")
|
|
77
77
|
def serialize_model(self, handler):
|
|
78
78
|
optional_fields = [
|
|
79
79
|
"temperature",
|
|
80
80
|
"top_p",
|
|
81
81
|
"max_tokens",
|
|
82
|
-
"min_tokens",
|
|
83
82
|
"stream",
|
|
84
83
|
"stop",
|
|
85
84
|
"random_seed",
|
|
86
85
|
"suffix",
|
|
86
|
+
"min_tokens",
|
|
87
|
+
]
|
|
88
|
+
nullable_fields = [
|
|
89
|
+
"model",
|
|
90
|
+
"temperature",
|
|
91
|
+
"max_tokens",
|
|
92
|
+
"random_seed",
|
|
93
|
+
"suffix",
|
|
94
|
+
"min_tokens",
|
|
87
95
|
]
|
|
88
|
-
nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "suffix"]
|
|
89
96
|
null_default_fields = []
|
|
90
97
|
|
|
91
98
|
serialized = handler(self)
|
|
@@ -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 FTModelCapabilitiesOutTypedDict(TypedDict):
|
mistralai/models/ftmodelcard.py
CHANGED
|
@@ -4,10 +4,15 @@ from __future__ import annotations
|
|
|
4
4
|
from .modelcapabilities import ModelCapabilities, ModelCapabilitiesTypedDict
|
|
5
5
|
from datetime import datetime
|
|
6
6
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
7
|
+
from mistralai.utils import validate_const
|
|
7
8
|
import pydantic
|
|
8
9
|
from pydantic import model_serializer
|
|
9
|
-
from
|
|
10
|
-
from
|
|
10
|
+
from pydantic.functional_validators import AfterValidator
|
|
11
|
+
from typing import List, Literal, Optional
|
|
12
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
FTModelCardType = Literal["fine-tuned"]
|
|
11
16
|
|
|
12
17
|
|
|
13
18
|
class FTModelCardTypedDict(TypedDict):
|
|
@@ -25,6 +30,8 @@ class FTModelCardTypedDict(TypedDict):
|
|
|
25
30
|
max_context_length: NotRequired[int]
|
|
26
31
|
aliases: NotRequired[List[str]]
|
|
27
32
|
deprecation: NotRequired[Nullable[datetime]]
|
|
33
|
+
default_model_temperature: NotRequired[Nullable[float]]
|
|
34
|
+
type: FTModelCardType
|
|
28
35
|
archived: NotRequired[bool]
|
|
29
36
|
|
|
30
37
|
|
|
@@ -55,9 +62,14 @@ class FTModelCard(BaseModel):
|
|
|
55
62
|
|
|
56
63
|
deprecation: OptionalNullable[datetime] = UNSET
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
default_model_temperature: OptionalNullable[float] = UNSET
|
|
66
|
+
|
|
67
|
+
TYPE: Annotated[
|
|
68
|
+
Annotated[
|
|
69
|
+
Optional[FTModelCardType], AfterValidator(validate_const("fine-tuned"))
|
|
70
|
+
],
|
|
71
|
+
pydantic.Field(alias="type"),
|
|
72
|
+
] = "fine-tuned"
|
|
61
73
|
|
|
62
74
|
archived: Optional[bool] = False
|
|
63
75
|
|
|
@@ -72,10 +84,16 @@ class FTModelCard(BaseModel):
|
|
|
72
84
|
"max_context_length",
|
|
73
85
|
"aliases",
|
|
74
86
|
"deprecation",
|
|
87
|
+
"default_model_temperature",
|
|
75
88
|
"type",
|
|
76
89
|
"archived",
|
|
77
90
|
]
|
|
78
|
-
nullable_fields = [
|
|
91
|
+
nullable_fields = [
|
|
92
|
+
"name",
|
|
93
|
+
"description",
|
|
94
|
+
"deprecation",
|
|
95
|
+
"default_model_temperature",
|
|
96
|
+
]
|
|
79
97
|
null_default_fields = []
|
|
80
98
|
|
|
81
99
|
serialized = handler(self)
|
mistralai/models/ftmodelout.py
CHANGED
|
@@ -6,10 +6,12 @@ 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
|
|
9
10
|
import pydantic
|
|
10
11
|
from pydantic import model_serializer
|
|
11
|
-
from
|
|
12
|
-
from
|
|
12
|
+
from pydantic.functional_validators import AfterValidator
|
|
13
|
+
from typing import List, Literal, Optional
|
|
14
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
FTModelOutObject = Literal["model"]
|
|
@@ -23,6 +25,7 @@ class FTModelOutTypedDict(TypedDict):
|
|
|
23
25
|
archived: bool
|
|
24
26
|
capabilities: FTModelCapabilitiesOutTypedDict
|
|
25
27
|
job: str
|
|
28
|
+
object: FTModelOutObject
|
|
26
29
|
name: NotRequired[Nullable[str]]
|
|
27
30
|
description: NotRequired[Nullable[str]]
|
|
28
31
|
max_context_length: NotRequired[int]
|
|
@@ -44,9 +47,10 @@ class FTModelOut(BaseModel):
|
|
|
44
47
|
|
|
45
48
|
job: str
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
OBJECT: Annotated[
|
|
51
|
+
Annotated[Optional[FTModelOutObject], AfterValidator(validate_const("model"))],
|
|
52
|
+
pydantic.Field(alias="object"),
|
|
53
|
+
] = "model"
|
|
50
54
|
|
|
51
55
|
name: OptionalNullable[str] = UNSET
|
|
52
56
|
|
mistralai/models/function.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 Any, Dict, Optional
|
|
6
|
-
from typing_extensions import NotRequired
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
|
+
from typing_extensions import NotRequired, TypedDict
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class FunctionTypedDict(TypedDict):
|
mistralai/models/functioncall.py
CHANGED
mistralai/models/functionname.py
CHANGED
|
@@ -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
|
GithubRepositoryInType = Literal["github"]
|
|
@@ -15,6 +17,7 @@ class GithubRepositoryInTypedDict(TypedDict):
|
|
|
15
17
|
name: str
|
|
16
18
|
owner: str
|
|
17
19
|
token: str
|
|
20
|
+
type: GithubRepositoryInType
|
|
18
21
|
ref: NotRequired[Nullable[str]]
|
|
19
22
|
weight: NotRequired[float]
|
|
20
23
|
|
|
@@ -26,9 +29,12 @@ class GithubRepositoryIn(BaseModel):
|
|
|
26
29
|
|
|
27
30
|
token: str
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
TYPE: Annotated[
|
|
33
|
+
Annotated[
|
|
34
|
+
Optional[GithubRepositoryInType], AfterValidator(validate_const("github"))
|
|
35
|
+
],
|
|
36
|
+
pydantic.Field(alias="type"),
|
|
37
|
+
] = "github"
|
|
32
38
|
|
|
33
39
|
ref: OptionalNullable[str] = UNSET
|
|
34
40
|
|
|
@@ -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
|
GithubRepositoryOutType = Literal["github"]
|
|
@@ -15,6 +17,7 @@ class GithubRepositoryOutTypedDict(TypedDict):
|
|
|
15
17
|
name: str
|
|
16
18
|
owner: str
|
|
17
19
|
commit_id: str
|
|
20
|
+
type: GithubRepositoryOutType
|
|
18
21
|
ref: NotRequired[Nullable[str]]
|
|
19
22
|
weight: NotRequired[float]
|
|
20
23
|
|
|
@@ -26,9 +29,12 @@ class GithubRepositoryOut(BaseModel):
|
|
|
26
29
|
|
|
27
30
|
commit_id: str
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
TYPE: Annotated[
|
|
33
|
+
Annotated[
|
|
34
|
+
Optional[GithubRepositoryOutType], AfterValidator(validate_const("github"))
|
|
35
|
+
],
|
|
36
|
+
pydantic.Field(alias="type"),
|
|
37
|
+
] = "github"
|
|
32
38
|
|
|
33
39
|
ref: OptionalNullable[str] = UNSET
|
|
34
40
|
|
mistralai/models/imageurl.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 ImageURLTypedDict(TypedDict):
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .imageurl import ImageURL, ImageURLTypedDict
|
|
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 Literal, Optional, Union
|
|
10
|
+
from typing_extensions import Annotated, TypedDict
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
ImageURLChunkType = Literal["image_url"]
|
|
@@ -20,6 +22,7 @@ class ImageURLChunkTypedDict(TypedDict):
|
|
|
20
22
|
r"""{\"type\":\"image_url\",\"image_url\":{\"url\":\"data:image/png;base64,iVBORw0"""
|
|
21
23
|
|
|
22
24
|
image_url: ImageURLChunkImageURLTypedDict
|
|
25
|
+
type: ImageURLChunkType
|
|
23
26
|
|
|
24
27
|
|
|
25
28
|
class ImageURLChunk(BaseModel):
|
|
@@ -27,6 +30,9 @@ class ImageURLChunk(BaseModel):
|
|
|
27
30
|
|
|
28
31
|
image_url: ImageURLChunkImageURL
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
TYPE: Annotated[
|
|
34
|
+
Annotated[
|
|
35
|
+
Optional[ImageURLChunkType], AfterValidator(validate_const("image_url"))
|
|
36
|
+
],
|
|
37
|
+
pydantic.Field(alias="type"),
|
|
38
|
+
] = "image_url"
|
mistralai/models/jobin.py
CHANGED
|
@@ -8,8 +8,8 @@ from .trainingparametersin import TrainingParametersIn, TrainingParametersInType
|
|
|
8
8
|
from .wandbintegration import WandbIntegration, WandbIntegrationTypedDict
|
|
9
9
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
10
10
|
from pydantic import model_serializer
|
|
11
|
-
from typing import List, Optional
|
|
12
|
-
from typing_extensions import NotRequired
|
|
11
|
+
from typing import List, Optional
|
|
12
|
+
from typing_extensions import NotRequired, TypedDict
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
JobInIntegrationsTypedDict = WandbIntegrationTypedDict
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
5
5
|
from pydantic import model_serializer
|
|
6
|
-
from
|
|
7
|
-
from typing_extensions import NotRequired
|
|
6
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class JobMetadataOutTypedDict(TypedDict):
|
mistralai/models/jobout.py
CHANGED
|
@@ -7,10 +7,12 @@ from .jobmetadataout import JobMetadataOut, JobMetadataOutTypedDict
|
|
|
7
7
|
from .trainingparameters import TrainingParameters, TrainingParametersTypedDict
|
|
8
8
|
from .wandbintegrationout import WandbIntegrationOut, WandbIntegrationOutTypedDict
|
|
9
9
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
10
|
+
from mistralai.utils import validate_const
|
|
10
11
|
import pydantic
|
|
11
12
|
from pydantic import model_serializer
|
|
12
|
-
from
|
|
13
|
-
from
|
|
13
|
+
from pydantic.functional_validators import AfterValidator
|
|
14
|
+
from typing import List, Literal, Optional
|
|
15
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
14
16
|
|
|
15
17
|
|
|
16
18
|
Status = Literal[
|
|
@@ -61,6 +63,8 @@ class JobOutTypedDict(TypedDict):
|
|
|
61
63
|
r"""A list containing the IDs of uploaded files that contain training data."""
|
|
62
64
|
validation_files: NotRequired[Nullable[List[str]]]
|
|
63
65
|
r"""A list containing the IDs of uploaded files that contain validation data."""
|
|
66
|
+
object: Object
|
|
67
|
+
r"""The object type of the fine-tuning job."""
|
|
64
68
|
fine_tuned_model: NotRequired[Nullable[str]]
|
|
65
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."""
|
|
66
70
|
suffix: NotRequired[Nullable[str]]
|
|
@@ -102,9 +106,10 @@ class JobOut(BaseModel):
|
|
|
102
106
|
validation_files: OptionalNullable[List[str]] = UNSET
|
|
103
107
|
r"""A list containing the IDs of uploaded files that contain validation data."""
|
|
104
108
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
OBJECT: Annotated[
|
|
110
|
+
Annotated[Optional[Object], AfterValidator(validate_const("job"))],
|
|
111
|
+
pydantic.Field(alias="object"),
|
|
112
|
+
] = "job"
|
|
108
113
|
r"""The object type of the fine-tuning job."""
|
|
109
114
|
|
|
110
115
|
fine_tuned_model: OptionalNullable[str] = UNSET
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from mistralai.types import BaseModel
|
|
5
|
+
from mistralai.utils import FieldMetadata, PathParamMetadata
|
|
6
|
+
from typing_extensions import Annotated, TypedDict
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class JobsAPIRoutesBatchCancelBatchJobRequestTypedDict(TypedDict):
|
|
10
|
+
job_id: str
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class JobsAPIRoutesBatchCancelBatchJobRequest(BaseModel):
|
|
14
|
+
job_id: Annotated[
|
|
15
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
16
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from mistralai.types import BaseModel
|
|
5
|
+
from mistralai.utils import FieldMetadata, PathParamMetadata
|
|
6
|
+
from typing_extensions import Annotated, TypedDict
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class JobsAPIRoutesBatchGetBatchJobRequestTypedDict(TypedDict):
|
|
10
|
+
job_id: str
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class JobsAPIRoutesBatchGetBatchJobRequest(BaseModel):
|
|
14
|
+
job_id: Annotated[
|
|
15
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
16
|
+
]
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .batchjobstatus import BatchJobStatus
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
7
|
+
from mistralai.utils import FieldMetadata, QueryParamMetadata
|
|
8
|
+
from pydantic import model_serializer
|
|
9
|
+
from typing import Any, Dict, Optional
|
|
10
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class JobsAPIRoutesBatchGetBatchJobsRequestTypedDict(TypedDict):
|
|
14
|
+
page: NotRequired[int]
|
|
15
|
+
page_size: NotRequired[int]
|
|
16
|
+
model: NotRequired[Nullable[str]]
|
|
17
|
+
metadata: NotRequired[Nullable[Dict[str, Any]]]
|
|
18
|
+
created_after: NotRequired[Nullable[datetime]]
|
|
19
|
+
created_by_me: NotRequired[bool]
|
|
20
|
+
status: NotRequired[Nullable[BatchJobStatus]]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class JobsAPIRoutesBatchGetBatchJobsRequest(BaseModel):
|
|
24
|
+
page: Annotated[
|
|
25
|
+
Optional[int],
|
|
26
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
27
|
+
] = 0
|
|
28
|
+
|
|
29
|
+
page_size: Annotated[
|
|
30
|
+
Optional[int],
|
|
31
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
32
|
+
] = 100
|
|
33
|
+
|
|
34
|
+
model: Annotated[
|
|
35
|
+
OptionalNullable[str],
|
|
36
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
37
|
+
] = UNSET
|
|
38
|
+
|
|
39
|
+
metadata: Annotated[
|
|
40
|
+
OptionalNullable[Dict[str, Any]],
|
|
41
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
42
|
+
] = UNSET
|
|
43
|
+
|
|
44
|
+
created_after: Annotated[
|
|
45
|
+
OptionalNullable[datetime],
|
|
46
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
47
|
+
] = UNSET
|
|
48
|
+
|
|
49
|
+
created_by_me: Annotated[
|
|
50
|
+
Optional[bool],
|
|
51
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
52
|
+
] = False
|
|
53
|
+
|
|
54
|
+
status: Annotated[
|
|
55
|
+
OptionalNullable[BatchJobStatus],
|
|
56
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
57
|
+
] = UNSET
|
|
58
|
+
|
|
59
|
+
@model_serializer(mode="wrap")
|
|
60
|
+
def serialize_model(self, handler):
|
|
61
|
+
optional_fields = [
|
|
62
|
+
"page",
|
|
63
|
+
"page_size",
|
|
64
|
+
"model",
|
|
65
|
+
"metadata",
|
|
66
|
+
"created_after",
|
|
67
|
+
"created_by_me",
|
|
68
|
+
"status",
|
|
69
|
+
]
|
|
70
|
+
nullable_fields = ["model", "metadata", "created_after", "status"]
|
|
71
|
+
null_default_fields = []
|
|
72
|
+
|
|
73
|
+
serialized = handler(self)
|
|
74
|
+
|
|
75
|
+
m = {}
|
|
76
|
+
|
|
77
|
+
for n, f in self.model_fields.items():
|
|
78
|
+
k = f.alias or n
|
|
79
|
+
val = serialized.get(k)
|
|
80
|
+
serialized.pop(k, None)
|
|
81
|
+
|
|
82
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
83
|
+
is_set = (
|
|
84
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
85
|
+
or k in null_default_fields
|
|
86
|
+
) # pylint: disable=no-member
|
|
87
|
+
|
|
88
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
89
|
+
m[k] = val
|
|
90
|
+
elif val != UNSET_SENTINEL and (
|
|
91
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
92
|
+
):
|
|
93
|
+
m[k] = val
|
|
94
|
+
|
|
95
|
+
return m
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
5
|
from mistralai.utils import FieldMetadata, PathParamMetadata
|
|
6
|
-
from
|
|
7
|
-
from typing_extensions import Annotated
|
|
6
|
+
from typing_extensions import Annotated, TypedDict
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class JobsAPIRoutesFineTuningArchiveFineTunedModelRequestTypedDict(TypedDict):
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
5
|
from mistralai.utils import FieldMetadata, PathParamMetadata
|
|
6
|
-
from
|
|
7
|
-
from typing_extensions import Annotated
|
|
6
|
+
from typing_extensions import Annotated, TypedDict
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class JobsAPIRoutesFineTuningCancelFineTuningJobRequestTypedDict(TypedDict):
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
5
|
from mistralai.utils import FieldMetadata, PathParamMetadata
|
|
6
|
-
from
|
|
7
|
-
from typing_extensions import Annotated
|
|
6
|
+
from typing_extensions import Annotated, TypedDict
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class JobsAPIRoutesFineTuningGetFineTuningJobRequestTypedDict(TypedDict):
|
|
@@ -5,8 +5,8 @@ from datetime import datetime
|
|
|
5
5
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
6
6
|
from mistralai.utils import FieldMetadata, QueryParamMetadata
|
|
7
7
|
from pydantic import model_serializer
|
|
8
|
-
from typing import Literal, Optional
|
|
9
|
-
from typing_extensions import Annotated, NotRequired
|
|
8
|
+
from typing import Literal, Optional
|
|
9
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
QueryParamStatus = Literal[
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
5
|
from mistralai.utils import FieldMetadata, PathParamMetadata
|
|
6
|
-
from
|
|
7
|
-
from typing_extensions import Annotated
|
|
6
|
+
from typing_extensions import Annotated, TypedDict
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class JobsAPIRoutesFineTuningStartFineTuningJobRequestTypedDict(TypedDict):
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
5
|
from mistralai.utils import FieldMetadata, PathParamMetadata
|
|
6
|
-
from
|
|
7
|
-
from typing_extensions import Annotated
|
|
6
|
+
from typing_extensions import Annotated, TypedDict
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequestTypedDict(TypedDict):
|
|
@@ -4,8 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
from .updateftmodelin import UpdateFTModelIn, UpdateFTModelInTypedDict
|
|
5
5
|
from mistralai.types import BaseModel
|
|
6
6
|
from mistralai.utils import FieldMetadata, PathParamMetadata, RequestMetadata
|
|
7
|
-
from
|
|
8
|
-
from typing_extensions import Annotated
|
|
7
|
+
from typing_extensions import Annotated, TypedDict
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
class JobsAPIRoutesFineTuningUpdateFineTunedModelRequestTypedDict(TypedDict):
|