mistralai 1.7.1__py3-none-any.whl → 1.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mistralai/_version.py +2 -2
- mistralai/beta.py +20 -0
- mistralai/conversations.py +2657 -0
- mistralai/extra/__init__.py +10 -2
- mistralai/extra/exceptions.py +14 -0
- mistralai/extra/mcp/__init__.py +0 -0
- mistralai/extra/mcp/auth.py +166 -0
- mistralai/extra/mcp/base.py +155 -0
- mistralai/extra/mcp/sse.py +165 -0
- mistralai/extra/mcp/stdio.py +22 -0
- mistralai/extra/run/__init__.py +0 -0
- mistralai/extra/run/context.py +295 -0
- mistralai/extra/run/result.py +212 -0
- mistralai/extra/run/tools.py +225 -0
- mistralai/extra/run/utils.py +36 -0
- mistralai/extra/tests/test_struct_chat.py +1 -1
- mistralai/mistral_agents.py +1158 -0
- mistralai/models/__init__.py +470 -1
- mistralai/models/agent.py +129 -0
- mistralai/models/agentconversation.py +71 -0
- mistralai/models/agentcreationrequest.py +109 -0
- mistralai/models/agenthandoffdoneevent.py +33 -0
- mistralai/models/agenthandoffentry.py +75 -0
- mistralai/models/agenthandoffstartedevent.py +33 -0
- mistralai/models/agents_api_v1_agents_getop.py +16 -0
- mistralai/models/agents_api_v1_agents_listop.py +24 -0
- mistralai/models/agents_api_v1_agents_update_versionop.py +21 -0
- mistralai/models/agents_api_v1_agents_updateop.py +23 -0
- mistralai/models/agents_api_v1_conversations_append_streamop.py +28 -0
- mistralai/models/agents_api_v1_conversations_appendop.py +28 -0
- mistralai/models/agents_api_v1_conversations_getop.py +33 -0
- mistralai/models/agents_api_v1_conversations_historyop.py +16 -0
- mistralai/models/agents_api_v1_conversations_listop.py +37 -0
- mistralai/models/agents_api_v1_conversations_messagesop.py +16 -0
- mistralai/models/agents_api_v1_conversations_restart_streamop.py +26 -0
- mistralai/models/agents_api_v1_conversations_restartop.py +26 -0
- mistralai/models/agentupdaterequest.py +111 -0
- mistralai/models/builtinconnectors.py +13 -0
- mistralai/models/codeinterpretertool.py +17 -0
- mistralai/models/completionargs.py +100 -0
- mistralai/models/completionargsstop.py +13 -0
- mistralai/models/completionjobout.py +3 -3
- mistralai/models/conversationappendrequest.py +35 -0
- mistralai/models/conversationappendstreamrequest.py +37 -0
- mistralai/models/conversationevents.py +72 -0
- mistralai/models/conversationhistory.py +58 -0
- mistralai/models/conversationinputs.py +14 -0
- mistralai/models/conversationmessages.py +28 -0
- mistralai/models/conversationrequest.py +133 -0
- mistralai/models/conversationresponse.py +51 -0
- mistralai/models/conversationrestartrequest.py +42 -0
- mistralai/models/conversationrestartstreamrequest.py +44 -0
- mistralai/models/conversationstreamrequest.py +135 -0
- mistralai/models/conversationusageinfo.py +63 -0
- mistralai/models/documentlibrarytool.py +22 -0
- mistralai/models/functioncallentry.py +76 -0
- mistralai/models/functioncallentryarguments.py +15 -0
- mistralai/models/functioncallevent.py +36 -0
- mistralai/models/functionresultentry.py +69 -0
- mistralai/models/functiontool.py +21 -0
- mistralai/models/imagegenerationtool.py +17 -0
- mistralai/models/inputentries.py +18 -0
- mistralai/models/messageentries.py +18 -0
- mistralai/models/messageinputcontentchunks.py +26 -0
- mistralai/models/messageinputentry.py +89 -0
- mistralai/models/messageoutputcontentchunks.py +30 -0
- mistralai/models/messageoutputentry.py +100 -0
- mistralai/models/messageoutputevent.py +93 -0
- mistralai/models/modelconversation.py +127 -0
- mistralai/models/outputcontentchunks.py +30 -0
- mistralai/models/responsedoneevent.py +25 -0
- mistralai/models/responseerrorevent.py +27 -0
- mistralai/models/responsestartedevent.py +24 -0
- mistralai/models/ssetypes.py +18 -0
- mistralai/models/toolexecutiondoneevent.py +34 -0
- mistralai/models/toolexecutionentry.py +70 -0
- mistralai/models/toolexecutionstartedevent.py +31 -0
- mistralai/models/toolfilechunk.py +61 -0
- mistralai/models/toolreferencechunk.py +61 -0
- mistralai/models/websearchpremiumtool.py +17 -0
- mistralai/models/websearchtool.py +17 -0
- mistralai/sdk.py +3 -0
- {mistralai-1.7.1.dist-info → mistralai-1.8.0.dist-info}/METADATA +42 -7
- {mistralai-1.7.1.dist-info → mistralai-1.8.0.dist-info}/RECORD +86 -10
- {mistralai-1.7.1.dist-info → mistralai-1.8.0.dist-info}/LICENSE +0 -0
- {mistralai-1.7.1.dist-info → mistralai-1.8.0.dist-info}/WHEEL +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 .function import Function, FunctionTypedDict
|
|
5
|
+
from mistralai.types import BaseModel
|
|
6
|
+
from typing import Literal, Optional
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
FunctionToolType = Literal["function"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class FunctionToolTypedDict(TypedDict):
|
|
14
|
+
function: FunctionTypedDict
|
|
15
|
+
type: NotRequired[FunctionToolType]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class FunctionTool(BaseModel):
|
|
19
|
+
function: Function
|
|
20
|
+
|
|
21
|
+
type: Optional[FunctionToolType] = "function"
|
|
@@ -0,0 +1,17 @@
|
|
|
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 import Literal, Optional
|
|
6
|
+
from typing_extensions import NotRequired, TypedDict
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
ImageGenerationToolType = Literal["image_generation"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ImageGenerationToolTypedDict(TypedDict):
|
|
13
|
+
type: NotRequired[ImageGenerationToolType]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ImageGenerationTool(BaseModel):
|
|
17
|
+
type: Optional[ImageGenerationToolType] = "image_generation"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .functionresultentry import FunctionResultEntry, FunctionResultEntryTypedDict
|
|
5
|
+
from .messageinputentry import MessageInputEntry, MessageInputEntryTypedDict
|
|
6
|
+
from typing import Union
|
|
7
|
+
from typing_extensions import TypeAliasType
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
InputEntriesTypedDict = TypeAliasType(
|
|
11
|
+
"InputEntriesTypedDict",
|
|
12
|
+
Union[MessageInputEntryTypedDict, FunctionResultEntryTypedDict],
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
InputEntries = TypeAliasType(
|
|
17
|
+
"InputEntries", Union[MessageInputEntry, FunctionResultEntry]
|
|
18
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .messageinputentry import MessageInputEntry, MessageInputEntryTypedDict
|
|
5
|
+
from .messageoutputentry import MessageOutputEntry, MessageOutputEntryTypedDict
|
|
6
|
+
from typing import Union
|
|
7
|
+
from typing_extensions import TypeAliasType
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
MessageEntriesTypedDict = TypeAliasType(
|
|
11
|
+
"MessageEntriesTypedDict",
|
|
12
|
+
Union[MessageInputEntryTypedDict, MessageOutputEntryTypedDict],
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
MessageEntries = TypeAliasType(
|
|
17
|
+
"MessageEntries", Union[MessageInputEntry, MessageOutputEntry]
|
|
18
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .documenturlchunk import DocumentURLChunk, DocumentURLChunkTypedDict
|
|
5
|
+
from .imageurlchunk import ImageURLChunk, ImageURLChunkTypedDict
|
|
6
|
+
from .textchunk import TextChunk, TextChunkTypedDict
|
|
7
|
+
from .toolfilechunk import ToolFileChunk, ToolFileChunkTypedDict
|
|
8
|
+
from typing import Union
|
|
9
|
+
from typing_extensions import TypeAliasType
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
MessageInputContentChunksTypedDict = TypeAliasType(
|
|
13
|
+
"MessageInputContentChunksTypedDict",
|
|
14
|
+
Union[
|
|
15
|
+
TextChunkTypedDict,
|
|
16
|
+
ImageURLChunkTypedDict,
|
|
17
|
+
DocumentURLChunkTypedDict,
|
|
18
|
+
ToolFileChunkTypedDict,
|
|
19
|
+
],
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
MessageInputContentChunks = TypeAliasType(
|
|
24
|
+
"MessageInputContentChunks",
|
|
25
|
+
Union[TextChunk, ImageURLChunk, DocumentURLChunk, ToolFileChunk],
|
|
26
|
+
)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .messageinputcontentchunks import (
|
|
5
|
+
MessageInputContentChunks,
|
|
6
|
+
MessageInputContentChunksTypedDict,
|
|
7
|
+
)
|
|
8
|
+
from datetime import datetime
|
|
9
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
10
|
+
from pydantic import model_serializer
|
|
11
|
+
from typing import List, Literal, Optional, Union
|
|
12
|
+
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
Object = Literal["entry"]
|
|
16
|
+
|
|
17
|
+
MessageInputEntryType = Literal["message.input"]
|
|
18
|
+
|
|
19
|
+
MessageInputEntryRole = Literal["assistant", "user"]
|
|
20
|
+
|
|
21
|
+
MessageInputEntryContentTypedDict = TypeAliasType(
|
|
22
|
+
"MessageInputEntryContentTypedDict",
|
|
23
|
+
Union[str, List[MessageInputContentChunksTypedDict]],
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
MessageInputEntryContent = TypeAliasType(
|
|
28
|
+
"MessageInputEntryContent", Union[str, List[MessageInputContentChunks]]
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class MessageInputEntryTypedDict(TypedDict):
|
|
33
|
+
r"""Representation of an input message inside the conversation."""
|
|
34
|
+
|
|
35
|
+
role: MessageInputEntryRole
|
|
36
|
+
content: MessageInputEntryContentTypedDict
|
|
37
|
+
object: NotRequired[Object]
|
|
38
|
+
type: NotRequired[MessageInputEntryType]
|
|
39
|
+
created_at: NotRequired[datetime]
|
|
40
|
+
completed_at: NotRequired[Nullable[datetime]]
|
|
41
|
+
id: NotRequired[str]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class MessageInputEntry(BaseModel):
|
|
45
|
+
r"""Representation of an input message inside the conversation."""
|
|
46
|
+
|
|
47
|
+
role: MessageInputEntryRole
|
|
48
|
+
|
|
49
|
+
content: MessageInputEntryContent
|
|
50
|
+
|
|
51
|
+
object: Optional[Object] = "entry"
|
|
52
|
+
|
|
53
|
+
type: Optional[MessageInputEntryType] = "message.input"
|
|
54
|
+
|
|
55
|
+
created_at: Optional[datetime] = None
|
|
56
|
+
|
|
57
|
+
completed_at: OptionalNullable[datetime] = UNSET
|
|
58
|
+
|
|
59
|
+
id: Optional[str] = None
|
|
60
|
+
|
|
61
|
+
@model_serializer(mode="wrap")
|
|
62
|
+
def serialize_model(self, handler):
|
|
63
|
+
optional_fields = ["object", "type", "created_at", "completed_at", "id"]
|
|
64
|
+
nullable_fields = ["completed_at"]
|
|
65
|
+
null_default_fields = []
|
|
66
|
+
|
|
67
|
+
serialized = handler(self)
|
|
68
|
+
|
|
69
|
+
m = {}
|
|
70
|
+
|
|
71
|
+
for n, f in self.model_fields.items():
|
|
72
|
+
k = f.alias or n
|
|
73
|
+
val = serialized.get(k)
|
|
74
|
+
serialized.pop(k, None)
|
|
75
|
+
|
|
76
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
77
|
+
is_set = (
|
|
78
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
79
|
+
or k in null_default_fields
|
|
80
|
+
) # pylint: disable=no-member
|
|
81
|
+
|
|
82
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
83
|
+
m[k] = val
|
|
84
|
+
elif val != UNSET_SENTINEL and (
|
|
85
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
86
|
+
):
|
|
87
|
+
m[k] = val
|
|
88
|
+
|
|
89
|
+
return m
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .documenturlchunk import DocumentURLChunk, DocumentURLChunkTypedDict
|
|
5
|
+
from .imageurlchunk import ImageURLChunk, ImageURLChunkTypedDict
|
|
6
|
+
from .textchunk import TextChunk, TextChunkTypedDict
|
|
7
|
+
from .toolfilechunk import ToolFileChunk, ToolFileChunkTypedDict
|
|
8
|
+
from .toolreferencechunk import ToolReferenceChunk, ToolReferenceChunkTypedDict
|
|
9
|
+
from typing import Union
|
|
10
|
+
from typing_extensions import TypeAliasType
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
MessageOutputContentChunksTypedDict = TypeAliasType(
|
|
14
|
+
"MessageOutputContentChunksTypedDict",
|
|
15
|
+
Union[
|
|
16
|
+
TextChunkTypedDict,
|
|
17
|
+
ImageURLChunkTypedDict,
|
|
18
|
+
DocumentURLChunkTypedDict,
|
|
19
|
+
ToolFileChunkTypedDict,
|
|
20
|
+
ToolReferenceChunkTypedDict,
|
|
21
|
+
],
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
MessageOutputContentChunks = TypeAliasType(
|
|
26
|
+
"MessageOutputContentChunks",
|
|
27
|
+
Union[
|
|
28
|
+
TextChunk, ImageURLChunk, DocumentURLChunk, ToolFileChunk, ToolReferenceChunk
|
|
29
|
+
],
|
|
30
|
+
)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .messageoutputcontentchunks import (
|
|
5
|
+
MessageOutputContentChunks,
|
|
6
|
+
MessageOutputContentChunksTypedDict,
|
|
7
|
+
)
|
|
8
|
+
from datetime import datetime
|
|
9
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
10
|
+
from pydantic import model_serializer
|
|
11
|
+
from typing import List, Literal, Optional, Union
|
|
12
|
+
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
MessageOutputEntryObject = Literal["entry"]
|
|
16
|
+
|
|
17
|
+
MessageOutputEntryType = Literal["message.output"]
|
|
18
|
+
|
|
19
|
+
MessageOutputEntryRole = Literal["assistant"]
|
|
20
|
+
|
|
21
|
+
MessageOutputEntryContentTypedDict = TypeAliasType(
|
|
22
|
+
"MessageOutputEntryContentTypedDict",
|
|
23
|
+
Union[str, List[MessageOutputContentChunksTypedDict]],
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
MessageOutputEntryContent = TypeAliasType(
|
|
28
|
+
"MessageOutputEntryContent", Union[str, List[MessageOutputContentChunks]]
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class MessageOutputEntryTypedDict(TypedDict):
|
|
33
|
+
content: MessageOutputEntryContentTypedDict
|
|
34
|
+
object: NotRequired[MessageOutputEntryObject]
|
|
35
|
+
type: NotRequired[MessageOutputEntryType]
|
|
36
|
+
created_at: NotRequired[datetime]
|
|
37
|
+
completed_at: NotRequired[Nullable[datetime]]
|
|
38
|
+
id: NotRequired[str]
|
|
39
|
+
agent_id: NotRequired[Nullable[str]]
|
|
40
|
+
model: NotRequired[Nullable[str]]
|
|
41
|
+
role: NotRequired[MessageOutputEntryRole]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class MessageOutputEntry(BaseModel):
|
|
45
|
+
content: MessageOutputEntryContent
|
|
46
|
+
|
|
47
|
+
object: Optional[MessageOutputEntryObject] = "entry"
|
|
48
|
+
|
|
49
|
+
type: Optional[MessageOutputEntryType] = "message.output"
|
|
50
|
+
|
|
51
|
+
created_at: Optional[datetime] = None
|
|
52
|
+
|
|
53
|
+
completed_at: OptionalNullable[datetime] = UNSET
|
|
54
|
+
|
|
55
|
+
id: Optional[str] = None
|
|
56
|
+
|
|
57
|
+
agent_id: OptionalNullable[str] = UNSET
|
|
58
|
+
|
|
59
|
+
model: OptionalNullable[str] = UNSET
|
|
60
|
+
|
|
61
|
+
role: Optional[MessageOutputEntryRole] = "assistant"
|
|
62
|
+
|
|
63
|
+
@model_serializer(mode="wrap")
|
|
64
|
+
def serialize_model(self, handler):
|
|
65
|
+
optional_fields = [
|
|
66
|
+
"object",
|
|
67
|
+
"type",
|
|
68
|
+
"created_at",
|
|
69
|
+
"completed_at",
|
|
70
|
+
"id",
|
|
71
|
+
"agent_id",
|
|
72
|
+
"model",
|
|
73
|
+
"role",
|
|
74
|
+
]
|
|
75
|
+
nullable_fields = ["completed_at", "agent_id", "model"]
|
|
76
|
+
null_default_fields = []
|
|
77
|
+
|
|
78
|
+
serialized = handler(self)
|
|
79
|
+
|
|
80
|
+
m = {}
|
|
81
|
+
|
|
82
|
+
for n, f in self.model_fields.items():
|
|
83
|
+
k = f.alias or n
|
|
84
|
+
val = serialized.get(k)
|
|
85
|
+
serialized.pop(k, None)
|
|
86
|
+
|
|
87
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
88
|
+
is_set = (
|
|
89
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
90
|
+
or k in null_default_fields
|
|
91
|
+
) # pylint: disable=no-member
|
|
92
|
+
|
|
93
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
94
|
+
m[k] = val
|
|
95
|
+
elif val != UNSET_SENTINEL and (
|
|
96
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
97
|
+
):
|
|
98
|
+
m[k] = val
|
|
99
|
+
|
|
100
|
+
return m
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .outputcontentchunks import OutputContentChunks, OutputContentChunksTypedDict
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
7
|
+
from pydantic import model_serializer
|
|
8
|
+
from typing import Literal, Optional, Union
|
|
9
|
+
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
MessageOutputEventType = Literal["message.output.delta"]
|
|
13
|
+
|
|
14
|
+
MessageOutputEventRole = Literal["assistant"]
|
|
15
|
+
|
|
16
|
+
MessageOutputEventContentTypedDict = TypeAliasType(
|
|
17
|
+
"MessageOutputEventContentTypedDict", Union[str, OutputContentChunksTypedDict]
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
MessageOutputEventContent = TypeAliasType(
|
|
22
|
+
"MessageOutputEventContent", Union[str, OutputContentChunks]
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class MessageOutputEventTypedDict(TypedDict):
|
|
27
|
+
id: str
|
|
28
|
+
content: MessageOutputEventContentTypedDict
|
|
29
|
+
type: NotRequired[MessageOutputEventType]
|
|
30
|
+
created_at: NotRequired[datetime]
|
|
31
|
+
output_index: NotRequired[int]
|
|
32
|
+
content_index: NotRequired[int]
|
|
33
|
+
model: NotRequired[Nullable[str]]
|
|
34
|
+
agent_id: NotRequired[Nullable[str]]
|
|
35
|
+
role: NotRequired[MessageOutputEventRole]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class MessageOutputEvent(BaseModel):
|
|
39
|
+
id: str
|
|
40
|
+
|
|
41
|
+
content: MessageOutputEventContent
|
|
42
|
+
|
|
43
|
+
type: Optional[MessageOutputEventType] = "message.output.delta"
|
|
44
|
+
|
|
45
|
+
created_at: Optional[datetime] = None
|
|
46
|
+
|
|
47
|
+
output_index: Optional[int] = 0
|
|
48
|
+
|
|
49
|
+
content_index: Optional[int] = 0
|
|
50
|
+
|
|
51
|
+
model: OptionalNullable[str] = UNSET
|
|
52
|
+
|
|
53
|
+
agent_id: OptionalNullable[str] = UNSET
|
|
54
|
+
|
|
55
|
+
role: Optional[MessageOutputEventRole] = "assistant"
|
|
56
|
+
|
|
57
|
+
@model_serializer(mode="wrap")
|
|
58
|
+
def serialize_model(self, handler):
|
|
59
|
+
optional_fields = [
|
|
60
|
+
"type",
|
|
61
|
+
"created_at",
|
|
62
|
+
"output_index",
|
|
63
|
+
"content_index",
|
|
64
|
+
"model",
|
|
65
|
+
"agent_id",
|
|
66
|
+
"role",
|
|
67
|
+
]
|
|
68
|
+
nullable_fields = ["model", "agent_id"]
|
|
69
|
+
null_default_fields = []
|
|
70
|
+
|
|
71
|
+
serialized = handler(self)
|
|
72
|
+
|
|
73
|
+
m = {}
|
|
74
|
+
|
|
75
|
+
for n, f in self.model_fields.items():
|
|
76
|
+
k = f.alias or n
|
|
77
|
+
val = serialized.get(k)
|
|
78
|
+
serialized.pop(k, None)
|
|
79
|
+
|
|
80
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
81
|
+
is_set = (
|
|
82
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
83
|
+
or k in null_default_fields
|
|
84
|
+
) # pylint: disable=no-member
|
|
85
|
+
|
|
86
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
87
|
+
m[k] = val
|
|
88
|
+
elif val != UNSET_SENTINEL and (
|
|
89
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
90
|
+
):
|
|
91
|
+
m[k] = val
|
|
92
|
+
|
|
93
|
+
return m
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .codeinterpretertool import CodeInterpreterTool, CodeInterpreterToolTypedDict
|
|
5
|
+
from .completionargs import CompletionArgs, CompletionArgsTypedDict
|
|
6
|
+
from .documentlibrarytool import DocumentLibraryTool, DocumentLibraryToolTypedDict
|
|
7
|
+
from .functiontool import FunctionTool, FunctionToolTypedDict
|
|
8
|
+
from .imagegenerationtool import ImageGenerationTool, ImageGenerationToolTypedDict
|
|
9
|
+
from .websearchpremiumtool import WebSearchPremiumTool, WebSearchPremiumToolTypedDict
|
|
10
|
+
from .websearchtool import WebSearchTool, WebSearchToolTypedDict
|
|
11
|
+
from datetime import datetime
|
|
12
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
13
|
+
from mistralai.utils import get_discriminator
|
|
14
|
+
from pydantic import Discriminator, Tag, model_serializer
|
|
15
|
+
from typing import List, Literal, Optional, Union
|
|
16
|
+
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
ModelConversationToolsTypedDict = TypeAliasType(
|
|
20
|
+
"ModelConversationToolsTypedDict",
|
|
21
|
+
Union[
|
|
22
|
+
WebSearchToolTypedDict,
|
|
23
|
+
WebSearchPremiumToolTypedDict,
|
|
24
|
+
CodeInterpreterToolTypedDict,
|
|
25
|
+
ImageGenerationToolTypedDict,
|
|
26
|
+
FunctionToolTypedDict,
|
|
27
|
+
DocumentLibraryToolTypedDict,
|
|
28
|
+
],
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
ModelConversationTools = Annotated[
|
|
33
|
+
Union[
|
|
34
|
+
Annotated[CodeInterpreterTool, Tag("code_interpreter")],
|
|
35
|
+
Annotated[DocumentLibraryTool, Tag("document_library")],
|
|
36
|
+
Annotated[FunctionTool, Tag("function")],
|
|
37
|
+
Annotated[ImageGenerationTool, Tag("image_generation")],
|
|
38
|
+
Annotated[WebSearchTool, Tag("web_search")],
|
|
39
|
+
Annotated[WebSearchPremiumTool, Tag("web_search_premium")],
|
|
40
|
+
],
|
|
41
|
+
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
ModelConversationObject = Literal["conversation"]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class ModelConversationTypedDict(TypedDict):
|
|
49
|
+
id: str
|
|
50
|
+
created_at: datetime
|
|
51
|
+
updated_at: datetime
|
|
52
|
+
model: str
|
|
53
|
+
instructions: NotRequired[Nullable[str]]
|
|
54
|
+
r"""Instruction prompt the model will follow during the conversation."""
|
|
55
|
+
tools: NotRequired[List[ModelConversationToolsTypedDict]]
|
|
56
|
+
r"""List of tools which are available to the model during the conversation."""
|
|
57
|
+
completion_args: NotRequired[CompletionArgsTypedDict]
|
|
58
|
+
r"""White-listed arguments from the completion API"""
|
|
59
|
+
name: NotRequired[Nullable[str]]
|
|
60
|
+
r"""Name given to the conversation."""
|
|
61
|
+
description: NotRequired[Nullable[str]]
|
|
62
|
+
r"""Description of the what the conversation is about."""
|
|
63
|
+
object: NotRequired[ModelConversationObject]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class ModelConversation(BaseModel):
|
|
67
|
+
id: str
|
|
68
|
+
|
|
69
|
+
created_at: datetime
|
|
70
|
+
|
|
71
|
+
updated_at: datetime
|
|
72
|
+
|
|
73
|
+
model: str
|
|
74
|
+
|
|
75
|
+
instructions: OptionalNullable[str] = UNSET
|
|
76
|
+
r"""Instruction prompt the model will follow during the conversation."""
|
|
77
|
+
|
|
78
|
+
tools: Optional[List[ModelConversationTools]] = None
|
|
79
|
+
r"""List of tools which are available to the model during the conversation."""
|
|
80
|
+
|
|
81
|
+
completion_args: Optional[CompletionArgs] = None
|
|
82
|
+
r"""White-listed arguments from the completion API"""
|
|
83
|
+
|
|
84
|
+
name: OptionalNullable[str] = UNSET
|
|
85
|
+
r"""Name given to the conversation."""
|
|
86
|
+
|
|
87
|
+
description: OptionalNullable[str] = UNSET
|
|
88
|
+
r"""Description of the what the conversation is about."""
|
|
89
|
+
|
|
90
|
+
object: Optional[ModelConversationObject] = "conversation"
|
|
91
|
+
|
|
92
|
+
@model_serializer(mode="wrap")
|
|
93
|
+
def serialize_model(self, handler):
|
|
94
|
+
optional_fields = [
|
|
95
|
+
"instructions",
|
|
96
|
+
"tools",
|
|
97
|
+
"completion_args",
|
|
98
|
+
"name",
|
|
99
|
+
"description",
|
|
100
|
+
"object",
|
|
101
|
+
]
|
|
102
|
+
nullable_fields = ["instructions", "name", "description"]
|
|
103
|
+
null_default_fields = []
|
|
104
|
+
|
|
105
|
+
serialized = handler(self)
|
|
106
|
+
|
|
107
|
+
m = {}
|
|
108
|
+
|
|
109
|
+
for n, f in self.model_fields.items():
|
|
110
|
+
k = f.alias or n
|
|
111
|
+
val = serialized.get(k)
|
|
112
|
+
serialized.pop(k, None)
|
|
113
|
+
|
|
114
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
115
|
+
is_set = (
|
|
116
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
117
|
+
or k in null_default_fields
|
|
118
|
+
) # pylint: disable=no-member
|
|
119
|
+
|
|
120
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
121
|
+
m[k] = val
|
|
122
|
+
elif val != UNSET_SENTINEL and (
|
|
123
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
124
|
+
):
|
|
125
|
+
m[k] = val
|
|
126
|
+
|
|
127
|
+
return m
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .documenturlchunk import DocumentURLChunk, DocumentURLChunkTypedDict
|
|
5
|
+
from .imageurlchunk import ImageURLChunk, ImageURLChunkTypedDict
|
|
6
|
+
from .textchunk import TextChunk, TextChunkTypedDict
|
|
7
|
+
from .toolfilechunk import ToolFileChunk, ToolFileChunkTypedDict
|
|
8
|
+
from .toolreferencechunk import ToolReferenceChunk, ToolReferenceChunkTypedDict
|
|
9
|
+
from typing import Union
|
|
10
|
+
from typing_extensions import TypeAliasType
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
OutputContentChunksTypedDict = TypeAliasType(
|
|
14
|
+
"OutputContentChunksTypedDict",
|
|
15
|
+
Union[
|
|
16
|
+
TextChunkTypedDict,
|
|
17
|
+
ImageURLChunkTypedDict,
|
|
18
|
+
DocumentURLChunkTypedDict,
|
|
19
|
+
ToolFileChunkTypedDict,
|
|
20
|
+
ToolReferenceChunkTypedDict,
|
|
21
|
+
],
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
OutputContentChunks = TypeAliasType(
|
|
26
|
+
"OutputContentChunks",
|
|
27
|
+
Union[
|
|
28
|
+
TextChunk, ImageURLChunk, DocumentURLChunk, ToolFileChunk, ToolReferenceChunk
|
|
29
|
+
],
|
|
30
|
+
)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .conversationusageinfo import ConversationUsageInfo, ConversationUsageInfoTypedDict
|
|
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
|
+
ResponseDoneEventType = Literal["conversation.response.done"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ResponseDoneEventTypedDict(TypedDict):
|
|
15
|
+
usage: ConversationUsageInfoTypedDict
|
|
16
|
+
type: NotRequired[ResponseDoneEventType]
|
|
17
|
+
created_at: NotRequired[datetime]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ResponseDoneEvent(BaseModel):
|
|
21
|
+
usage: ConversationUsageInfo
|
|
22
|
+
|
|
23
|
+
type: Optional[ResponseDoneEventType] = "conversation.response.done"
|
|
24
|
+
|
|
25
|
+
created_at: Optional[datetime] = None
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
|
6
|
+
from typing import Literal, Optional
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
ResponseErrorEventType = Literal["conversation.response.error"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ResponseErrorEventTypedDict(TypedDict):
|
|
14
|
+
message: str
|
|
15
|
+
code: int
|
|
16
|
+
type: NotRequired[ResponseErrorEventType]
|
|
17
|
+
created_at: NotRequired[datetime]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ResponseErrorEvent(BaseModel):
|
|
21
|
+
message: str
|
|
22
|
+
|
|
23
|
+
code: int
|
|
24
|
+
|
|
25
|
+
type: Optional[ResponseErrorEventType] = "conversation.response.error"
|
|
26
|
+
|
|
27
|
+
created_at: Optional[datetime] = None
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
|
6
|
+
from typing import Literal, Optional
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
ResponseStartedEventType = Literal["conversation.response.started"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ResponseStartedEventTypedDict(TypedDict):
|
|
14
|
+
conversation_id: str
|
|
15
|
+
type: NotRequired[ResponseStartedEventType]
|
|
16
|
+
created_at: NotRequired[datetime]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ResponseStartedEvent(BaseModel):
|
|
20
|
+
conversation_id: str
|
|
21
|
+
|
|
22
|
+
type: Optional[ResponseStartedEventType] = "conversation.response.started"
|
|
23
|
+
|
|
24
|
+
created_at: Optional[datetime] = None
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
SSETypes = Literal[
|
|
8
|
+
"conversation.response.started",
|
|
9
|
+
"conversation.response.done",
|
|
10
|
+
"conversation.response.error",
|
|
11
|
+
"message.output.delta",
|
|
12
|
+
"tool.execution.started",
|
|
13
|
+
"tool.execution.done",
|
|
14
|
+
"agent.handoff.started",
|
|
15
|
+
"agent.handoff.done",
|
|
16
|
+
"function.call.delta",
|
|
17
|
+
]
|
|
18
|
+
r"""Server side events sent when streaming a conversation response."""
|