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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .classificationobject import ClassificationObject, ClassificationObjectTypedDict
|
|
5
|
+
from mistralai.types import BaseModel
|
|
6
|
+
from typing import List, Optional
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ClassificationResponseTypedDict(TypedDict):
|
|
11
|
+
id: NotRequired[str]
|
|
12
|
+
model: NotRequired[str]
|
|
13
|
+
results: NotRequired[List[ClassificationObjectTypedDict]]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ClassificationResponse(BaseModel):
|
|
17
|
+
id: Optional[str] = None
|
|
18
|
+
|
|
19
|
+
model: Optional[str] = None
|
|
20
|
+
|
|
21
|
+
results: Optional[List[ClassificationObject]] = None
|
|
@@ -7,8 +7,8 @@ from .completionresponsestreamchoice import (
|
|
|
7
7
|
)
|
|
8
8
|
from .usageinfo import UsageInfo, UsageInfoTypedDict
|
|
9
9
|
from mistralai.types import BaseModel
|
|
10
|
-
from typing import List, Optional
|
|
11
|
-
from typing_extensions import NotRequired
|
|
10
|
+
from typing import List, Optional
|
|
11
|
+
from typing_extensions import NotRequired, TypedDict
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class CompletionChunkTypedDict(TypedDict):
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .completionchunk import CompletionChunk, CompletionChunkTypedDict
|
|
5
5
|
from mistralai.types import BaseModel
|
|
6
|
-
from
|
|
6
|
+
from typing_extensions import TypedDict
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class CompletionEventTypedDict(TypedDict):
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .deltamessage import DeltaMessage, DeltaMessageTypedDict
|
|
5
|
-
from mistralai.types import BaseModel, Nullable, UNSET_SENTINEL
|
|
5
|
+
from mistralai.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
|
|
6
|
+
from mistralai.utils import validate_open_enum
|
|
6
7
|
from pydantic import model_serializer
|
|
7
|
-
from
|
|
8
|
+
from pydantic.functional_validators import PlainValidator
|
|
9
|
+
from typing import Literal, Union
|
|
10
|
+
from typing_extensions import Annotated, TypedDict
|
|
8
11
|
|
|
9
12
|
|
|
10
|
-
CompletionResponseStreamChoiceFinishReason =
|
|
11
|
-
"stop", "length", "error", "tool_calls"
|
|
13
|
+
CompletionResponseStreamChoiceFinishReason = Union[
|
|
14
|
+
Literal["stop", "length", "error", "tool_calls"], UnrecognizedStr
|
|
12
15
|
]
|
|
13
16
|
|
|
14
17
|
|
|
@@ -23,7 +26,10 @@ class CompletionResponseStreamChoice(BaseModel):
|
|
|
23
26
|
|
|
24
27
|
delta: DeltaMessage
|
|
25
28
|
|
|
26
|
-
finish_reason:
|
|
29
|
+
finish_reason: Annotated[
|
|
30
|
+
Nullable[CompletionResponseStreamChoiceFinishReason],
|
|
31
|
+
PlainValidator(validate_open_enum(False)),
|
|
32
|
+
]
|
|
27
33
|
|
|
28
34
|
@model_serializer(mode="wrap")
|
|
29
35
|
def serialize_model(self, handler):
|
|
@@ -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 DeleteModelV1ModelsModelIDDeleteRequestTypedDict(TypedDict):
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
|
-
from typing import Optional
|
|
6
|
-
from typing_extensions import NotRequired
|
|
5
|
+
from typing import Optional
|
|
6
|
+
from typing_extensions import NotRequired, TypedDict
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class DeleteModelOutTypedDict(TypedDict):
|
mistralai/models/deltamessage.py
CHANGED
|
@@ -1,30 +1,37 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .contentchunk import ContentChunk, ContentChunkTypedDict
|
|
4
5
|
from .toolcall import ToolCall, ToolCallTypedDict
|
|
5
6
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
6
7
|
from pydantic import model_serializer
|
|
7
|
-
from typing import List,
|
|
8
|
-
from typing_extensions import NotRequired
|
|
8
|
+
from typing import List, Union
|
|
9
|
+
from typing_extensions import NotRequired, TypedDict
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
ContentTypedDict = Union[str, List[ContentChunkTypedDict]]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
Content = Union[str, List[ContentChunk]]
|
|
9
16
|
|
|
10
17
|
|
|
11
18
|
class DeltaMessageTypedDict(TypedDict):
|
|
12
|
-
role: NotRequired[str]
|
|
13
|
-
content: NotRequired[Nullable[
|
|
19
|
+
role: NotRequired[Nullable[str]]
|
|
20
|
+
content: NotRequired[Nullable[ContentTypedDict]]
|
|
14
21
|
tool_calls: NotRequired[Nullable[List[ToolCallTypedDict]]]
|
|
15
22
|
|
|
16
23
|
|
|
17
24
|
class DeltaMessage(BaseModel):
|
|
18
|
-
role:
|
|
25
|
+
role: OptionalNullable[str] = UNSET
|
|
19
26
|
|
|
20
|
-
content: OptionalNullable[
|
|
27
|
+
content: OptionalNullable[Content] = UNSET
|
|
21
28
|
|
|
22
29
|
tool_calls: OptionalNullable[List[ToolCall]] = UNSET
|
|
23
30
|
|
|
24
31
|
@model_serializer(mode="wrap")
|
|
25
32
|
def serialize_model(self, handler):
|
|
26
33
|
optional_fields = ["role", "content", "tool_calls"]
|
|
27
|
-
nullable_fields = ["content", "tool_calls"]
|
|
34
|
+
nullable_fields = ["role", "content", "tool_calls"]
|
|
28
35
|
null_default_fields = []
|
|
29
36
|
|
|
30
37
|
serialized = handler(self)
|
|
@@ -9,10 +9,12 @@ from .jobmetadataout import JobMetadataOut, JobMetadataOutTypedDict
|
|
|
9
9
|
from .trainingparameters import TrainingParameters, TrainingParametersTypedDict
|
|
10
10
|
from .wandbintegrationout import WandbIntegrationOut, WandbIntegrationOutTypedDict
|
|
11
11
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
12
|
+
from mistralai.utils import validate_const
|
|
12
13
|
import pydantic
|
|
13
14
|
from pydantic import model_serializer
|
|
14
|
-
from
|
|
15
|
-
from
|
|
15
|
+
from pydantic.functional_validators import AfterValidator
|
|
16
|
+
from typing import List, Literal, Optional
|
|
17
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
16
18
|
|
|
17
19
|
|
|
18
20
|
DetailedJobOutStatus = Literal[
|
|
@@ -54,6 +56,7 @@ class DetailedJobOutTypedDict(TypedDict):
|
|
|
54
56
|
modified_at: int
|
|
55
57
|
training_files: List[str]
|
|
56
58
|
validation_files: NotRequired[Nullable[List[str]]]
|
|
59
|
+
object: DetailedJobOutObject
|
|
57
60
|
fine_tuned_model: NotRequired[Nullable[str]]
|
|
58
61
|
suffix: NotRequired[Nullable[str]]
|
|
59
62
|
integrations: NotRequired[Nullable[List[DetailedJobOutIntegrationsTypedDict]]]
|
|
@@ -87,9 +90,12 @@ class DetailedJobOut(BaseModel):
|
|
|
87
90
|
|
|
88
91
|
validation_files: OptionalNullable[List[str]] = UNSET
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
+
OBJECT: Annotated[
|
|
94
|
+
Annotated[
|
|
95
|
+
Optional[DetailedJobOutObject], AfterValidator(validate_const("job"))
|
|
96
|
+
],
|
|
97
|
+
pydantic.Field(alias="object"),
|
|
98
|
+
] = "job"
|
|
93
99
|
|
|
94
100
|
fine_tuned_model: OptionalNullable[str] = UNSET
|
|
95
101
|
|
|
@@ -4,8 +4,8 @@ from __future__ import annotations
|
|
|
4
4
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
5
5
|
import pydantic
|
|
6
6
|
from pydantic import model_serializer
|
|
7
|
-
from typing import List,
|
|
8
|
-
from typing_extensions import Annotated, NotRequired
|
|
7
|
+
from typing import List, Optional, Union
|
|
8
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
InputsTypedDict = Union[str, List[str]]
|
|
@@ -19,7 +19,7 @@ r"""Text to embed."""
|
|
|
19
19
|
class EmbeddingRequestTypedDict(TypedDict):
|
|
20
20
|
inputs: InputsTypedDict
|
|
21
21
|
r"""Text to embed."""
|
|
22
|
-
model: str
|
|
22
|
+
model: NotRequired[str]
|
|
23
23
|
r"""ID of the model to use."""
|
|
24
24
|
encoding_format: NotRequired[Nullable[str]]
|
|
25
25
|
r"""The format to return the embeddings in."""
|
|
@@ -29,7 +29,7 @@ class EmbeddingRequest(BaseModel):
|
|
|
29
29
|
inputs: Annotated[Inputs, pydantic.Field(alias="input")]
|
|
30
30
|
r"""Text to embed."""
|
|
31
31
|
|
|
32
|
-
model: str
|
|
32
|
+
model: Optional[str] = "mistral-embed"
|
|
33
33
|
r"""ID of the model to use."""
|
|
34
34
|
|
|
35
35
|
encoding_format: OptionalNullable[str] = UNSET
|
|
@@ -37,7 +37,7 @@ class EmbeddingRequest(BaseModel):
|
|
|
37
37
|
|
|
38
38
|
@model_serializer(mode="wrap")
|
|
39
39
|
def serialize_model(self, handler):
|
|
40
|
-
optional_fields = ["encoding_format"]
|
|
40
|
+
optional_fields = ["model", "encoding_format"]
|
|
41
41
|
nullable_fields = ["encoding_format"]
|
|
42
42
|
null_default_fields = []
|
|
43
43
|
|
|
@@ -4,7 +4,8 @@ from __future__ import annotations
|
|
|
4
4
|
from .embeddingresponsedata import EmbeddingResponseData, EmbeddingResponseDataTypedDict
|
|
5
5
|
from .usageinfo import UsageInfo, UsageInfoTypedDict
|
|
6
6
|
from mistralai.types import BaseModel
|
|
7
|
-
from typing import List
|
|
7
|
+
from typing import List
|
|
8
|
+
from typing_extensions import TypedDict
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class EmbeddingResponseTypedDict(TypedDict):
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel
|
|
5
|
-
from typing import List, Optional
|
|
6
|
-
from typing_extensions import NotRequired
|
|
5
|
+
from typing import List, Optional
|
|
6
|
+
from typing_extensions import NotRequired, TypedDict
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class EmbeddingResponseDataTypedDict(TypedDict):
|
mistralai/models/eventout.py
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
5
5
|
from pydantic import model_serializer
|
|
6
|
-
from typing import Any, Dict
|
|
7
|
-
from typing_extensions import NotRequired
|
|
6
|
+
from typing import Any, Dict
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class EventOutTypedDict(TypedDict):
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from mistralai.types import UnrecognizedStr
|
|
5
|
+
from typing import Literal, Union
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
FilePurpose = Union[Literal["fine-tune", "batch"], UnrecognizedStr]
|
|
@@ -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 FilesAPIRoutesDeleteFileRequestTypedDict(TypedDict):
|
|
@@ -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 FilesAPIRoutesDownloadFileRequestTypedDict(TypedDict):
|
|
10
|
+
file_id: str
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class FilesAPIRoutesDownloadFileRequest(BaseModel):
|
|
14
|
+
file_id: Annotated[
|
|
15
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
16
|
+
]
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .filepurpose import FilePurpose
|
|
5
|
+
from .sampletype import SampleType
|
|
6
|
+
from .source import Source
|
|
7
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
8
|
+
from mistralai.utils import FieldMetadata, QueryParamMetadata, validate_open_enum
|
|
9
|
+
from pydantic import model_serializer
|
|
10
|
+
from pydantic.functional_validators import PlainValidator
|
|
11
|
+
from typing import List, Optional
|
|
12
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class FilesAPIRoutesListFilesRequestTypedDict(TypedDict):
|
|
16
|
+
page: NotRequired[int]
|
|
17
|
+
page_size: NotRequired[int]
|
|
18
|
+
sample_type: NotRequired[Nullable[List[SampleType]]]
|
|
19
|
+
source: NotRequired[Nullable[List[Source]]]
|
|
20
|
+
search: NotRequired[Nullable[str]]
|
|
21
|
+
purpose: NotRequired[Nullable[FilePurpose]]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class FilesAPIRoutesListFilesRequest(BaseModel):
|
|
25
|
+
page: Annotated[
|
|
26
|
+
Optional[int],
|
|
27
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
28
|
+
] = 0
|
|
29
|
+
|
|
30
|
+
page_size: Annotated[
|
|
31
|
+
Optional[int],
|
|
32
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
33
|
+
] = 100
|
|
34
|
+
|
|
35
|
+
sample_type: Annotated[
|
|
36
|
+
OptionalNullable[
|
|
37
|
+
List[Annotated[SampleType, PlainValidator(validate_open_enum(False))]]
|
|
38
|
+
],
|
|
39
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
40
|
+
] = UNSET
|
|
41
|
+
|
|
42
|
+
source: Annotated[
|
|
43
|
+
OptionalNullable[
|
|
44
|
+
List[Annotated[Source, PlainValidator(validate_open_enum(False))]]
|
|
45
|
+
],
|
|
46
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
47
|
+
] = UNSET
|
|
48
|
+
|
|
49
|
+
search: Annotated[
|
|
50
|
+
OptionalNullable[str],
|
|
51
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
52
|
+
] = UNSET
|
|
53
|
+
|
|
54
|
+
purpose: Annotated[
|
|
55
|
+
Annotated[
|
|
56
|
+
OptionalNullable[FilePurpose], PlainValidator(validate_open_enum(False))
|
|
57
|
+
],
|
|
58
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
59
|
+
] = UNSET
|
|
60
|
+
|
|
61
|
+
@model_serializer(mode="wrap")
|
|
62
|
+
def serialize_model(self, handler):
|
|
63
|
+
optional_fields = [
|
|
64
|
+
"page",
|
|
65
|
+
"page_size",
|
|
66
|
+
"sample_type",
|
|
67
|
+
"source",
|
|
68
|
+
"search",
|
|
69
|
+
"purpose",
|
|
70
|
+
]
|
|
71
|
+
nullable_fields = ["sample_type", "source", "search", "purpose"]
|
|
72
|
+
null_default_fields = []
|
|
73
|
+
|
|
74
|
+
serialized = handler(self)
|
|
75
|
+
|
|
76
|
+
m = {}
|
|
77
|
+
|
|
78
|
+
for n, f in self.model_fields.items():
|
|
79
|
+
k = f.alias or n
|
|
80
|
+
val = serialized.get(k)
|
|
81
|
+
serialized.pop(k, None)
|
|
82
|
+
|
|
83
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
84
|
+
is_set = (
|
|
85
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
86
|
+
or k in null_default_fields
|
|
87
|
+
) # pylint: disable=no-member
|
|
88
|
+
|
|
89
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
90
|
+
m[k] = val
|
|
91
|
+
elif val != UNSET_SENTINEL and (
|
|
92
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
93
|
+
):
|
|
94
|
+
m[k] = val
|
|
95
|
+
|
|
96
|
+
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 FilesAPIRoutesRetrieveFileRequestTypedDict(TypedDict):
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .filepurpose import FilePurpose
|
|
4
5
|
import io
|
|
5
|
-
from mistralai.types import BaseModel
|
|
6
|
+
from mistralai.types import BaseModel
|
|
6
7
|
from mistralai.utils import FieldMetadata, MultipartFormMetadata, validate_open_enum
|
|
7
8
|
import pydantic
|
|
8
9
|
from pydantic.functional_validators import PlainValidator
|
|
9
|
-
from typing import
|
|
10
|
-
from typing_extensions import Annotated, NotRequired
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
FilesAPIRoutesUploadFilePurpose = Union[Literal["fine-tune"], UnrecognizedStr]
|
|
10
|
+
from typing import IO, Optional, Union
|
|
11
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
14
12
|
|
|
15
13
|
|
|
16
14
|
class FileTypedDict(TypedDict):
|
|
@@ -49,6 +47,7 @@ class FilesAPIRoutesUploadFileMultiPartBodyParamsTypedDict(TypedDict):
|
|
|
49
47
|
file=@path/to/your/file.jsonl
|
|
50
48
|
```
|
|
51
49
|
"""
|
|
50
|
+
purpose: NotRequired[FilePurpose]
|
|
52
51
|
|
|
53
52
|
|
|
54
53
|
class FilesAPIRoutesUploadFileMultiPartBodyParams(BaseModel):
|
|
@@ -68,6 +67,7 @@ class FilesAPIRoutesUploadFileMultiPartBodyParams(BaseModel):
|
|
|
68
67
|
```
|
|
69
68
|
"""
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
purpose: Annotated[
|
|
71
|
+
Annotated[Optional[FilePurpose], PlainValidator(validate_open_enum(False))],
|
|
72
|
+
FieldMetadata(multipart=True),
|
|
73
|
+
] = None
|
mistralai/models/fileschema.py
CHANGED
|
@@ -1,26 +1,14 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .filepurpose import FilePurpose
|
|
4
5
|
from .sampletype import SampleType
|
|
5
6
|
from .source import Source
|
|
6
|
-
from mistralai.types import
|
|
7
|
-
BaseModel,
|
|
8
|
-
Nullable,
|
|
9
|
-
OptionalNullable,
|
|
10
|
-
UNSET,
|
|
11
|
-
UNSET_SENTINEL,
|
|
12
|
-
UnrecognizedStr,
|
|
13
|
-
)
|
|
7
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
14
8
|
from mistralai.utils import validate_open_enum
|
|
15
|
-
import pydantic
|
|
16
9
|
from pydantic import model_serializer
|
|
17
10
|
from pydantic.functional_validators import PlainValidator
|
|
18
|
-
from
|
|
19
|
-
from typing_extensions import Annotated, NotRequired
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
FileSchemaPurpose = Union[Literal["fine-tune"], UnrecognizedStr]
|
|
23
|
-
r"""The intended purpose of the uploaded file. Only accepts fine-tuning (`fine-tune`) for now."""
|
|
11
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
24
12
|
|
|
25
13
|
|
|
26
14
|
class FileSchemaTypedDict(TypedDict):
|
|
@@ -34,6 +22,7 @@ class FileSchemaTypedDict(TypedDict):
|
|
|
34
22
|
r"""The UNIX timestamp (in seconds) of the event."""
|
|
35
23
|
filename: str
|
|
36
24
|
r"""The name of the uploaded file."""
|
|
25
|
+
purpose: FilePurpose
|
|
37
26
|
sample_type: SampleType
|
|
38
27
|
source: Source
|
|
39
28
|
num_lines: NotRequired[Nullable[int]]
|
|
@@ -55,14 +44,11 @@ class FileSchema(BaseModel):
|
|
|
55
44
|
filename: str
|
|
56
45
|
r"""The name of the uploaded file."""
|
|
57
46
|
|
|
58
|
-
|
|
47
|
+
purpose: Annotated[FilePurpose, PlainValidator(validate_open_enum(False))]
|
|
59
48
|
|
|
60
|
-
|
|
49
|
+
sample_type: Annotated[SampleType, PlainValidator(validate_open_enum(False))]
|
|
61
50
|
|
|
62
|
-
|
|
63
|
-
PURPOSE: Annotated[Final[Annotated[FileSchemaPurpose, PlainValidator(validate_open_enum(False))]], pydantic.Field(alias="purpose")] = "fine-tune" # type: ignore
|
|
64
|
-
# fmt: on
|
|
65
|
-
r"""The intended purpose of the uploaded file. Only accepts fine-tuning (`fine-tune`) for now."""
|
|
51
|
+
source: Annotated[Source, PlainValidator(validate_open_enum(False))]
|
|
66
52
|
|
|
67
53
|
num_lines: OptionalNullable[int] = UNSET
|
|
68
54
|
|
|
@@ -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
|
FIMCompletionRequestStopTypedDict = Union[str, List[str]]
|
|
@@ -23,14 +23,12 @@ class FIMCompletionRequestTypedDict(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
|
r"""Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON."""
|
|
36
34
|
stop: NotRequired[FIMCompletionRequestStopTypedDict]
|
|
@@ -39,6 +37,8 @@ class FIMCompletionRequestTypedDict(TypedDict):
|
|
|
39
37
|
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
40
38
|
suffix: NotRequired[Nullable[str]]
|
|
41
39
|
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`."""
|
|
40
|
+
min_tokens: NotRequired[Nullable[int]]
|
|
41
|
+
r"""The minimum number of tokens to generate in the completion."""
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
class FIMCompletionRequest(BaseModel):
|
|
@@ -51,8 +51,8 @@ class FIMCompletionRequest(BaseModel):
|
|
|
51
51
|
prompt: str
|
|
52
52
|
r"""The text/code to complete."""
|
|
53
53
|
|
|
54
|
-
temperature:
|
|
55
|
-
r"""What sampling temperature to use, between 0.0 and
|
|
54
|
+
temperature: OptionalNullable[float] = UNSET
|
|
55
|
+
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."""
|
|
56
56
|
|
|
57
57
|
top_p: Optional[float] = 1
|
|
58
58
|
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."""
|
|
@@ -60,9 +60,6 @@ class FIMCompletionRequest(BaseModel):
|
|
|
60
60
|
max_tokens: OptionalNullable[int] = UNSET
|
|
61
61
|
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."""
|
|
62
62
|
|
|
63
|
-
min_tokens: OptionalNullable[int] = UNSET
|
|
64
|
-
r"""The minimum number of tokens to generate in the completion."""
|
|
65
|
-
|
|
66
63
|
stream: Optional[bool] = False
|
|
67
64
|
r"""Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON."""
|
|
68
65
|
|
|
@@ -75,19 +72,29 @@ class FIMCompletionRequest(BaseModel):
|
|
|
75
72
|
suffix: OptionalNullable[str] = UNSET
|
|
76
73
|
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`."""
|
|
77
74
|
|
|
75
|
+
min_tokens: OptionalNullable[int] = UNSET
|
|
76
|
+
r"""The minimum number of tokens to generate in the completion."""
|
|
77
|
+
|
|
78
78
|
@model_serializer(mode="wrap")
|
|
79
79
|
def serialize_model(self, handler):
|
|
80
80
|
optional_fields = [
|
|
81
81
|
"temperature",
|
|
82
82
|
"top_p",
|
|
83
83
|
"max_tokens",
|
|
84
|
-
"min_tokens",
|
|
85
84
|
"stream",
|
|
86
85
|
"stop",
|
|
87
86
|
"random_seed",
|
|
88
87
|
"suffix",
|
|
88
|
+
"min_tokens",
|
|
89
|
+
]
|
|
90
|
+
nullable_fields = [
|
|
91
|
+
"model",
|
|
92
|
+
"temperature",
|
|
93
|
+
"max_tokens",
|
|
94
|
+
"random_seed",
|
|
95
|
+
"suffix",
|
|
96
|
+
"min_tokens",
|
|
89
97
|
]
|
|
90
|
-
nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "suffix"]
|
|
91
98
|
null_default_fields = []
|
|
92
99
|
|
|
93
100
|
serialized = handler(self)
|
|
@@ -4,8 +4,8 @@ from __future__ import annotations
|
|
|
4
4
|
from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceTypedDict
|
|
5
5
|
from .usageinfo import UsageInfo, UsageInfoTypedDict
|
|
6
6
|
from mistralai.types import BaseModel
|
|
7
|
-
from typing import List, Optional
|
|
8
|
-
from typing_extensions import NotRequired
|
|
7
|
+
from typing import List, Optional
|
|
8
|
+
from typing_extensions import NotRequired, TypedDict
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class FIMCompletionResponseTypedDict(TypedDict):
|