mistralai 0.5.5a50__py3-none-any.whl → 1.0.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/agents.py +434 -0
- mistralai/basesdk.py +43 -6
- mistralai/chat.py +29 -34
- mistralai/client.py +1 -1
- mistralai/embeddings.py +4 -4
- mistralai/files.py +10 -10
- mistralai/fim.py +17 -18
- mistralai/fine_tuning.py +10 -849
- mistralai/jobs.py +844 -0
- mistralai/models/__init__.py +6 -4
- mistralai/models/agentscompletionrequest.py +96 -0
- mistralai/models/agentscompletionstreamrequest.py +92 -0
- mistralai/models/assistantmessage.py +4 -9
- mistralai/models/chatcompletionchoice.py +4 -15
- mistralai/models/chatcompletionrequest.py +11 -16
- mistralai/models/chatcompletionstreamrequest.py +11 -16
- mistralai/models/completionresponsestreamchoice.py +4 -9
- mistralai/models/delete_model_v1_models_model_id_deleteop.py +2 -0
- mistralai/models/deltamessage.py +4 -9
- mistralai/models/detailedjobout.py +4 -9
- mistralai/models/embeddingrequest.py +4 -9
- mistralai/models/eventout.py +4 -9
- mistralai/models/fileschema.py +4 -9
- mistralai/models/fimcompletionrequest.py +11 -16
- mistralai/models/fimcompletionstreamrequest.py +11 -16
- mistralai/models/ftmodelout.py +4 -9
- mistralai/models/functioncall.py +9 -3
- mistralai/models/githubrepositoryin.py +4 -9
- mistralai/models/githubrepositoryout.py +4 -9
- mistralai/models/httpvalidationerror.py +1 -1
- mistralai/models/jobin.py +4 -9
- mistralai/models/jobmetadataout.py +4 -9
- mistralai/models/jobout.py +4 -9
- mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +2 -0
- mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +1 -59
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +4 -9
- mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +2 -0
- mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +2 -0
- mistralai/models/legacyjobmetadataout.py +4 -9
- mistralai/models/metricout.py +4 -9
- mistralai/models/modelcard.py +4 -9
- mistralai/models/retrieve_model_v1_models_model_id_getop.py +2 -0
- mistralai/models/retrievefileout.py +4 -9
- mistralai/models/security.py +4 -4
- mistralai/models/toolmessage.py +4 -9
- mistralai/models/trainingparameters.py +4 -9
- mistralai/models/trainingparametersin.py +4 -9
- mistralai/models/updateftmodelin.py +4 -9
- mistralai/models/uploadfileout.py +4 -9
- mistralai/models/wandbintegration.py +4 -9
- mistralai/models/wandbintegrationout.py +4 -9
- mistralai/models_.py +24 -24
- mistralai/sdk.py +14 -6
- mistralai/sdkconfiguration.py +5 -4
- mistralai/types/basemodel.py +10 -6
- mistralai/utils/__init__.py +4 -0
- mistralai/utils/eventstreaming.py +8 -9
- mistralai/utils/logger.py +16 -0
- mistralai/utils/retries.py +2 -2
- mistralai/utils/security.py +5 -2
- {mistralai-0.5.5a50.dist-info → mistralai-1.0.0.dist-info}/METADATA +136 -67
- {mistralai-0.5.5a50.dist-info → mistralai-1.0.0.dist-info}/RECORD +105 -98
- mistralai_azure/basesdk.py +42 -4
- mistralai_azure/chat.py +15 -20
- mistralai_azure/models/__init__.py +3 -3
- mistralai_azure/models/assistantmessage.py +4 -9
- mistralai_azure/models/chatcompletionchoice.py +4 -15
- mistralai_azure/models/chatcompletionrequest.py +7 -12
- mistralai_azure/models/chatcompletionstreamrequest.py +7 -12
- mistralai_azure/models/completionresponsestreamchoice.py +4 -9
- mistralai_azure/models/deltamessage.py +4 -9
- mistralai_azure/models/functioncall.py +9 -3
- mistralai_azure/models/httpvalidationerror.py +1 -1
- mistralai_azure/models/toolmessage.py +4 -9
- mistralai_azure/sdk.py +7 -2
- mistralai_azure/sdkconfiguration.py +5 -4
- mistralai_azure/types/basemodel.py +10 -6
- mistralai_azure/utils/__init__.py +4 -0
- mistralai_azure/utils/eventstreaming.py +8 -9
- mistralai_azure/utils/logger.py +16 -0
- mistralai_azure/utils/retries.py +2 -2
- mistralai_gcp/basesdk.py +42 -4
- mistralai_gcp/chat.py +12 -17
- mistralai_gcp/fim.py +12 -13
- mistralai_gcp/models/__init__.py +3 -3
- mistralai_gcp/models/assistantmessage.py +4 -9
- mistralai_gcp/models/chatcompletionchoice.py +4 -15
- mistralai_gcp/models/chatcompletionrequest.py +9 -14
- mistralai_gcp/models/chatcompletionstreamrequest.py +9 -14
- mistralai_gcp/models/completionresponsestreamchoice.py +4 -9
- mistralai_gcp/models/deltamessage.py +4 -9
- mistralai_gcp/models/fimcompletionrequest.py +11 -16
- mistralai_gcp/models/fimcompletionstreamrequest.py +11 -16
- mistralai_gcp/models/functioncall.py +9 -3
- mistralai_gcp/models/httpvalidationerror.py +1 -1
- mistralai_gcp/models/toolmessage.py +4 -9
- mistralai_gcp/sdk.py +9 -0
- mistralai_gcp/sdkconfiguration.py +5 -4
- mistralai_gcp/types/basemodel.py +10 -6
- mistralai_gcp/utils/__init__.py +4 -0
- mistralai_gcp/utils/eventstreaming.py +8 -9
- mistralai_gcp/utils/logger.py +16 -0
- mistralai_gcp/utils/retries.py +2 -2
- {mistralai-0.5.5a50.dist-info → mistralai-1.0.0.dist-info}/LICENSE +0 -0
- {mistralai-0.5.5a50.dist-info → mistralai-1.0.0.dist-info}/WHEEL +0 -0
|
@@ -8,13 +8,13 @@ from typing_extensions import NotRequired
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class FIMCompletionRequestTypedDict(TypedDict):
|
|
11
|
-
|
|
12
|
-
r"""The text/code to complete."""
|
|
13
|
-
model: NotRequired[Nullable[str]]
|
|
11
|
+
model: Nullable[str]
|
|
14
12
|
r"""ID of the model to use. Only compatible for now with:
|
|
15
13
|
- `codestral-2405`
|
|
16
14
|
- `codestral-latest`
|
|
17
15
|
"""
|
|
16
|
+
prompt: str
|
|
17
|
+
r"""The text/code to complete."""
|
|
18
18
|
temperature: NotRequired[float]
|
|
19
19
|
r"""What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 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."""
|
|
20
20
|
top_p: NotRequired[float]
|
|
@@ -34,13 +34,13 @@ class FIMCompletionRequestTypedDict(TypedDict):
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
class FIMCompletionRequest(BaseModel):
|
|
37
|
-
|
|
38
|
-
r"""The text/code to complete."""
|
|
39
|
-
model: OptionalNullable[str] = UNSET
|
|
37
|
+
model: Nullable[str]
|
|
40
38
|
r"""ID of the model to use. Only compatible for now with:
|
|
41
39
|
- `codestral-2405`
|
|
42
40
|
- `codestral-latest`
|
|
43
41
|
"""
|
|
42
|
+
prompt: str
|
|
43
|
+
r"""The text/code to complete."""
|
|
44
44
|
temperature: Optional[float] = 0.7
|
|
45
45
|
r"""What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 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."""
|
|
46
46
|
top_p: Optional[float] = 1
|
|
@@ -60,7 +60,7 @@ class FIMCompletionRequest(BaseModel):
|
|
|
60
60
|
|
|
61
61
|
@model_serializer(mode="wrap")
|
|
62
62
|
def serialize_model(self, handler):
|
|
63
|
-
optional_fields = ["
|
|
63
|
+
optional_fields = ["temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "suffix"]
|
|
64
64
|
nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "suffix"]
|
|
65
65
|
null_default_fields = []
|
|
66
66
|
|
|
@@ -72,18 +72,13 @@ class FIMCompletionRequest(BaseModel):
|
|
|
72
72
|
k = f.alias or n
|
|
73
73
|
val = serialized.get(k)
|
|
74
74
|
|
|
75
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
76
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
77
|
+
|
|
75
78
|
if val is not None and val != UNSET_SENTINEL:
|
|
76
79
|
m[k] = val
|
|
77
80
|
elif val != UNSET_SENTINEL and (
|
|
78
|
-
not k in optional_fields
|
|
79
|
-
or (
|
|
80
|
-
k in optional_fields
|
|
81
|
-
and k in nullable_fields
|
|
82
|
-
and (
|
|
83
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
84
|
-
or k in null_default_fields
|
|
85
|
-
) # pylint: disable=no-member
|
|
86
|
-
)
|
|
81
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
87
82
|
):
|
|
88
83
|
m[k] = val
|
|
89
84
|
|
|
@@ -8,13 +8,13 @@ from typing_extensions import NotRequired
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class FIMCompletionStreamRequestTypedDict(TypedDict):
|
|
11
|
-
|
|
12
|
-
r"""The text/code to complete."""
|
|
13
|
-
model: NotRequired[Nullable[str]]
|
|
11
|
+
model: Nullable[str]
|
|
14
12
|
r"""ID of the model to use. Only compatible for now with:
|
|
15
13
|
- `codestral-2405`
|
|
16
14
|
- `codestral-latest`
|
|
17
15
|
"""
|
|
16
|
+
prompt: str
|
|
17
|
+
r"""The text/code to complete."""
|
|
18
18
|
temperature: NotRequired[float]
|
|
19
19
|
r"""What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 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."""
|
|
20
20
|
top_p: NotRequired[float]
|
|
@@ -33,13 +33,13 @@ class FIMCompletionStreamRequestTypedDict(TypedDict):
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
class FIMCompletionStreamRequest(BaseModel):
|
|
36
|
-
|
|
37
|
-
r"""The text/code to complete."""
|
|
38
|
-
model: OptionalNullable[str] = UNSET
|
|
36
|
+
model: Nullable[str]
|
|
39
37
|
r"""ID of the model to use. Only compatible for now with:
|
|
40
38
|
- `codestral-2405`
|
|
41
39
|
- `codestral-latest`
|
|
42
40
|
"""
|
|
41
|
+
prompt: str
|
|
42
|
+
r"""The text/code to complete."""
|
|
43
43
|
temperature: Optional[float] = 0.7
|
|
44
44
|
r"""What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 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."""
|
|
45
45
|
top_p: Optional[float] = 1
|
|
@@ -58,7 +58,7 @@ class FIMCompletionStreamRequest(BaseModel):
|
|
|
58
58
|
|
|
59
59
|
@model_serializer(mode="wrap")
|
|
60
60
|
def serialize_model(self, handler):
|
|
61
|
-
optional_fields = ["
|
|
61
|
+
optional_fields = ["temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "suffix"]
|
|
62
62
|
nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "suffix"]
|
|
63
63
|
null_default_fields = []
|
|
64
64
|
|
|
@@ -70,18 +70,13 @@ class FIMCompletionStreamRequest(BaseModel):
|
|
|
70
70
|
k = f.alias or n
|
|
71
71
|
val = serialized.get(k)
|
|
72
72
|
|
|
73
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
74
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
75
|
+
|
|
73
76
|
if val is not None and val != UNSET_SENTINEL:
|
|
74
77
|
m[k] = val
|
|
75
78
|
elif val != UNSET_SENTINEL and (
|
|
76
|
-
not k in optional_fields
|
|
77
|
-
or (
|
|
78
|
-
k in optional_fields
|
|
79
|
-
and k in nullable_fields
|
|
80
|
-
and (
|
|
81
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
82
|
-
or k in null_default_fields
|
|
83
|
-
) # pylint: disable=no-member
|
|
84
|
-
)
|
|
79
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
85
80
|
):
|
|
86
81
|
m[k] = val
|
|
87
82
|
|
mistralai/models/ftmodelout.py
CHANGED
|
@@ -51,18 +51,13 @@ class FTModelOut(BaseModel):
|
|
|
51
51
|
k = f.alias or n
|
|
52
52
|
val = serialized.get(k)
|
|
53
53
|
|
|
54
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
55
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
56
|
+
|
|
54
57
|
if val is not None and val != UNSET_SENTINEL:
|
|
55
58
|
m[k] = val
|
|
56
59
|
elif val != UNSET_SENTINEL and (
|
|
57
|
-
not k in optional_fields
|
|
58
|
-
or (
|
|
59
|
-
k in optional_fields
|
|
60
|
-
and k in nullable_fields
|
|
61
|
-
and (
|
|
62
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
63
|
-
or k in null_default_fields
|
|
64
|
-
) # pylint: disable=no-member
|
|
65
|
-
)
|
|
60
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
66
61
|
):
|
|
67
62
|
m[k] = val
|
|
68
63
|
|
mistralai/models/functioncall.py
CHANGED
|
@@ -2,15 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
|
-
from typing import TypedDict
|
|
5
|
+
from typing import Any, Dict, TypedDict, Union
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class FunctionCallTypedDict(TypedDict):
|
|
9
9
|
name: str
|
|
10
|
-
arguments:
|
|
10
|
+
arguments: ArgumentsTypedDict
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class FunctionCall(BaseModel):
|
|
14
14
|
name: str
|
|
15
|
-
arguments:
|
|
15
|
+
arguments: Arguments
|
|
16
16
|
|
|
17
|
+
|
|
18
|
+
ArgumentsTypedDict = Union[Dict[str, Any], str]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Arguments = Union[Dict[str, Any], str]
|
|
22
|
+
|
|
@@ -38,18 +38,13 @@ class GithubRepositoryIn(BaseModel):
|
|
|
38
38
|
k = f.alias or n
|
|
39
39
|
val = serialized.get(k)
|
|
40
40
|
|
|
41
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
42
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
43
|
+
|
|
41
44
|
if val is not None and val != UNSET_SENTINEL:
|
|
42
45
|
m[k] = val
|
|
43
46
|
elif val != UNSET_SENTINEL and (
|
|
44
|
-
not k in optional_fields
|
|
45
|
-
or (
|
|
46
|
-
k in optional_fields
|
|
47
|
-
and k in nullable_fields
|
|
48
|
-
and (
|
|
49
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
50
|
-
or k in null_default_fields
|
|
51
|
-
) # pylint: disable=no-member
|
|
52
|
-
)
|
|
47
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
53
48
|
):
|
|
54
49
|
m[k] = val
|
|
55
50
|
|
|
@@ -38,18 +38,13 @@ class GithubRepositoryOut(BaseModel):
|
|
|
38
38
|
k = f.alias or n
|
|
39
39
|
val = serialized.get(k)
|
|
40
40
|
|
|
41
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
42
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
43
|
+
|
|
41
44
|
if val is not None and val != UNSET_SENTINEL:
|
|
42
45
|
m[k] = val
|
|
43
46
|
elif val != UNSET_SENTINEL and (
|
|
44
|
-
not k in optional_fields
|
|
45
|
-
or (
|
|
46
|
-
k in optional_fields
|
|
47
|
-
and k in nullable_fields
|
|
48
|
-
and (
|
|
49
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
50
|
-
or k in null_default_fields
|
|
51
|
-
) # pylint: disable=no-member
|
|
52
|
-
)
|
|
47
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
53
48
|
):
|
|
54
49
|
m[k] = val
|
|
55
50
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .validationerror import ValidationError
|
|
5
|
+
from mistralai import utils
|
|
5
6
|
from mistralai.types import BaseModel
|
|
6
|
-
import mistralai.utils as utils
|
|
7
7
|
from typing import List, Optional
|
|
8
8
|
|
|
9
9
|
class HTTPValidationErrorData(BaseModel):
|
mistralai/models/jobin.py
CHANGED
|
@@ -59,18 +59,13 @@ class JobIn(BaseModel):
|
|
|
59
59
|
k = f.alias or n
|
|
60
60
|
val = serialized.get(k)
|
|
61
61
|
|
|
62
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
63
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
64
|
+
|
|
62
65
|
if val is not None and val != UNSET_SENTINEL:
|
|
63
66
|
m[k] = val
|
|
64
67
|
elif val != UNSET_SENTINEL and (
|
|
65
|
-
not k in optional_fields
|
|
66
|
-
or (
|
|
67
|
-
k in optional_fields
|
|
68
|
-
and k in nullable_fields
|
|
69
|
-
and (
|
|
70
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
71
|
-
or k in null_default_fields
|
|
72
|
-
) # pylint: disable=no-member
|
|
73
|
-
)
|
|
68
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
74
69
|
):
|
|
75
70
|
m[k] = val
|
|
76
71
|
|
|
@@ -40,18 +40,13 @@ class JobMetadataOut(BaseModel):
|
|
|
40
40
|
k = f.alias or n
|
|
41
41
|
val = serialized.get(k)
|
|
42
42
|
|
|
43
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
44
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
45
|
+
|
|
43
46
|
if val is not None and val != UNSET_SENTINEL:
|
|
44
47
|
m[k] = val
|
|
45
48
|
elif val != UNSET_SENTINEL and (
|
|
46
|
-
not k in optional_fields
|
|
47
|
-
or (
|
|
48
|
-
k in optional_fields
|
|
49
|
-
and k in nullable_fields
|
|
50
|
-
and (
|
|
51
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
52
|
-
or k in null_default_fields
|
|
53
|
-
) # pylint: disable=no-member
|
|
54
|
-
)
|
|
49
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
55
50
|
):
|
|
56
51
|
m[k] = val
|
|
57
52
|
|
mistralai/models/jobout.py
CHANGED
|
@@ -93,18 +93,13 @@ class JobOut(BaseModel):
|
|
|
93
93
|
k = f.alias or n
|
|
94
94
|
val = serialized.get(k)
|
|
95
95
|
|
|
96
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
97
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
98
|
+
|
|
96
99
|
if val is not None and val != UNSET_SENTINEL:
|
|
97
100
|
m[k] = val
|
|
98
101
|
elif val != UNSET_SENTINEL and (
|
|
99
|
-
not k in optional_fields
|
|
100
|
-
or (
|
|
101
|
-
k in optional_fields
|
|
102
|
-
and k in nullable_fields
|
|
103
|
-
and (
|
|
104
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
105
|
-
or k in null_default_fields
|
|
106
|
-
) # pylint: disable=no-member
|
|
107
|
-
)
|
|
102
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
108
103
|
):
|
|
109
104
|
m[k] = val
|
|
110
105
|
|
|
@@ -9,8 +9,10 @@ from typing_extensions import Annotated
|
|
|
9
9
|
|
|
10
10
|
class JobsAPIRoutesFineTuningArchiveFineTunedModelRequestTypedDict(TypedDict):
|
|
11
11
|
model_id: str
|
|
12
|
+
r"""The ID of the model to archive."""
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
class JobsAPIRoutesFineTuningArchiveFineTunedModelRequest(BaseModel):
|
|
15
16
|
model_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
|
|
17
|
+
r"""The ID of the model to archive."""
|
|
16
18
|
|
|
@@ -1,69 +1,11 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from .jobin import JobIn, JobInTypedDict
|
|
5
4
|
from .jobout import JobOut, JobOutTypedDict
|
|
6
5
|
from .legacyjobmetadataout import LegacyJobMetadataOut, LegacyJobMetadataOutTypedDict
|
|
7
|
-
from
|
|
8
|
-
from mistralai.utils import FieldMetadata, QueryParamMetadata, RequestMetadata
|
|
9
|
-
from pydantic import model_serializer
|
|
10
|
-
from typing import TypedDict, Union
|
|
11
|
-
from typing_extensions import Annotated, NotRequired
|
|
6
|
+
from typing import Union
|
|
12
7
|
|
|
13
8
|
|
|
14
|
-
class JobsAPIRoutesFineTuningCreateFineTuningJobRequestTypedDict(TypedDict):
|
|
15
|
-
job_in: JobInTypedDict
|
|
16
|
-
dry_run: NotRequired[Nullable[bool]]
|
|
17
|
-
r"""* If `true` the job is not spawned, instead the query returns a handful of useful metadata
|
|
18
|
-
for the user to perform sanity checks (see `LegacyJobMetadataOut` response).
|
|
19
|
-
* Otherwise, the job is started and the query returns the job ID along with some of the
|
|
20
|
-
input parameters (see `JobOut` response).
|
|
21
|
-
|
|
22
|
-
"""
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class JobsAPIRoutesFineTuningCreateFineTuningJobRequest(BaseModel):
|
|
26
|
-
job_in: Annotated[JobIn, FieldMetadata(request=RequestMetadata(media_type="application/json"))]
|
|
27
|
-
dry_run: Annotated[OptionalNullable[bool], FieldMetadata(query=QueryParamMetadata(style="form", explode=True))] = UNSET
|
|
28
|
-
r"""* If `true` the job is not spawned, instead the query returns a handful of useful metadata
|
|
29
|
-
for the user to perform sanity checks (see `LegacyJobMetadataOut` response).
|
|
30
|
-
* Otherwise, the job is started and the query returns the job ID along with some of the
|
|
31
|
-
input parameters (see `JobOut` response).
|
|
32
|
-
|
|
33
|
-
"""
|
|
34
|
-
|
|
35
|
-
@model_serializer(mode="wrap")
|
|
36
|
-
def serialize_model(self, handler):
|
|
37
|
-
optional_fields = ["dry_run"]
|
|
38
|
-
nullable_fields = ["dry_run"]
|
|
39
|
-
null_default_fields = []
|
|
40
|
-
|
|
41
|
-
serialized = handler(self)
|
|
42
|
-
|
|
43
|
-
m = {}
|
|
44
|
-
|
|
45
|
-
for n, f in self.model_fields.items():
|
|
46
|
-
k = f.alias or n
|
|
47
|
-
val = serialized.get(k)
|
|
48
|
-
|
|
49
|
-
if val is not None and val != UNSET_SENTINEL:
|
|
50
|
-
m[k] = val
|
|
51
|
-
elif val != UNSET_SENTINEL and (
|
|
52
|
-
not k in optional_fields
|
|
53
|
-
or (
|
|
54
|
-
k in optional_fields
|
|
55
|
-
and k in nullable_fields
|
|
56
|
-
and (
|
|
57
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
58
|
-
or k in null_default_fields
|
|
59
|
-
) # pylint: disable=no-member
|
|
60
|
-
)
|
|
61
|
-
):
|
|
62
|
-
m[k] = val
|
|
63
|
-
|
|
64
|
-
return m
|
|
65
|
-
|
|
66
|
-
|
|
67
9
|
JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict = Union[LegacyJobMetadataOutTypedDict, JobOutTypedDict]
|
|
68
10
|
r"""OK"""
|
|
69
11
|
|
|
@@ -67,18 +67,13 @@ class JobsAPIRoutesFineTuningGetFineTuningJobsRequest(BaseModel):
|
|
|
67
67
|
k = f.alias or n
|
|
68
68
|
val = serialized.get(k)
|
|
69
69
|
|
|
70
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
71
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
72
|
+
|
|
70
73
|
if val is not None and val != UNSET_SENTINEL:
|
|
71
74
|
m[k] = val
|
|
72
75
|
elif val != UNSET_SENTINEL and (
|
|
73
|
-
not k in optional_fields
|
|
74
|
-
or (
|
|
75
|
-
k in optional_fields
|
|
76
|
-
and k in nullable_fields
|
|
77
|
-
and (
|
|
78
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
79
|
-
or k in null_default_fields
|
|
80
|
-
) # pylint: disable=no-member
|
|
81
|
-
)
|
|
76
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
82
77
|
):
|
|
83
78
|
m[k] = val
|
|
84
79
|
|
|
@@ -9,8 +9,10 @@ from typing_extensions import Annotated
|
|
|
9
9
|
|
|
10
10
|
class JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequestTypedDict(TypedDict):
|
|
11
11
|
model_id: str
|
|
12
|
+
r"""The ID of the model to unarchive."""
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
class JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequest(BaseModel):
|
|
15
16
|
model_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
|
|
17
|
+
r"""The ID of the model to unarchive."""
|
|
16
18
|
|
|
@@ -10,10 +10,12 @@ from typing_extensions import Annotated
|
|
|
10
10
|
|
|
11
11
|
class JobsAPIRoutesFineTuningUpdateFineTunedModelRequestTypedDict(TypedDict):
|
|
12
12
|
model_id: str
|
|
13
|
+
r"""The ID of the model to update."""
|
|
13
14
|
update_ft_model_in: UpdateFTModelInTypedDict
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
class JobsAPIRoutesFineTuningUpdateFineTunedModelRequest(BaseModel):
|
|
17
18
|
model_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
|
|
19
|
+
r"""The ID of the model to update."""
|
|
18
20
|
update_ft_model_in: Annotated[UpdateFTModelIn, FieldMetadata(request=RequestMetadata(media_type="application/json"))]
|
|
19
21
|
|
|
@@ -66,18 +66,13 @@ class LegacyJobMetadataOut(BaseModel):
|
|
|
66
66
|
k = f.alias or n
|
|
67
67
|
val = serialized.get(k)
|
|
68
68
|
|
|
69
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
70
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
71
|
+
|
|
69
72
|
if val is not None and val != UNSET_SENTINEL:
|
|
70
73
|
m[k] = val
|
|
71
74
|
elif val != UNSET_SENTINEL and (
|
|
72
|
-
not k in optional_fields
|
|
73
|
-
or (
|
|
74
|
-
k in optional_fields
|
|
75
|
-
and k in nullable_fields
|
|
76
|
-
and (
|
|
77
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
78
|
-
or k in null_default_fields
|
|
79
|
-
) # pylint: disable=no-member
|
|
80
|
-
)
|
|
75
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
81
76
|
):
|
|
82
77
|
m[k] = val
|
|
83
78
|
|
mistralai/models/metricout.py
CHANGED
|
@@ -36,18 +36,13 @@ class MetricOut(BaseModel):
|
|
|
36
36
|
k = f.alias or n
|
|
37
37
|
val = serialized.get(k)
|
|
38
38
|
|
|
39
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
40
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
41
|
+
|
|
39
42
|
if val is not None and val != UNSET_SENTINEL:
|
|
40
43
|
m[k] = val
|
|
41
44
|
elif val != UNSET_SENTINEL and (
|
|
42
|
-
not k in optional_fields
|
|
43
|
-
or (
|
|
44
|
-
k in optional_fields
|
|
45
|
-
and k in nullable_fields
|
|
46
|
-
and (
|
|
47
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
48
|
-
or k in null_default_fields
|
|
49
|
-
) # pylint: disable=no-member
|
|
50
|
-
)
|
|
45
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
51
46
|
):
|
|
52
47
|
m[k] = val
|
|
53
48
|
|
mistralai/models/modelcard.py
CHANGED
|
@@ -52,18 +52,13 @@ class ModelCard(BaseModel):
|
|
|
52
52
|
k = f.alias or n
|
|
53
53
|
val = serialized.get(k)
|
|
54
54
|
|
|
55
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
56
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
57
|
+
|
|
55
58
|
if val is not None and val != UNSET_SENTINEL:
|
|
56
59
|
m[k] = val
|
|
57
60
|
elif val != UNSET_SENTINEL and (
|
|
58
|
-
not k in optional_fields
|
|
59
|
-
or (
|
|
60
|
-
k in optional_fields
|
|
61
|
-
and k in nullable_fields
|
|
62
|
-
and (
|
|
63
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
64
|
-
or k in null_default_fields
|
|
65
|
-
) # pylint: disable=no-member
|
|
66
|
-
)
|
|
61
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
67
62
|
):
|
|
68
63
|
m[k] = val
|
|
69
64
|
|
|
@@ -9,8 +9,10 @@ from typing_extensions import Annotated
|
|
|
9
9
|
|
|
10
10
|
class RetrieveModelV1ModelsModelIDGetRequestTypedDict(TypedDict):
|
|
11
11
|
model_id: str
|
|
12
|
+
r"""The ID of the model to retrieve."""
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
class RetrieveModelV1ModelsModelIDGetRequest(BaseModel):
|
|
15
16
|
model_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
|
|
17
|
+
r"""The ID of the model to retrieve."""
|
|
16
18
|
|
|
@@ -57,18 +57,13 @@ class RetrieveFileOut(BaseModel):
|
|
|
57
57
|
k = f.alias or n
|
|
58
58
|
val = serialized.get(k)
|
|
59
59
|
|
|
60
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
61
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
62
|
+
|
|
60
63
|
if val is not None and val != UNSET_SENTINEL:
|
|
61
64
|
m[k] = val
|
|
62
65
|
elif val != UNSET_SENTINEL and (
|
|
63
|
-
not k in optional_fields
|
|
64
|
-
or (
|
|
65
|
-
k in optional_fields
|
|
66
|
-
and k in nullable_fields
|
|
67
|
-
and (
|
|
68
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
69
|
-
or k in null_default_fields
|
|
70
|
-
) # pylint: disable=no-member
|
|
71
|
-
)
|
|
66
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
72
67
|
):
|
|
73
68
|
m[k] = val
|
|
74
69
|
|
mistralai/models/security.py
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
5
|
from mistralai.utils import FieldMetadata, SecurityMetadata
|
|
6
|
-
from typing import TypedDict
|
|
7
|
-
from typing_extensions import Annotated
|
|
6
|
+
from typing import Optional, TypedDict
|
|
7
|
+
from typing_extensions import Annotated, NotRequired
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class SecurityTypedDict(TypedDict):
|
|
11
|
-
api_key: str
|
|
11
|
+
api_key: NotRequired[str]
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class Security(BaseModel):
|
|
15
|
-
api_key: Annotated[str, FieldMetadata(security=SecurityMetadata(scheme=True, scheme_type="http", sub_type="bearer", field_name="Authorization"))]
|
|
15
|
+
api_key: Annotated[Optional[str], FieldMetadata(security=SecurityMetadata(scheme=True, scheme_type="http", sub_type="bearer", field_name="Authorization"))] = None
|
|
16
16
|
|
mistralai/models/toolmessage.py
CHANGED
|
@@ -36,18 +36,13 @@ class ToolMessage(BaseModel):
|
|
|
36
36
|
k = f.alias or n
|
|
37
37
|
val = serialized.get(k)
|
|
38
38
|
|
|
39
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
40
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
41
|
+
|
|
39
42
|
if val is not None and val != UNSET_SENTINEL:
|
|
40
43
|
m[k] = val
|
|
41
44
|
elif val != UNSET_SENTINEL and (
|
|
42
|
-
not k in optional_fields
|
|
43
|
-
or (
|
|
44
|
-
k in optional_fields
|
|
45
|
-
and k in nullable_fields
|
|
46
|
-
and (
|
|
47
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
48
|
-
or k in null_default_fields
|
|
49
|
-
) # pylint: disable=no-member
|
|
50
|
-
)
|
|
45
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
51
46
|
):
|
|
52
47
|
m[k] = val
|
|
53
48
|
|
|
@@ -34,18 +34,13 @@ class TrainingParameters(BaseModel):
|
|
|
34
34
|
k = f.alias or n
|
|
35
35
|
val = serialized.get(k)
|
|
36
36
|
|
|
37
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
38
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
39
|
+
|
|
37
40
|
if val is not None and val != UNSET_SENTINEL:
|
|
38
41
|
m[k] = val
|
|
39
42
|
elif val != UNSET_SENTINEL and (
|
|
40
|
-
not k in optional_fields
|
|
41
|
-
or (
|
|
42
|
-
k in optional_fields
|
|
43
|
-
and k in nullable_fields
|
|
44
|
-
and (
|
|
45
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
46
|
-
or k in null_default_fields
|
|
47
|
-
) # pylint: disable=no-member
|
|
48
|
-
)
|
|
43
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
49
44
|
):
|
|
50
45
|
m[k] = val
|
|
51
46
|
|
|
@@ -42,18 +42,13 @@ class TrainingParametersIn(BaseModel):
|
|
|
42
42
|
k = f.alias or n
|
|
43
43
|
val = serialized.get(k)
|
|
44
44
|
|
|
45
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
46
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
47
|
+
|
|
45
48
|
if val is not None and val != UNSET_SENTINEL:
|
|
46
49
|
m[k] = val
|
|
47
50
|
elif val != UNSET_SENTINEL and (
|
|
48
|
-
not k in optional_fields
|
|
49
|
-
or (
|
|
50
|
-
k in optional_fields
|
|
51
|
-
and k in nullable_fields
|
|
52
|
-
and (
|
|
53
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
54
|
-
or k in null_default_fields
|
|
55
|
-
) # pylint: disable=no-member
|
|
56
|
-
)
|
|
51
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
57
52
|
):
|
|
58
53
|
m[k] = val
|
|
59
54
|
|