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,47 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
5
|
+
from pydantic import model_serializer
|
|
6
|
+
from typing_extensions import NotRequired, TypedDict
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class LibraryInUpdateTypedDict(TypedDict):
|
|
10
|
+
name: NotRequired[Nullable[str]]
|
|
11
|
+
description: NotRequired[Nullable[str]]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class LibraryInUpdate(BaseModel):
|
|
15
|
+
name: OptionalNullable[str] = UNSET
|
|
16
|
+
|
|
17
|
+
description: OptionalNullable[str] = UNSET
|
|
18
|
+
|
|
19
|
+
@model_serializer(mode="wrap")
|
|
20
|
+
def serialize_model(self, handler):
|
|
21
|
+
optional_fields = ["name", "description"]
|
|
22
|
+
nullable_fields = ["name", "description"]
|
|
23
|
+
null_default_fields = []
|
|
24
|
+
|
|
25
|
+
serialized = handler(self)
|
|
26
|
+
|
|
27
|
+
m = {}
|
|
28
|
+
|
|
29
|
+
for n, f in type(self).model_fields.items():
|
|
30
|
+
k = f.alias or n
|
|
31
|
+
val = serialized.get(k)
|
|
32
|
+
serialized.pop(k, None)
|
|
33
|
+
|
|
34
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
35
|
+
is_set = (
|
|
36
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
37
|
+
or k in null_default_fields
|
|
38
|
+
) # pylint: disable=no-member
|
|
39
|
+
|
|
40
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
41
|
+
m[k] = val
|
|
42
|
+
elif val != UNSET_SENTINEL and (
|
|
43
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
44
|
+
):
|
|
45
|
+
m[k] = val
|
|
46
|
+
|
|
47
|
+
return m
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
6
|
+
from pydantic import model_serializer
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class LibraryOutTypedDict(TypedDict):
|
|
11
|
+
id: str
|
|
12
|
+
name: str
|
|
13
|
+
created_at: datetime
|
|
14
|
+
updated_at: datetime
|
|
15
|
+
owner_id: str
|
|
16
|
+
owner_type: str
|
|
17
|
+
total_size: int
|
|
18
|
+
nb_documents: int
|
|
19
|
+
chunk_size: Nullable[int]
|
|
20
|
+
emoji: NotRequired[Nullable[str]]
|
|
21
|
+
description: NotRequired[Nullable[str]]
|
|
22
|
+
generated_name: NotRequired[Nullable[str]]
|
|
23
|
+
generated_description: NotRequired[Nullable[str]]
|
|
24
|
+
explicit_user_members_count: NotRequired[Nullable[int]]
|
|
25
|
+
explicit_workspace_members_count: NotRequired[Nullable[int]]
|
|
26
|
+
org_sharing_role: NotRequired[Nullable[str]]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class LibraryOut(BaseModel):
|
|
30
|
+
id: str
|
|
31
|
+
|
|
32
|
+
name: str
|
|
33
|
+
|
|
34
|
+
created_at: datetime
|
|
35
|
+
|
|
36
|
+
updated_at: datetime
|
|
37
|
+
|
|
38
|
+
owner_id: str
|
|
39
|
+
|
|
40
|
+
owner_type: str
|
|
41
|
+
|
|
42
|
+
total_size: int
|
|
43
|
+
|
|
44
|
+
nb_documents: int
|
|
45
|
+
|
|
46
|
+
chunk_size: Nullable[int]
|
|
47
|
+
|
|
48
|
+
emoji: OptionalNullable[str] = UNSET
|
|
49
|
+
|
|
50
|
+
description: OptionalNullable[str] = UNSET
|
|
51
|
+
|
|
52
|
+
generated_name: OptionalNullable[str] = UNSET
|
|
53
|
+
|
|
54
|
+
generated_description: OptionalNullable[str] = UNSET
|
|
55
|
+
|
|
56
|
+
explicit_user_members_count: OptionalNullable[int] = UNSET
|
|
57
|
+
|
|
58
|
+
explicit_workspace_members_count: OptionalNullable[int] = UNSET
|
|
59
|
+
|
|
60
|
+
org_sharing_role: OptionalNullable[str] = UNSET
|
|
61
|
+
|
|
62
|
+
@model_serializer(mode="wrap")
|
|
63
|
+
def serialize_model(self, handler):
|
|
64
|
+
optional_fields = [
|
|
65
|
+
"emoji",
|
|
66
|
+
"description",
|
|
67
|
+
"generated_name",
|
|
68
|
+
"generated_description",
|
|
69
|
+
"explicit_user_members_count",
|
|
70
|
+
"explicit_workspace_members_count",
|
|
71
|
+
"org_sharing_role",
|
|
72
|
+
]
|
|
73
|
+
nullable_fields = [
|
|
74
|
+
"chunk_size",
|
|
75
|
+
"emoji",
|
|
76
|
+
"description",
|
|
77
|
+
"generated_name",
|
|
78
|
+
"generated_description",
|
|
79
|
+
"explicit_user_members_count",
|
|
80
|
+
"explicit_workspace_members_count",
|
|
81
|
+
"org_sharing_role",
|
|
82
|
+
]
|
|
83
|
+
null_default_fields = []
|
|
84
|
+
|
|
85
|
+
serialized = handler(self)
|
|
86
|
+
|
|
87
|
+
m = {}
|
|
88
|
+
|
|
89
|
+
for n, f in type(self).model_fields.items():
|
|
90
|
+
k = f.alias or n
|
|
91
|
+
val = serialized.get(k)
|
|
92
|
+
serialized.pop(k, None)
|
|
93
|
+
|
|
94
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
95
|
+
is_set = (
|
|
96
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
97
|
+
or k in null_default_fields
|
|
98
|
+
) # pylint: disable=no-member
|
|
99
|
+
|
|
100
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
101
|
+
m[k] = val
|
|
102
|
+
elif val != UNSET_SENTINEL and (
|
|
103
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
104
|
+
):
|
|
105
|
+
m[k] = val
|
|
106
|
+
|
|
107
|
+
return m
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .documentout import DocumentOut, DocumentOutTypedDict
|
|
5
|
+
from .paginationinfo import PaginationInfo, PaginationInfoTypedDict
|
|
6
|
+
from mistralai.types import BaseModel
|
|
7
|
+
from typing import List
|
|
8
|
+
from typing_extensions import TypedDict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ListDocumentOutTypedDict(TypedDict):
|
|
12
|
+
pagination: PaginationInfoTypedDict
|
|
13
|
+
data: List[DocumentOutTypedDict]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ListDocumentOut(BaseModel):
|
|
17
|
+
pagination: PaginationInfo
|
|
18
|
+
|
|
19
|
+
data: List[DocumentOut]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .libraryout import LibraryOut, LibraryOutTypedDict
|
|
5
|
+
from mistralai.types import BaseModel
|
|
6
|
+
from typing import List
|
|
7
|
+
from typing_extensions import TypedDict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ListLibraryOutTypedDict(TypedDict):
|
|
11
|
+
data: List[LibraryOutTypedDict]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ListLibraryOut(BaseModel):
|
|
15
|
+
data: List[LibraryOut]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .sharingout import SharingOut, SharingOutTypedDict
|
|
5
|
+
from mistralai.types import BaseModel
|
|
6
|
+
from typing import List
|
|
7
|
+
from typing_extensions import TypedDict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ListSharingOutTypedDict(TypedDict):
|
|
11
|
+
data: List[SharingOutTypedDict]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ListSharingOut(BaseModel):
|
|
15
|
+
data: List[SharingOut]
|
|
@@ -14,7 +14,7 @@ from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
|
|
14
14
|
|
|
15
15
|
Object = Literal["entry"]
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
MessageInputEntryType = Literal["message.input"]
|
|
18
18
|
|
|
19
19
|
MessageInputEntryRole = Literal["assistant", "user"]
|
|
20
20
|
|
|
@@ -35,10 +35,11 @@ class MessageInputEntryTypedDict(TypedDict):
|
|
|
35
35
|
role: MessageInputEntryRole
|
|
36
36
|
content: MessageInputEntryContentTypedDict
|
|
37
37
|
object: NotRequired[Object]
|
|
38
|
-
type: NotRequired[
|
|
38
|
+
type: NotRequired[MessageInputEntryType]
|
|
39
39
|
created_at: NotRequired[datetime]
|
|
40
40
|
completed_at: NotRequired[Nullable[datetime]]
|
|
41
41
|
id: NotRequired[str]
|
|
42
|
+
prefix: NotRequired[bool]
|
|
42
43
|
|
|
43
44
|
|
|
44
45
|
class MessageInputEntry(BaseModel):
|
|
@@ -50,7 +51,7 @@ class MessageInputEntry(BaseModel):
|
|
|
50
51
|
|
|
51
52
|
object: Optional[Object] = "entry"
|
|
52
53
|
|
|
53
|
-
type: Optional[
|
|
54
|
+
type: Optional[MessageInputEntryType] = "message.input"
|
|
54
55
|
|
|
55
56
|
created_at: Optional[datetime] = None
|
|
56
57
|
|
|
@@ -58,9 +59,18 @@ class MessageInputEntry(BaseModel):
|
|
|
58
59
|
|
|
59
60
|
id: Optional[str] = None
|
|
60
61
|
|
|
62
|
+
prefix: Optional[bool] = False
|
|
63
|
+
|
|
61
64
|
@model_serializer(mode="wrap")
|
|
62
65
|
def serialize_model(self, handler):
|
|
63
|
-
optional_fields = [
|
|
66
|
+
optional_fields = [
|
|
67
|
+
"object",
|
|
68
|
+
"type",
|
|
69
|
+
"created_at",
|
|
70
|
+
"completed_at",
|
|
71
|
+
"id",
|
|
72
|
+
"prefix",
|
|
73
|
+
]
|
|
64
74
|
nullable_fields = ["completed_at"]
|
|
65
75
|
null_default_fields = []
|
|
66
76
|
|
|
@@ -0,0 +1,25 @@
|
|
|
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 typing_extensions import TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class PaginationInfoTypedDict(TypedDict):
|
|
9
|
+
total_items: int
|
|
10
|
+
total_pages: int
|
|
11
|
+
current_page: int
|
|
12
|
+
page_size: int
|
|
13
|
+
has_more: bool
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class PaginationInfo(BaseModel):
|
|
17
|
+
total_items: int
|
|
18
|
+
|
|
19
|
+
total_pages: int
|
|
20
|
+
|
|
21
|
+
current_page: int
|
|
22
|
+
|
|
23
|
+
page_size: int
|
|
24
|
+
|
|
25
|
+
has_more: bool
|
|
@@ -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 typing_extensions import TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ProcessingStatusOutTypedDict(TypedDict):
|
|
9
|
+
document_id: str
|
|
10
|
+
processing_status: str
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ProcessingStatusOut(BaseModel):
|
|
14
|
+
document_id: str
|
|
15
|
+
|
|
16
|
+
processing_status: str
|
|
@@ -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,26 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .entitytype import EntityType
|
|
5
|
+
from mistralai.types import BaseModel
|
|
6
|
+
from mistralai.utils import validate_open_enum
|
|
7
|
+
from pydantic.functional_validators import PlainValidator
|
|
8
|
+
from typing_extensions import Annotated, TypedDict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SharingDeleteTypedDict(TypedDict):
|
|
12
|
+
org_id: str
|
|
13
|
+
share_with_uuid: str
|
|
14
|
+
r"""The id of the entity (user, workspace or organization) to share with"""
|
|
15
|
+
share_with_type: EntityType
|
|
16
|
+
r"""The type of entity, used to share a library."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class SharingDelete(BaseModel):
|
|
20
|
+
org_id: str
|
|
21
|
+
|
|
22
|
+
share_with_uuid: str
|
|
23
|
+
r"""The id of the entity (user, workspace or organization) to share with"""
|
|
24
|
+
|
|
25
|
+
share_with_type: Annotated[EntityType, PlainValidator(validate_open_enum(False))]
|
|
26
|
+
r"""The type of entity, used to share a library."""
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .entitytype import EntityType
|
|
5
|
+
from .shareenum import ShareEnum
|
|
6
|
+
from mistralai.types import BaseModel
|
|
7
|
+
from mistralai.utils import validate_open_enum
|
|
8
|
+
from pydantic.functional_validators import PlainValidator
|
|
9
|
+
from typing_extensions import Annotated, TypedDict
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class SharingInTypedDict(TypedDict):
|
|
13
|
+
org_id: str
|
|
14
|
+
level: ShareEnum
|
|
15
|
+
share_with_uuid: str
|
|
16
|
+
r"""The id of the entity (user, workspace or organization) to share with"""
|
|
17
|
+
share_with_type: EntityType
|
|
18
|
+
r"""The type of entity, used to share a library."""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class SharingIn(BaseModel):
|
|
22
|
+
org_id: str
|
|
23
|
+
|
|
24
|
+
level: Annotated[ShareEnum, PlainValidator(validate_open_enum(False))]
|
|
25
|
+
|
|
26
|
+
share_with_uuid: str
|
|
27
|
+
r"""The id of the entity (user, workspace or organization) to share with"""
|
|
28
|
+
|
|
29
|
+
share_with_type: Annotated[EntityType, PlainValidator(validate_open_enum(False))]
|
|
30
|
+
r"""The type of entity, used to share a library."""
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
5
|
+
from pydantic import model_serializer
|
|
6
|
+
from typing_extensions import NotRequired, TypedDict
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SharingOutTypedDict(TypedDict):
|
|
10
|
+
library_id: str
|
|
11
|
+
org_id: str
|
|
12
|
+
role: str
|
|
13
|
+
share_with_type: str
|
|
14
|
+
share_with_uuid: str
|
|
15
|
+
user_id: NotRequired[Nullable[str]]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class SharingOut(BaseModel):
|
|
19
|
+
library_id: str
|
|
20
|
+
|
|
21
|
+
org_id: str
|
|
22
|
+
|
|
23
|
+
role: str
|
|
24
|
+
|
|
25
|
+
share_with_type: str
|
|
26
|
+
|
|
27
|
+
share_with_uuid: str
|
|
28
|
+
|
|
29
|
+
user_id: OptionalNullable[str] = UNSET
|
|
30
|
+
|
|
31
|
+
@model_serializer(mode="wrap")
|
|
32
|
+
def serialize_model(self, handler):
|
|
33
|
+
optional_fields = ["user_id"]
|
|
34
|
+
nullable_fields = ["user_id"]
|
|
35
|
+
null_default_fields = []
|
|
36
|
+
|
|
37
|
+
serialized = handler(self)
|
|
38
|
+
|
|
39
|
+
m = {}
|
|
40
|
+
|
|
41
|
+
for n, f in type(self).model_fields.items():
|
|
42
|
+
k = f.alias or n
|
|
43
|
+
val = serialized.get(k)
|
|
44
|
+
serialized.pop(k, None)
|
|
45
|
+
|
|
46
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
47
|
+
is_set = (
|
|
48
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
49
|
+
or k in null_default_fields
|
|
50
|
+
) # pylint: disable=no-member
|
|
51
|
+
|
|
52
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
53
|
+
m[k] = val
|
|
54
|
+
elif val != UNSET_SENTINEL and (
|
|
55
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
56
|
+
):
|
|
57
|
+
m[k] = val
|
|
58
|
+
|
|
59
|
+
return m
|
mistralai/models/ssetypes.py
CHANGED
|
@@ -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"
|
mistralai/models/toolcall.py
CHANGED
|
@@ -3,18 +3,28 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .functioncall import FunctionCall, FunctionCallTypedDict
|
|
5
5
|
from .tooltypes import ToolTypes
|
|
6
|
-
from mistralai.types import BaseModel
|
|
6
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
7
7
|
from mistralai.utils import validate_open_enum
|
|
8
|
+
from pydantic import model_serializer
|
|
8
9
|
from pydantic.functional_validators import PlainValidator
|
|
9
10
|
from typing import Optional
|
|
10
11
|
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
11
12
|
|
|
12
13
|
|
|
14
|
+
class MetadataTypedDict(TypedDict):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Metadata(BaseModel):
|
|
19
|
+
pass
|
|
20
|
+
|
|
21
|
+
|
|
13
22
|
class ToolCallTypedDict(TypedDict):
|
|
14
23
|
function: FunctionCallTypedDict
|
|
15
24
|
id: NotRequired[str]
|
|
16
25
|
type: NotRequired[ToolTypes]
|
|
17
26
|
index: NotRequired[int]
|
|
27
|
+
metadata: NotRequired[Nullable[MetadataTypedDict]]
|
|
18
28
|
|
|
19
29
|
|
|
20
30
|
class ToolCall(BaseModel):
|
|
@@ -27,3 +37,35 @@ class ToolCall(BaseModel):
|
|
|
27
37
|
)
|
|
28
38
|
|
|
29
39
|
index: Optional[int] = 0
|
|
40
|
+
|
|
41
|
+
metadata: OptionalNullable[Metadata] = UNSET
|
|
42
|
+
|
|
43
|
+
@model_serializer(mode="wrap")
|
|
44
|
+
def serialize_model(self, handler):
|
|
45
|
+
optional_fields = ["id", "type", "index", "metadata"]
|
|
46
|
+
nullable_fields = ["metadata"]
|
|
47
|
+
null_default_fields = []
|
|
48
|
+
|
|
49
|
+
serialized = handler(self)
|
|
50
|
+
|
|
51
|
+
m = {}
|
|
52
|
+
|
|
53
|
+
for n, f in type(self).model_fields.items():
|
|
54
|
+
k = f.alias or n
|
|
55
|
+
val = serialized.get(k)
|
|
56
|
+
serialized.pop(k, None)
|
|
57
|
+
|
|
58
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
59
|
+
is_set = (
|
|
60
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
61
|
+
or k in null_default_fields
|
|
62
|
+
) # pylint: disable=no-member
|
|
63
|
+
|
|
64
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
65
|
+
m[k] = val
|
|
66
|
+
elif val != UNSET_SENTINEL and (
|
|
67
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
68
|
+
):
|
|
69
|
+
m[k] = val
|
|
70
|
+
|
|
71
|
+
return m
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .builtinconnectors import BuiltInConnectors
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from mistralai.types import BaseModel
|
|
7
|
+
from typing import Literal, Optional
|
|
8
|
+
from typing_extensions import NotRequired, TypedDict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
ToolExecutionDeltaEventType = Literal["tool.execution.delta"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ToolExecutionDeltaEventTypedDict(TypedDict):
|
|
15
|
+
id: str
|
|
16
|
+
name: BuiltInConnectors
|
|
17
|
+
arguments: str
|
|
18
|
+
type: NotRequired[ToolExecutionDeltaEventType]
|
|
19
|
+
created_at: NotRequired[datetime]
|
|
20
|
+
output_index: NotRequired[int]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ToolExecutionDeltaEvent(BaseModel):
|
|
24
|
+
id: str
|
|
25
|
+
|
|
26
|
+
name: BuiltInConnectors
|
|
27
|
+
|
|
28
|
+
arguments: str
|
|
29
|
+
|
|
30
|
+
type: Optional[ToolExecutionDeltaEventType] = "tool.execution.delta"
|
|
31
|
+
|
|
32
|
+
created_at: Optional[datetime] = None
|
|
33
|
+
|
|
34
|
+
output_index: Optional[int] = 0
|
|
@@ -16,6 +16,7 @@ ToolExecutionEntryType = Literal["tool.execution"]
|
|
|
16
16
|
|
|
17
17
|
class ToolExecutionEntryTypedDict(TypedDict):
|
|
18
18
|
name: BuiltInConnectors
|
|
19
|
+
arguments: str
|
|
19
20
|
object: NotRequired[ToolExecutionEntryObject]
|
|
20
21
|
type: NotRequired[ToolExecutionEntryType]
|
|
21
22
|
created_at: NotRequired[datetime]
|
|
@@ -27,6 +28,8 @@ class ToolExecutionEntryTypedDict(TypedDict):
|
|
|
27
28
|
class ToolExecutionEntry(BaseModel):
|
|
28
29
|
name: BuiltInConnectors
|
|
29
30
|
|
|
31
|
+
arguments: str
|
|
32
|
+
|
|
30
33
|
object: Optional[ToolExecutionEntryObject] = "entry"
|
|
31
34
|
|
|
32
35
|
type: Optional[ToolExecutionEntryType] = "tool.execution"
|
|
@@ -14,6 +14,7 @@ ToolExecutionStartedEventType = Literal["tool.execution.started"]
|
|
|
14
14
|
class ToolExecutionStartedEventTypedDict(TypedDict):
|
|
15
15
|
id: str
|
|
16
16
|
name: BuiltInConnectors
|
|
17
|
+
arguments: str
|
|
17
18
|
type: NotRequired[ToolExecutionStartedEventType]
|
|
18
19
|
created_at: NotRequired[datetime]
|
|
19
20
|
output_index: NotRequired[int]
|
|
@@ -24,6 +25,8 @@ class ToolExecutionStartedEvent(BaseModel):
|
|
|
24
25
|
|
|
25
26
|
name: BuiltInConnectors
|
|
26
27
|
|
|
28
|
+
arguments: str
|
|
29
|
+
|
|
27
30
|
type: Optional[ToolExecutionStartedEventType] = "tool.execution.started"
|
|
28
31
|
|
|
29
32
|
created_at: Optional[datetime] = None
|
|
@@ -16,7 +16,8 @@ class ToolReferenceChunkTypedDict(TypedDict):
|
|
|
16
16
|
title: str
|
|
17
17
|
type: NotRequired[ToolReferenceChunkType]
|
|
18
18
|
url: NotRequired[Nullable[str]]
|
|
19
|
-
|
|
19
|
+
favicon: NotRequired[Nullable[str]]
|
|
20
|
+
description: NotRequired[Nullable[str]]
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
class ToolReferenceChunk(BaseModel):
|
|
@@ -28,12 +29,14 @@ class ToolReferenceChunk(BaseModel):
|
|
|
28
29
|
|
|
29
30
|
url: OptionalNullable[str] = UNSET
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
favicon: OptionalNullable[str] = UNSET
|
|
33
|
+
|
|
34
|
+
description: OptionalNullable[str] = UNSET
|
|
32
35
|
|
|
33
36
|
@model_serializer(mode="wrap")
|
|
34
37
|
def serialize_model(self, handler):
|
|
35
|
-
optional_fields = ["type", "url", "
|
|
36
|
-
nullable_fields = ["url", "
|
|
38
|
+
optional_fields = ["type", "url", "favicon", "description"]
|
|
39
|
+
nullable_fields = ["url", "favicon", "description"]
|
|
37
40
|
null_default_fields = []
|
|
38
41
|
|
|
39
42
|
serialized = handler(self)
|