mistralai 1.9.2__py3-none-any.whl → 1.9.6__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 +2 -0
- mistralai/audio.py +18 -0
- mistralai/beta.py +1 -1
- mistralai/conversations.py +2 -2
- mistralai/documents.py +2 -0
- mistralai/libraries.py +3 -1
- mistralai/mistral_jobs.py +14 -2
- mistralai/models/__init__.py +125 -2
- mistralai/models/audiochunk.py +20 -0
- mistralai/models/audiotranscriptionrequest.py +97 -0
- mistralai/models/audiotranscriptionrequeststream.py +97 -0
- mistralai/models/basemodelcard.py +3 -3
- 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/fileschema.py +8 -2
- mistralai/models/jobs_api_routes_batch_get_batch_jobsop.py +8 -1
- mistralai/models/messageoutputcontentchunks.py +8 -1
- mistralai/models/outputcontentchunks.py +8 -1
- mistralai/models/retrievefileout.py +8 -2
- mistralai/models/thinkchunk.py +35 -0
- mistralai/models/timestampgranularity.py +7 -0
- 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.2.dist-info → mistralai-1.9.6.dist-info}/METADATA +11 -1
- {mistralai-1.9.2.dist-info → mistralai-1.9.6.dist-info}/RECORD +42 -28
- mistralai/version.py +0 -7
- {mistralai-1.9.2.dist-info → mistralai-1.9.6.dist-info}/LICENSE +0 -0
- {mistralai-1.9.2.dist-info → mistralai-1.9.6.dist-info}/WHEEL +0 -0
mistralai/models/batchjobout.py
CHANGED
|
@@ -16,7 +16,6 @@ class BatchJobOutTypedDict(TypedDict):
|
|
|
16
16
|
id: str
|
|
17
17
|
input_files: List[str]
|
|
18
18
|
endpoint: str
|
|
19
|
-
model: str
|
|
20
19
|
errors: List[BatchErrorTypedDict]
|
|
21
20
|
status: BatchJobStatus
|
|
22
21
|
created_at: int
|
|
@@ -26,6 +25,8 @@ class BatchJobOutTypedDict(TypedDict):
|
|
|
26
25
|
failed_requests: int
|
|
27
26
|
object: NotRequired[BatchJobOutObject]
|
|
28
27
|
metadata: NotRequired[Nullable[Dict[str, Any]]]
|
|
28
|
+
model: NotRequired[Nullable[str]]
|
|
29
|
+
agent_id: NotRequired[Nullable[str]]
|
|
29
30
|
output_file: NotRequired[Nullable[str]]
|
|
30
31
|
error_file: NotRequired[Nullable[str]]
|
|
31
32
|
started_at: NotRequired[Nullable[int]]
|
|
@@ -39,8 +40,6 @@ class BatchJobOut(BaseModel):
|
|
|
39
40
|
|
|
40
41
|
endpoint: str
|
|
41
42
|
|
|
42
|
-
model: str
|
|
43
|
-
|
|
44
43
|
errors: List[BatchError]
|
|
45
44
|
|
|
46
45
|
status: BatchJobStatus
|
|
@@ -59,6 +58,10 @@ class BatchJobOut(BaseModel):
|
|
|
59
58
|
|
|
60
59
|
metadata: OptionalNullable[Dict[str, Any]] = UNSET
|
|
61
60
|
|
|
61
|
+
model: OptionalNullable[str] = UNSET
|
|
62
|
+
|
|
63
|
+
agent_id: OptionalNullable[str] = UNSET
|
|
64
|
+
|
|
62
65
|
output_file: OptionalNullable[str] = UNSET
|
|
63
66
|
|
|
64
67
|
error_file: OptionalNullable[str] = UNSET
|
|
@@ -72,6 +75,8 @@ class BatchJobOut(BaseModel):
|
|
|
72
75
|
optional_fields = [
|
|
73
76
|
"object",
|
|
74
77
|
"metadata",
|
|
78
|
+
"model",
|
|
79
|
+
"agent_id",
|
|
75
80
|
"output_file",
|
|
76
81
|
"error_file",
|
|
77
82
|
"started_at",
|
|
@@ -79,6 +84,8 @@ class BatchJobOut(BaseModel):
|
|
|
79
84
|
]
|
|
80
85
|
nullable_fields = [
|
|
81
86
|
"metadata",
|
|
87
|
+
"model",
|
|
88
|
+
"agent_id",
|
|
82
89
|
"output_file",
|
|
83
90
|
"error_file",
|
|
84
91
|
"started_at",
|
|
@@ -21,7 +21,9 @@ class ClassifierFTModelOutTypedDict(TypedDict):
|
|
|
21
21
|
id: str
|
|
22
22
|
created: int
|
|
23
23
|
owned_by: str
|
|
24
|
+
workspace_id: str
|
|
24
25
|
root: str
|
|
26
|
+
root_version: str
|
|
25
27
|
archived: bool
|
|
26
28
|
capabilities: FTModelCapabilitiesOutTypedDict
|
|
27
29
|
job: str
|
|
@@ -41,8 +43,12 @@ class ClassifierFTModelOut(BaseModel):
|
|
|
41
43
|
|
|
42
44
|
owned_by: str
|
|
43
45
|
|
|
46
|
+
workspace_id: str
|
|
47
|
+
|
|
44
48
|
root: str
|
|
45
49
|
|
|
50
|
+
root_version: str
|
|
51
|
+
|
|
46
52
|
archived: bool
|
|
47
53
|
|
|
48
54
|
capabilities: FTModelCapabilitiesOut
|
|
@@ -17,7 +17,7 @@ class CompletionArgsTypedDict(TypedDict):
|
|
|
17
17
|
stop: NotRequired[Nullable[CompletionArgsStopTypedDict]]
|
|
18
18
|
presence_penalty: NotRequired[Nullable[float]]
|
|
19
19
|
frequency_penalty: NotRequired[Nullable[float]]
|
|
20
|
-
temperature: NotRequired[float]
|
|
20
|
+
temperature: NotRequired[Nullable[float]]
|
|
21
21
|
top_p: NotRequired[Nullable[float]]
|
|
22
22
|
max_tokens: NotRequired[Nullable[int]]
|
|
23
23
|
random_seed: NotRequired[Nullable[int]]
|
|
@@ -35,7 +35,7 @@ class CompletionArgs(BaseModel):
|
|
|
35
35
|
|
|
36
36
|
frequency_penalty: OptionalNullable[float] = UNSET
|
|
37
37
|
|
|
38
|
-
temperature:
|
|
38
|
+
temperature: OptionalNullable[float] = UNSET
|
|
39
39
|
|
|
40
40
|
top_p: OptionalNullable[float] = UNSET
|
|
41
41
|
|
|
@@ -67,6 +67,7 @@ class CompletionArgs(BaseModel):
|
|
|
67
67
|
"stop",
|
|
68
68
|
"presence_penalty",
|
|
69
69
|
"frequency_penalty",
|
|
70
|
+
"temperature",
|
|
70
71
|
"top_p",
|
|
71
72
|
"max_tokens",
|
|
72
73
|
"random_seed",
|
|
@@ -20,7 +20,9 @@ class CompletionFTModelOutTypedDict(TypedDict):
|
|
|
20
20
|
id: str
|
|
21
21
|
created: int
|
|
22
22
|
owned_by: str
|
|
23
|
+
workspace_id: str
|
|
23
24
|
root: str
|
|
25
|
+
root_version: str
|
|
24
26
|
archived: bool
|
|
25
27
|
capabilities: FTModelCapabilitiesOutTypedDict
|
|
26
28
|
job: str
|
|
@@ -39,8 +41,12 @@ class CompletionFTModelOut(BaseModel):
|
|
|
39
41
|
|
|
40
42
|
owned_by: str
|
|
41
43
|
|
|
44
|
+
workspace_id: str
|
|
45
|
+
|
|
42
46
|
root: str
|
|
43
47
|
|
|
48
|
+
root_version: str
|
|
49
|
+
|
|
44
50
|
archived: bool
|
|
45
51
|
|
|
46
52
|
capabilities: FTModelCapabilitiesOut
|
mistralai/models/contentchunk.py
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .audiochunk import AudioChunk, AudioChunkTypedDict
|
|
4
5
|
from .documenturlchunk import DocumentURLChunk, DocumentURLChunkTypedDict
|
|
5
6
|
from .filechunk import FileChunk, FileChunkTypedDict
|
|
6
7
|
from .imageurlchunk import ImageURLChunk, ImageURLChunkTypedDict
|
|
7
8
|
from .referencechunk import ReferenceChunk, ReferenceChunkTypedDict
|
|
8
9
|
from .textchunk import TextChunk, TextChunkTypedDict
|
|
10
|
+
from .thinkchunk import ThinkChunk, ThinkChunkTypedDict
|
|
9
11
|
from mistralai.utils import get_discriminator
|
|
10
12
|
from pydantic import Discriminator, Tag
|
|
11
13
|
from typing import Union
|
|
@@ -19,7 +21,9 @@ ContentChunkTypedDict = TypeAliasType(
|
|
|
19
21
|
ImageURLChunkTypedDict,
|
|
20
22
|
ReferenceChunkTypedDict,
|
|
21
23
|
FileChunkTypedDict,
|
|
24
|
+
AudioChunkTypedDict,
|
|
22
25
|
DocumentURLChunkTypedDict,
|
|
26
|
+
ThinkChunkTypedDict,
|
|
23
27
|
],
|
|
24
28
|
)
|
|
25
29
|
|
|
@@ -31,6 +35,8 @@ ContentChunk = Annotated[
|
|
|
31
35
|
Annotated[TextChunk, Tag("text")],
|
|
32
36
|
Annotated[ReferenceChunk, Tag("reference")],
|
|
33
37
|
Annotated[FileChunk, Tag("file")],
|
|
38
|
+
Annotated[ThinkChunk, Tag("thinking")],
|
|
39
|
+
Annotated[AudioChunk, Tag("input_audio")],
|
|
34
40
|
],
|
|
35
41
|
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
|
36
42
|
]
|
mistralai/models/fileschema.py
CHANGED
|
@@ -27,6 +27,8 @@ class FileSchemaTypedDict(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 FileSchema(BaseModel):
|
|
@@ -53,10 +55,14 @@ class FileSchema(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)
|
|
@@ -14,6 +14,7 @@ class JobsAPIRoutesBatchGetBatchJobsRequestTypedDict(TypedDict):
|
|
|
14
14
|
page: NotRequired[int]
|
|
15
15
|
page_size: NotRequired[int]
|
|
16
16
|
model: NotRequired[Nullable[str]]
|
|
17
|
+
agent_id: NotRequired[Nullable[str]]
|
|
17
18
|
metadata: NotRequired[Nullable[Dict[str, Any]]]
|
|
18
19
|
created_after: NotRequired[Nullable[datetime]]
|
|
19
20
|
created_by_me: NotRequired[bool]
|
|
@@ -36,6 +37,11 @@ class JobsAPIRoutesBatchGetBatchJobsRequest(BaseModel):
|
|
|
36
37
|
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
37
38
|
] = UNSET
|
|
38
39
|
|
|
40
|
+
agent_id: Annotated[
|
|
41
|
+
OptionalNullable[str],
|
|
42
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
43
|
+
] = UNSET
|
|
44
|
+
|
|
39
45
|
metadata: Annotated[
|
|
40
46
|
OptionalNullable[Dict[str, Any]],
|
|
41
47
|
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
@@ -62,12 +68,13 @@ class JobsAPIRoutesBatchGetBatchJobsRequest(BaseModel):
|
|
|
62
68
|
"page",
|
|
63
69
|
"page_size",
|
|
64
70
|
"model",
|
|
71
|
+
"agent_id",
|
|
65
72
|
"metadata",
|
|
66
73
|
"created_after",
|
|
67
74
|
"created_by_me",
|
|
68
75
|
"status",
|
|
69
76
|
]
|
|
70
|
-
nullable_fields = ["model", "metadata", "created_after", "status"]
|
|
77
|
+
nullable_fields = ["model", "agent_id", "metadata", "created_after", "status"]
|
|
71
78
|
null_default_fields = []
|
|
72
79
|
|
|
73
80
|
serialized = handler(self)
|
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
from .documenturlchunk import DocumentURLChunk, DocumentURLChunkTypedDict
|
|
5
5
|
from .imageurlchunk import ImageURLChunk, ImageURLChunkTypedDict
|
|
6
6
|
from .textchunk import TextChunk, TextChunkTypedDict
|
|
7
|
+
from .thinkchunk import ThinkChunk, ThinkChunkTypedDict
|
|
7
8
|
from .toolfilechunk import ToolFileChunk, ToolFileChunkTypedDict
|
|
8
9
|
from .toolreferencechunk import ToolReferenceChunk, ToolReferenceChunkTypedDict
|
|
9
10
|
from typing import Union
|
|
@@ -16,6 +17,7 @@ MessageOutputContentChunksTypedDict = TypeAliasType(
|
|
|
16
17
|
TextChunkTypedDict,
|
|
17
18
|
ImageURLChunkTypedDict,
|
|
18
19
|
DocumentURLChunkTypedDict,
|
|
20
|
+
ThinkChunkTypedDict,
|
|
19
21
|
ToolFileChunkTypedDict,
|
|
20
22
|
ToolReferenceChunkTypedDict,
|
|
21
23
|
],
|
|
@@ -25,6 +27,11 @@ MessageOutputContentChunksTypedDict = TypeAliasType(
|
|
|
25
27
|
MessageOutputContentChunks = TypeAliasType(
|
|
26
28
|
"MessageOutputContentChunks",
|
|
27
29
|
Union[
|
|
28
|
-
TextChunk,
|
|
30
|
+
TextChunk,
|
|
31
|
+
ImageURLChunk,
|
|
32
|
+
DocumentURLChunk,
|
|
33
|
+
ThinkChunk,
|
|
34
|
+
ToolFileChunk,
|
|
35
|
+
ToolReferenceChunk,
|
|
29
36
|
],
|
|
30
37
|
)
|
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
from .documenturlchunk import DocumentURLChunk, DocumentURLChunkTypedDict
|
|
5
5
|
from .imageurlchunk import ImageURLChunk, ImageURLChunkTypedDict
|
|
6
6
|
from .textchunk import TextChunk, TextChunkTypedDict
|
|
7
|
+
from .thinkchunk import ThinkChunk, ThinkChunkTypedDict
|
|
7
8
|
from .toolfilechunk import ToolFileChunk, ToolFileChunkTypedDict
|
|
8
9
|
from .toolreferencechunk import ToolReferenceChunk, ToolReferenceChunkTypedDict
|
|
9
10
|
from typing import Union
|
|
@@ -16,6 +17,7 @@ OutputContentChunksTypedDict = TypeAliasType(
|
|
|
16
17
|
TextChunkTypedDict,
|
|
17
18
|
ImageURLChunkTypedDict,
|
|
18
19
|
DocumentURLChunkTypedDict,
|
|
20
|
+
ThinkChunkTypedDict,
|
|
19
21
|
ToolFileChunkTypedDict,
|
|
20
22
|
ToolReferenceChunkTypedDict,
|
|
21
23
|
],
|
|
@@ -25,6 +27,11 @@ OutputContentChunksTypedDict = TypeAliasType(
|
|
|
25
27
|
OutputContentChunks = TypeAliasType(
|
|
26
28
|
"OutputContentChunks",
|
|
27
29
|
Union[
|
|
28
|
-
TextChunk,
|
|
30
|
+
TextChunk,
|
|
31
|
+
ImageURLChunk,
|
|
32
|
+
DocumentURLChunk,
|
|
33
|
+
ThinkChunk,
|
|
34
|
+
ToolFileChunk,
|
|
35
|
+
ToolReferenceChunk,
|
|
29
36
|
],
|
|
30
37
|
)
|
|
@@ -28,6 +28,8 @@ class RetrieveFileOutTypedDict(TypedDict):
|
|
|
28
28
|
source: Source
|
|
29
29
|
deleted: bool
|
|
30
30
|
num_lines: NotRequired[Nullable[int]]
|
|
31
|
+
mimetype: NotRequired[Nullable[str]]
|
|
32
|
+
signature: NotRequired[Nullable[str]]
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
class RetrieveFileOut(BaseModel):
|
|
@@ -56,10 +58,14 @@ class RetrieveFileOut(BaseModel):
|
|
|
56
58
|
|
|
57
59
|
num_lines: OptionalNullable[int] = UNSET
|
|
58
60
|
|
|
61
|
+
mimetype: OptionalNullable[str] = UNSET
|
|
62
|
+
|
|
63
|
+
signature: OptionalNullable[str] = UNSET
|
|
64
|
+
|
|
59
65
|
@model_serializer(mode="wrap")
|
|
60
66
|
def serialize_model(self, handler):
|
|
61
|
-
optional_fields = ["num_lines"]
|
|
62
|
-
nullable_fields = ["num_lines"]
|
|
67
|
+
optional_fields = ["num_lines", "mimetype", "signature"]
|
|
68
|
+
nullable_fields = ["num_lines", "mimetype", "signature"]
|
|
63
69
|
null_default_fields = []
|
|
64
70
|
|
|
65
71
|
serialized = handler(self)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .referencechunk import ReferenceChunk, ReferenceChunkTypedDict
|
|
5
|
+
from .textchunk import TextChunk, TextChunkTypedDict
|
|
6
|
+
from mistralai.types import BaseModel
|
|
7
|
+
from typing import List, Literal, Optional, Union
|
|
8
|
+
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
ThinkingTypedDict = TypeAliasType(
|
|
12
|
+
"ThinkingTypedDict", Union[ReferenceChunkTypedDict, TextChunkTypedDict]
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Thinking = TypeAliasType("Thinking", Union[ReferenceChunk, TextChunk])
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
ThinkChunkType = Literal["thinking"]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ThinkChunkTypedDict(TypedDict):
|
|
23
|
+
thinking: List[ThinkingTypedDict]
|
|
24
|
+
closed: NotRequired[bool]
|
|
25
|
+
r"""Whether the thinking chunk is closed or not. Currently only used for prefixing."""
|
|
26
|
+
type: NotRequired[ThinkChunkType]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class ThinkChunk(BaseModel):
|
|
30
|
+
thinking: List[Thinking]
|
|
31
|
+
|
|
32
|
+
closed: Optional[bool] = None
|
|
33
|
+
r"""Whether the thinking chunk is closed or not. Currently only used for prefixing."""
|
|
34
|
+
|
|
35
|
+
type: Optional[ThinkChunkType] = "thinking"
|
|
@@ -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]
|