mistralai 1.9.1__py3-none-any.whl → 1.9.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mistralai/_version.py +2 -2
- mistralai/accesses.py +672 -0
- mistralai/audio.py +18 -0
- mistralai/beta.py +4 -0
- mistralai/documents.py +2136 -0
- mistralai/files.py +2 -2
- mistralai/libraries.py +1041 -0
- mistralai/mistral_jobs.py +14 -2
- mistralai/models/__init__.py +360 -9
- mistralai/models/audiochunk.py +20 -0
- mistralai/models/audiotranscriptionrequest.py +97 -0
- mistralai/models/audiotranscriptionrequeststream.py +97 -0
- mistralai/models/basemodelcard.py +5 -2
- mistralai/models/batchjobin.py +7 -4
- mistralai/models/batchjobout.py +10 -3
- mistralai/models/classifierftmodelout.py +6 -0
- mistralai/models/completionargs.py +3 -2
- mistralai/models/completionftmodelout.py +6 -0
- mistralai/models/contentchunk.py +6 -0
- mistralai/models/conversationevents.py +6 -0
- mistralai/models/conversationhistory.py +4 -4
- mistralai/models/documentout.py +105 -0
- mistralai/models/documenttextcontent.py +13 -0
- mistralai/models/documentupdatein.py +44 -0
- mistralai/models/entitytype.py +9 -0
- mistralai/models/file.py +33 -0
- mistralai/models/files_api_routes_upload_fileop.py +2 -27
- mistralai/models/fileschema.py +8 -2
- mistralai/models/ftmodelcard.py +5 -3
- mistralai/models/inputentries.py +4 -4
- mistralai/models/jobs_api_routes_batch_get_batch_jobsop.py +8 -1
- mistralai/models/libraries_delete_v1op.py +16 -0
- mistralai/models/libraries_documents_delete_v1op.py +21 -0
- mistralai/models/libraries_documents_get_extracted_text_signed_url_v1op.py +21 -0
- mistralai/models/libraries_documents_get_signed_url_v1op.py +21 -0
- mistralai/models/libraries_documents_get_status_v1op.py +21 -0
- mistralai/models/libraries_documents_get_text_content_v1op.py +21 -0
- mistralai/models/libraries_documents_get_v1op.py +21 -0
- mistralai/models/libraries_documents_list_v1op.py +78 -0
- mistralai/models/libraries_documents_reprocess_v1op.py +21 -0
- mistralai/models/libraries_documents_update_v1op.py +28 -0
- mistralai/models/libraries_documents_upload_v1op.py +56 -0
- mistralai/models/libraries_get_v1op.py +16 -0
- mistralai/models/libraries_share_create_v1op.py +22 -0
- mistralai/models/libraries_share_delete_v1op.py +23 -0
- mistralai/models/libraries_share_list_v1op.py +16 -0
- mistralai/models/libraries_update_v1op.py +23 -0
- mistralai/models/libraryin.py +50 -0
- mistralai/models/libraryinupdate.py +47 -0
- mistralai/models/libraryout.py +107 -0
- mistralai/models/listdocumentout.py +19 -0
- mistralai/models/listlibraryout.py +15 -0
- mistralai/models/listsharingout.py +15 -0
- mistralai/models/messageinputentry.py +14 -4
- mistralai/models/paginationinfo.py +25 -0
- mistralai/models/processingstatusout.py +16 -0
- mistralai/models/retrievefileout.py +8 -2
- mistralai/models/shareenum.py +8 -0
- mistralai/models/sharingdelete.py +26 -0
- mistralai/models/sharingin.py +30 -0
- mistralai/models/sharingout.py +59 -0
- mistralai/models/ssetypes.py +1 -0
- mistralai/models/thinkchunk.py +35 -0
- mistralai/models/timestampgranularity.py +7 -0
- mistralai/models/toolcall.py +43 -1
- mistralai/models/toolexecutiondeltaevent.py +34 -0
- mistralai/models/toolexecutionentry.py +3 -0
- mistralai/models/toolexecutionstartedevent.py +3 -0
- mistralai/models/toolreferencechunk.py +7 -4
- mistralai/models/transcriptionresponse.py +79 -0
- mistralai/models/transcriptionsegmentchunk.py +41 -0
- mistralai/models/transcriptionstreamdone.py +85 -0
- mistralai/models/transcriptionstreamevents.py +58 -0
- mistralai/models/transcriptionstreameventtypes.py +12 -0
- mistralai/models/transcriptionstreamlanguage.py +35 -0
- mistralai/models/transcriptionstreamsegmentdelta.py +41 -0
- mistralai/models/transcriptionstreamtextdelta.py +35 -0
- mistralai/models/uploadfileout.py +8 -2
- mistralai/models/usageinfo.py +65 -8
- mistralai/sdk.py +3 -0
- mistralai/transcriptions.py +480 -0
- {mistralai-1.9.1.dist-info → mistralai-1.9.3.dist-info}/METADATA +37 -2
- {mistralai-1.9.1.dist-info → mistralai-1.9.3.dist-info}/RECORD +85 -33
- {mistralai-1.9.1.dist-info → mistralai-1.9.3.dist-info}/LICENSE +0 -0
- {mistralai-1.9.1.dist-info → mistralai-1.9.3.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .transcriptionsegmentchunk import (
|
|
5
|
+
TranscriptionSegmentChunk,
|
|
6
|
+
TranscriptionSegmentChunkTypedDict,
|
|
7
|
+
)
|
|
8
|
+
from .usageinfo import UsageInfo, UsageInfoTypedDict
|
|
9
|
+
from mistralai.types import BaseModel, Nullable, UNSET_SENTINEL
|
|
10
|
+
import pydantic
|
|
11
|
+
from pydantic import ConfigDict, model_serializer
|
|
12
|
+
from typing import Any, Dict, List, Optional
|
|
13
|
+
from typing_extensions import NotRequired, TypedDict
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class TranscriptionResponseTypedDict(TypedDict):
|
|
17
|
+
model: str
|
|
18
|
+
text: str
|
|
19
|
+
usage: UsageInfoTypedDict
|
|
20
|
+
language: Nullable[str]
|
|
21
|
+
segments: NotRequired[List[TranscriptionSegmentChunkTypedDict]]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class TranscriptionResponse(BaseModel):
|
|
25
|
+
model_config = ConfigDict(
|
|
26
|
+
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
|
27
|
+
)
|
|
28
|
+
__pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False)
|
|
29
|
+
|
|
30
|
+
model: str
|
|
31
|
+
|
|
32
|
+
text: str
|
|
33
|
+
|
|
34
|
+
usage: UsageInfo
|
|
35
|
+
|
|
36
|
+
language: Nullable[str]
|
|
37
|
+
|
|
38
|
+
segments: Optional[List[TranscriptionSegmentChunk]] = None
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def additional_properties(self):
|
|
42
|
+
return self.__pydantic_extra__
|
|
43
|
+
|
|
44
|
+
@additional_properties.setter
|
|
45
|
+
def additional_properties(self, value):
|
|
46
|
+
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
|
|
47
|
+
|
|
48
|
+
@model_serializer(mode="wrap")
|
|
49
|
+
def serialize_model(self, handler):
|
|
50
|
+
optional_fields = ["segments"]
|
|
51
|
+
nullable_fields = ["language"]
|
|
52
|
+
null_default_fields = []
|
|
53
|
+
|
|
54
|
+
serialized = handler(self)
|
|
55
|
+
|
|
56
|
+
m = {}
|
|
57
|
+
|
|
58
|
+
for n, f in type(self).model_fields.items():
|
|
59
|
+
k = f.alias or n
|
|
60
|
+
val = serialized.get(k)
|
|
61
|
+
serialized.pop(k, None)
|
|
62
|
+
|
|
63
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
64
|
+
is_set = (
|
|
65
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
66
|
+
or k in null_default_fields
|
|
67
|
+
) # pylint: disable=no-member
|
|
68
|
+
|
|
69
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
70
|
+
m[k] = val
|
|
71
|
+
elif val != UNSET_SENTINEL and (
|
|
72
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
73
|
+
):
|
|
74
|
+
m[k] = val
|
|
75
|
+
|
|
76
|
+
for k, v in serialized.items():
|
|
77
|
+
m[k] = v
|
|
78
|
+
|
|
79
|
+
return m
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from mistralai.types import BaseModel
|
|
5
|
+
import pydantic
|
|
6
|
+
from pydantic import ConfigDict
|
|
7
|
+
from typing import Any, Dict, Literal, Optional
|
|
8
|
+
from typing_extensions import NotRequired, TypedDict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Type = Literal["transcription_segment"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class TranscriptionSegmentChunkTypedDict(TypedDict):
|
|
15
|
+
text: str
|
|
16
|
+
start: float
|
|
17
|
+
end: float
|
|
18
|
+
type: NotRequired[Type]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class TranscriptionSegmentChunk(BaseModel):
|
|
22
|
+
model_config = ConfigDict(
|
|
23
|
+
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
|
24
|
+
)
|
|
25
|
+
__pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False)
|
|
26
|
+
|
|
27
|
+
text: str
|
|
28
|
+
|
|
29
|
+
start: float
|
|
30
|
+
|
|
31
|
+
end: float
|
|
32
|
+
|
|
33
|
+
type: Optional[Type] = "transcription_segment"
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def additional_properties(self):
|
|
37
|
+
return self.__pydantic_extra__
|
|
38
|
+
|
|
39
|
+
@additional_properties.setter
|
|
40
|
+
def additional_properties(self, value):
|
|
41
|
+
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .transcriptionsegmentchunk import (
|
|
5
|
+
TranscriptionSegmentChunk,
|
|
6
|
+
TranscriptionSegmentChunkTypedDict,
|
|
7
|
+
)
|
|
8
|
+
from .usageinfo import UsageInfo, UsageInfoTypedDict
|
|
9
|
+
from mistralai.types import BaseModel, Nullable, UNSET_SENTINEL
|
|
10
|
+
import pydantic
|
|
11
|
+
from pydantic import ConfigDict, model_serializer
|
|
12
|
+
from typing import Any, Dict, List, Literal, Optional
|
|
13
|
+
from typing_extensions import NotRequired, TypedDict
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
TranscriptionStreamDoneType = Literal["transcription.done"]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class TranscriptionStreamDoneTypedDict(TypedDict):
|
|
20
|
+
model: str
|
|
21
|
+
text: str
|
|
22
|
+
usage: UsageInfoTypedDict
|
|
23
|
+
language: Nullable[str]
|
|
24
|
+
segments: NotRequired[List[TranscriptionSegmentChunkTypedDict]]
|
|
25
|
+
type: NotRequired[TranscriptionStreamDoneType]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class TranscriptionStreamDone(BaseModel):
|
|
29
|
+
model_config = ConfigDict(
|
|
30
|
+
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
|
31
|
+
)
|
|
32
|
+
__pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False)
|
|
33
|
+
|
|
34
|
+
model: str
|
|
35
|
+
|
|
36
|
+
text: str
|
|
37
|
+
|
|
38
|
+
usage: UsageInfo
|
|
39
|
+
|
|
40
|
+
language: Nullable[str]
|
|
41
|
+
|
|
42
|
+
segments: Optional[List[TranscriptionSegmentChunk]] = None
|
|
43
|
+
|
|
44
|
+
type: Optional[TranscriptionStreamDoneType] = "transcription.done"
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def additional_properties(self):
|
|
48
|
+
return self.__pydantic_extra__
|
|
49
|
+
|
|
50
|
+
@additional_properties.setter
|
|
51
|
+
def additional_properties(self, value):
|
|
52
|
+
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
|
|
53
|
+
|
|
54
|
+
@model_serializer(mode="wrap")
|
|
55
|
+
def serialize_model(self, handler):
|
|
56
|
+
optional_fields = ["segments", "type"]
|
|
57
|
+
nullable_fields = ["language"]
|
|
58
|
+
null_default_fields = []
|
|
59
|
+
|
|
60
|
+
serialized = handler(self)
|
|
61
|
+
|
|
62
|
+
m = {}
|
|
63
|
+
|
|
64
|
+
for n, f in type(self).model_fields.items():
|
|
65
|
+
k = f.alias or n
|
|
66
|
+
val = serialized.get(k)
|
|
67
|
+
serialized.pop(k, None)
|
|
68
|
+
|
|
69
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
70
|
+
is_set = (
|
|
71
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
72
|
+
or k in null_default_fields
|
|
73
|
+
) # pylint: disable=no-member
|
|
74
|
+
|
|
75
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
76
|
+
m[k] = val
|
|
77
|
+
elif val != UNSET_SENTINEL and (
|
|
78
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
79
|
+
):
|
|
80
|
+
m[k] = val
|
|
81
|
+
|
|
82
|
+
for k, v in serialized.items():
|
|
83
|
+
m[k] = v
|
|
84
|
+
|
|
85
|
+
return m
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .transcriptionstreamdone import (
|
|
5
|
+
TranscriptionStreamDone,
|
|
6
|
+
TranscriptionStreamDoneTypedDict,
|
|
7
|
+
)
|
|
8
|
+
from .transcriptionstreameventtypes import TranscriptionStreamEventTypes
|
|
9
|
+
from .transcriptionstreamlanguage import (
|
|
10
|
+
TranscriptionStreamLanguage,
|
|
11
|
+
TranscriptionStreamLanguageTypedDict,
|
|
12
|
+
)
|
|
13
|
+
from .transcriptionstreamsegmentdelta import (
|
|
14
|
+
TranscriptionStreamSegmentDelta,
|
|
15
|
+
TranscriptionStreamSegmentDeltaTypedDict,
|
|
16
|
+
)
|
|
17
|
+
from .transcriptionstreamtextdelta import (
|
|
18
|
+
TranscriptionStreamTextDelta,
|
|
19
|
+
TranscriptionStreamTextDeltaTypedDict,
|
|
20
|
+
)
|
|
21
|
+
from mistralai.types import BaseModel
|
|
22
|
+
from mistralai.utils import get_discriminator
|
|
23
|
+
from pydantic import Discriminator, Tag
|
|
24
|
+
from typing import Union
|
|
25
|
+
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
TranscriptionStreamEventsDataTypedDict = TypeAliasType(
|
|
29
|
+
"TranscriptionStreamEventsDataTypedDict",
|
|
30
|
+
Union[
|
|
31
|
+
TranscriptionStreamTextDeltaTypedDict,
|
|
32
|
+
TranscriptionStreamLanguageTypedDict,
|
|
33
|
+
TranscriptionStreamSegmentDeltaTypedDict,
|
|
34
|
+
TranscriptionStreamDoneTypedDict,
|
|
35
|
+
],
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
TranscriptionStreamEventsData = Annotated[
|
|
40
|
+
Union[
|
|
41
|
+
Annotated[TranscriptionStreamDone, Tag("transcription.done")],
|
|
42
|
+
Annotated[TranscriptionStreamLanguage, Tag("transcription.language")],
|
|
43
|
+
Annotated[TranscriptionStreamSegmentDelta, Tag("transcription.segment")],
|
|
44
|
+
Annotated[TranscriptionStreamTextDelta, Tag("transcription.text.delta")],
|
|
45
|
+
],
|
|
46
|
+
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class TranscriptionStreamEventsTypedDict(TypedDict):
|
|
51
|
+
event: TranscriptionStreamEventTypes
|
|
52
|
+
data: TranscriptionStreamEventsDataTypedDict
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class TranscriptionStreamEvents(BaseModel):
|
|
56
|
+
event: TranscriptionStreamEventTypes
|
|
57
|
+
|
|
58
|
+
data: TranscriptionStreamEventsData
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from typing import Literal
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
TranscriptionStreamEventTypes = Literal[
|
|
8
|
+
"transcription.language",
|
|
9
|
+
"transcription.segment",
|
|
10
|
+
"transcription.text.delta",
|
|
11
|
+
"transcription.done",
|
|
12
|
+
]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from mistralai.types import BaseModel
|
|
5
|
+
import pydantic
|
|
6
|
+
from pydantic import ConfigDict
|
|
7
|
+
from typing import Any, Dict, Literal, Optional
|
|
8
|
+
from typing_extensions import NotRequired, TypedDict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
TranscriptionStreamLanguageType = Literal["transcription.language"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class TranscriptionStreamLanguageTypedDict(TypedDict):
|
|
15
|
+
audio_language: str
|
|
16
|
+
type: NotRequired[TranscriptionStreamLanguageType]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class TranscriptionStreamLanguage(BaseModel):
|
|
20
|
+
model_config = ConfigDict(
|
|
21
|
+
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
|
22
|
+
)
|
|
23
|
+
__pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False)
|
|
24
|
+
|
|
25
|
+
audio_language: str
|
|
26
|
+
|
|
27
|
+
type: Optional[TranscriptionStreamLanguageType] = "transcription.language"
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def additional_properties(self):
|
|
31
|
+
return self.__pydantic_extra__
|
|
32
|
+
|
|
33
|
+
@additional_properties.setter
|
|
34
|
+
def additional_properties(self, value):
|
|
35
|
+
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from mistralai.types import BaseModel
|
|
5
|
+
import pydantic
|
|
6
|
+
from pydantic import ConfigDict
|
|
7
|
+
from typing import Any, Dict, Literal, Optional
|
|
8
|
+
from typing_extensions import NotRequired, TypedDict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
TranscriptionStreamSegmentDeltaType = Literal["transcription.segment"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class TranscriptionStreamSegmentDeltaTypedDict(TypedDict):
|
|
15
|
+
text: str
|
|
16
|
+
start: float
|
|
17
|
+
end: float
|
|
18
|
+
type: NotRequired[TranscriptionStreamSegmentDeltaType]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class TranscriptionStreamSegmentDelta(BaseModel):
|
|
22
|
+
model_config = ConfigDict(
|
|
23
|
+
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
|
24
|
+
)
|
|
25
|
+
__pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False)
|
|
26
|
+
|
|
27
|
+
text: str
|
|
28
|
+
|
|
29
|
+
start: float
|
|
30
|
+
|
|
31
|
+
end: float
|
|
32
|
+
|
|
33
|
+
type: Optional[TranscriptionStreamSegmentDeltaType] = "transcription.segment"
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def additional_properties(self):
|
|
37
|
+
return self.__pydantic_extra__
|
|
38
|
+
|
|
39
|
+
@additional_properties.setter
|
|
40
|
+
def additional_properties(self, value):
|
|
41
|
+
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from mistralai.types import BaseModel
|
|
5
|
+
import pydantic
|
|
6
|
+
from pydantic import ConfigDict
|
|
7
|
+
from typing import Any, Dict, Literal, Optional
|
|
8
|
+
from typing_extensions import NotRequired, TypedDict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
TranscriptionStreamTextDeltaType = Literal["transcription.text.delta"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class TranscriptionStreamTextDeltaTypedDict(TypedDict):
|
|
15
|
+
text: str
|
|
16
|
+
type: NotRequired[TranscriptionStreamTextDeltaType]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class TranscriptionStreamTextDelta(BaseModel):
|
|
20
|
+
model_config = ConfigDict(
|
|
21
|
+
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
|
22
|
+
)
|
|
23
|
+
__pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False)
|
|
24
|
+
|
|
25
|
+
text: str
|
|
26
|
+
|
|
27
|
+
type: Optional[TranscriptionStreamTextDeltaType] = "transcription.text.delta"
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def additional_properties(self):
|
|
31
|
+
return self.__pydantic_extra__
|
|
32
|
+
|
|
33
|
+
@additional_properties.setter
|
|
34
|
+
def additional_properties(self, value):
|
|
35
|
+
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
|
|
@@ -27,6 +27,8 @@ class UploadFileOutTypedDict(TypedDict):
|
|
|
27
27
|
sample_type: SampleType
|
|
28
28
|
source: Source
|
|
29
29
|
num_lines: NotRequired[Nullable[int]]
|
|
30
|
+
mimetype: NotRequired[Nullable[str]]
|
|
31
|
+
signature: NotRequired[Nullable[str]]
|
|
30
32
|
|
|
31
33
|
|
|
32
34
|
class UploadFileOut(BaseModel):
|
|
@@ -53,10 +55,14 @@ class UploadFileOut(BaseModel):
|
|
|
53
55
|
|
|
54
56
|
num_lines: OptionalNullable[int] = UNSET
|
|
55
57
|
|
|
58
|
+
mimetype: OptionalNullable[str] = UNSET
|
|
59
|
+
|
|
60
|
+
signature: OptionalNullable[str] = UNSET
|
|
61
|
+
|
|
56
62
|
@model_serializer(mode="wrap")
|
|
57
63
|
def serialize_model(self, handler):
|
|
58
|
-
optional_fields = ["num_lines"]
|
|
59
|
-
nullable_fields = ["num_lines"]
|
|
64
|
+
optional_fields = ["num_lines", "mimetype", "signature"]
|
|
65
|
+
nullable_fields = ["num_lines", "mimetype", "signature"]
|
|
60
66
|
null_default_fields = []
|
|
61
67
|
|
|
62
68
|
serialized = handler(self)
|
mistralai/models/usageinfo.py
CHANGED
|
@@ -1,19 +1,76 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from mistralai.types import BaseModel
|
|
5
|
-
|
|
4
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
5
|
+
import pydantic
|
|
6
|
+
from pydantic import ConfigDict, model_serializer
|
|
7
|
+
from typing import Any, Dict, Optional
|
|
8
|
+
from typing_extensions import NotRequired, TypedDict
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
class UsageInfoTypedDict(TypedDict):
|
|
9
|
-
prompt_tokens: int
|
|
10
|
-
completion_tokens: int
|
|
11
|
-
total_tokens: int
|
|
12
|
+
prompt_tokens: NotRequired[int]
|
|
13
|
+
completion_tokens: NotRequired[int]
|
|
14
|
+
total_tokens: NotRequired[int]
|
|
15
|
+
prompt_audio_seconds: NotRequired[Nullable[int]]
|
|
12
16
|
|
|
13
17
|
|
|
14
18
|
class UsageInfo(BaseModel):
|
|
15
|
-
|
|
19
|
+
model_config = ConfigDict(
|
|
20
|
+
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
|
21
|
+
)
|
|
22
|
+
__pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False)
|
|
16
23
|
|
|
17
|
-
|
|
24
|
+
prompt_tokens: Optional[int] = 0
|
|
18
25
|
|
|
19
|
-
|
|
26
|
+
completion_tokens: Optional[int] = 0
|
|
27
|
+
|
|
28
|
+
total_tokens: Optional[int] = 0
|
|
29
|
+
|
|
30
|
+
prompt_audio_seconds: OptionalNullable[int] = UNSET
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def additional_properties(self):
|
|
34
|
+
return self.__pydantic_extra__
|
|
35
|
+
|
|
36
|
+
@additional_properties.setter
|
|
37
|
+
def additional_properties(self, value):
|
|
38
|
+
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
|
|
39
|
+
|
|
40
|
+
@model_serializer(mode="wrap")
|
|
41
|
+
def serialize_model(self, handler):
|
|
42
|
+
optional_fields = [
|
|
43
|
+
"prompt_tokens",
|
|
44
|
+
"completion_tokens",
|
|
45
|
+
"total_tokens",
|
|
46
|
+
"prompt_audio_seconds",
|
|
47
|
+
]
|
|
48
|
+
nullable_fields = ["prompt_audio_seconds"]
|
|
49
|
+
null_default_fields = []
|
|
50
|
+
|
|
51
|
+
serialized = handler(self)
|
|
52
|
+
|
|
53
|
+
m = {}
|
|
54
|
+
|
|
55
|
+
for n, f in type(self).model_fields.items():
|
|
56
|
+
k = f.alias or n
|
|
57
|
+
val = serialized.get(k)
|
|
58
|
+
serialized.pop(k, None)
|
|
59
|
+
|
|
60
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
61
|
+
is_set = (
|
|
62
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
63
|
+
or k in null_default_fields
|
|
64
|
+
) # pylint: disable=no-member
|
|
65
|
+
|
|
66
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
67
|
+
m[k] = val
|
|
68
|
+
elif val != UNSET_SENTINEL and (
|
|
69
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
70
|
+
):
|
|
71
|
+
m[k] = val
|
|
72
|
+
|
|
73
|
+
for k, v in serialized.items():
|
|
74
|
+
m[k] = v
|
|
75
|
+
|
|
76
|
+
return m
|
mistralai/sdk.py
CHANGED
|
@@ -15,6 +15,7 @@ import weakref
|
|
|
15
15
|
|
|
16
16
|
if TYPE_CHECKING:
|
|
17
17
|
from mistralai.agents import Agents
|
|
18
|
+
from mistralai.audio import Audio
|
|
18
19
|
from mistralai.batch import Batch
|
|
19
20
|
from mistralai.beta import Beta
|
|
20
21
|
from mistralai.chat import Chat
|
|
@@ -49,6 +50,7 @@ class Mistral(BaseSDK):
|
|
|
49
50
|
r"""Classifiers API."""
|
|
50
51
|
ocr: "Ocr"
|
|
51
52
|
r"""OCR API"""
|
|
53
|
+
audio: "Audio"
|
|
52
54
|
_sub_sdk_map = {
|
|
53
55
|
"models": ("mistralai.models_", "Models"),
|
|
54
56
|
"beta": ("mistralai.beta", "Beta"),
|
|
@@ -61,6 +63,7 @@ class Mistral(BaseSDK):
|
|
|
61
63
|
"embeddings": ("mistralai.embeddings", "Embeddings"),
|
|
62
64
|
"classifiers": ("mistralai.classifiers", "Classifiers"),
|
|
63
65
|
"ocr": ("mistralai.ocr", "Ocr"),
|
|
66
|
+
"audio": ("mistralai.audio", "Audio"),
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
def __init__(
|