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.
Files changed (86) hide show
  1. mistralai/_version.py +2 -2
  2. mistralai/beta.py +20 -0
  3. mistralai/conversations.py +2657 -0
  4. mistralai/extra/__init__.py +10 -2
  5. mistralai/extra/exceptions.py +14 -0
  6. mistralai/extra/mcp/__init__.py +0 -0
  7. mistralai/extra/mcp/auth.py +166 -0
  8. mistralai/extra/mcp/base.py +155 -0
  9. mistralai/extra/mcp/sse.py +165 -0
  10. mistralai/extra/mcp/stdio.py +22 -0
  11. mistralai/extra/run/__init__.py +0 -0
  12. mistralai/extra/run/context.py +295 -0
  13. mistralai/extra/run/result.py +212 -0
  14. mistralai/extra/run/tools.py +225 -0
  15. mistralai/extra/run/utils.py +36 -0
  16. mistralai/extra/tests/test_struct_chat.py +1 -1
  17. mistralai/mistral_agents.py +1158 -0
  18. mistralai/models/__init__.py +470 -1
  19. mistralai/models/agent.py +129 -0
  20. mistralai/models/agentconversation.py +71 -0
  21. mistralai/models/agentcreationrequest.py +109 -0
  22. mistralai/models/agenthandoffdoneevent.py +33 -0
  23. mistralai/models/agenthandoffentry.py +75 -0
  24. mistralai/models/agenthandoffstartedevent.py +33 -0
  25. mistralai/models/agents_api_v1_agents_getop.py +16 -0
  26. mistralai/models/agents_api_v1_agents_listop.py +24 -0
  27. mistralai/models/agents_api_v1_agents_update_versionop.py +21 -0
  28. mistralai/models/agents_api_v1_agents_updateop.py +23 -0
  29. mistralai/models/agents_api_v1_conversations_append_streamop.py +28 -0
  30. mistralai/models/agents_api_v1_conversations_appendop.py +28 -0
  31. mistralai/models/agents_api_v1_conversations_getop.py +33 -0
  32. mistralai/models/agents_api_v1_conversations_historyop.py +16 -0
  33. mistralai/models/agents_api_v1_conversations_listop.py +37 -0
  34. mistralai/models/agents_api_v1_conversations_messagesop.py +16 -0
  35. mistralai/models/agents_api_v1_conversations_restart_streamop.py +26 -0
  36. mistralai/models/agents_api_v1_conversations_restartop.py +26 -0
  37. mistralai/models/agentupdaterequest.py +111 -0
  38. mistralai/models/builtinconnectors.py +13 -0
  39. mistralai/models/codeinterpretertool.py +17 -0
  40. mistralai/models/completionargs.py +100 -0
  41. mistralai/models/completionargsstop.py +13 -0
  42. mistralai/models/completionjobout.py +3 -3
  43. mistralai/models/conversationappendrequest.py +35 -0
  44. mistralai/models/conversationappendstreamrequest.py +37 -0
  45. mistralai/models/conversationevents.py +72 -0
  46. mistralai/models/conversationhistory.py +58 -0
  47. mistralai/models/conversationinputs.py +14 -0
  48. mistralai/models/conversationmessages.py +28 -0
  49. mistralai/models/conversationrequest.py +133 -0
  50. mistralai/models/conversationresponse.py +51 -0
  51. mistralai/models/conversationrestartrequest.py +42 -0
  52. mistralai/models/conversationrestartstreamrequest.py +44 -0
  53. mistralai/models/conversationstreamrequest.py +135 -0
  54. mistralai/models/conversationusageinfo.py +63 -0
  55. mistralai/models/documentlibrarytool.py +22 -0
  56. mistralai/models/functioncallentry.py +76 -0
  57. mistralai/models/functioncallentryarguments.py +15 -0
  58. mistralai/models/functioncallevent.py +36 -0
  59. mistralai/models/functionresultentry.py +69 -0
  60. mistralai/models/functiontool.py +21 -0
  61. mistralai/models/imagegenerationtool.py +17 -0
  62. mistralai/models/inputentries.py +18 -0
  63. mistralai/models/messageentries.py +18 -0
  64. mistralai/models/messageinputcontentchunks.py +26 -0
  65. mistralai/models/messageinputentry.py +89 -0
  66. mistralai/models/messageoutputcontentchunks.py +30 -0
  67. mistralai/models/messageoutputentry.py +100 -0
  68. mistralai/models/messageoutputevent.py +93 -0
  69. mistralai/models/modelconversation.py +127 -0
  70. mistralai/models/outputcontentchunks.py +30 -0
  71. mistralai/models/responsedoneevent.py +25 -0
  72. mistralai/models/responseerrorevent.py +27 -0
  73. mistralai/models/responsestartedevent.py +24 -0
  74. mistralai/models/ssetypes.py +18 -0
  75. mistralai/models/toolexecutiondoneevent.py +34 -0
  76. mistralai/models/toolexecutionentry.py +70 -0
  77. mistralai/models/toolexecutionstartedevent.py +31 -0
  78. mistralai/models/toolfilechunk.py +61 -0
  79. mistralai/models/toolreferencechunk.py +61 -0
  80. mistralai/models/websearchpremiumtool.py +17 -0
  81. mistralai/models/websearchtool.py +17 -0
  82. mistralai/sdk.py +3 -0
  83. {mistralai-1.7.1.dist-info → mistralai-1.8.0.dist-info}/METADATA +42 -7
  84. {mistralai-1.7.1.dist-info → mistralai-1.8.0.dist-info}/RECORD +86 -10
  85. {mistralai-1.7.1.dist-info → mistralai-1.8.0.dist-info}/LICENSE +0 -0
  86. {mistralai-1.7.1.dist-info → mistralai-1.8.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,133 @@
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 .conversationinputs import ConversationInputs, ConversationInputsTypedDict
7
+ from .documentlibrarytool import DocumentLibraryTool, DocumentLibraryToolTypedDict
8
+ from .functiontool import FunctionTool, FunctionToolTypedDict
9
+ from .imagegenerationtool import ImageGenerationTool, ImageGenerationToolTypedDict
10
+ from .websearchpremiumtool import WebSearchPremiumTool, WebSearchPremiumToolTypedDict
11
+ from .websearchtool import WebSearchTool, WebSearchToolTypedDict
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
+ HandoffExecution = Literal["client", "server"]
20
+
21
+ ToolsTypedDict = TypeAliasType(
22
+ "ToolsTypedDict",
23
+ Union[
24
+ WebSearchToolTypedDict,
25
+ WebSearchPremiumToolTypedDict,
26
+ CodeInterpreterToolTypedDict,
27
+ ImageGenerationToolTypedDict,
28
+ FunctionToolTypedDict,
29
+ DocumentLibraryToolTypedDict,
30
+ ],
31
+ )
32
+
33
+
34
+ Tools = Annotated[
35
+ Union[
36
+ Annotated[CodeInterpreterTool, Tag("code_interpreter")],
37
+ Annotated[DocumentLibraryTool, Tag("document_library")],
38
+ Annotated[FunctionTool, Tag("function")],
39
+ Annotated[ImageGenerationTool, Tag("image_generation")],
40
+ Annotated[WebSearchTool, Tag("web_search")],
41
+ Annotated[WebSearchPremiumTool, Tag("web_search_premium")],
42
+ ],
43
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
44
+ ]
45
+
46
+
47
+ class ConversationRequestTypedDict(TypedDict):
48
+ inputs: ConversationInputsTypedDict
49
+ stream: NotRequired[bool]
50
+ store: NotRequired[Nullable[bool]]
51
+ handoff_execution: NotRequired[Nullable[HandoffExecution]]
52
+ instructions: NotRequired[Nullable[str]]
53
+ tools: NotRequired[Nullable[List[ToolsTypedDict]]]
54
+ completion_args: NotRequired[Nullable[CompletionArgsTypedDict]]
55
+ name: NotRequired[Nullable[str]]
56
+ description: NotRequired[Nullable[str]]
57
+ agent_id: NotRequired[Nullable[str]]
58
+ model: NotRequired[Nullable[str]]
59
+
60
+
61
+ class ConversationRequest(BaseModel):
62
+ inputs: ConversationInputs
63
+
64
+ stream: Optional[bool] = False
65
+
66
+ store: OptionalNullable[bool] = UNSET
67
+
68
+ handoff_execution: OptionalNullable[HandoffExecution] = UNSET
69
+
70
+ instructions: OptionalNullable[str] = UNSET
71
+
72
+ tools: OptionalNullable[List[Tools]] = UNSET
73
+
74
+ completion_args: OptionalNullable[CompletionArgs] = UNSET
75
+
76
+ name: OptionalNullable[str] = UNSET
77
+
78
+ description: OptionalNullable[str] = UNSET
79
+
80
+ agent_id: OptionalNullable[str] = UNSET
81
+
82
+ model: OptionalNullable[str] = UNSET
83
+
84
+ @model_serializer(mode="wrap")
85
+ def serialize_model(self, handler):
86
+ optional_fields = [
87
+ "stream",
88
+ "store",
89
+ "handoff_execution",
90
+ "instructions",
91
+ "tools",
92
+ "completion_args",
93
+ "name",
94
+ "description",
95
+ "agent_id",
96
+ "model",
97
+ ]
98
+ nullable_fields = [
99
+ "store",
100
+ "handoff_execution",
101
+ "instructions",
102
+ "tools",
103
+ "completion_args",
104
+ "name",
105
+ "description",
106
+ "agent_id",
107
+ "model",
108
+ ]
109
+ null_default_fields = []
110
+
111
+ serialized = handler(self)
112
+
113
+ m = {}
114
+
115
+ for n, f in self.model_fields.items():
116
+ k = f.alias or n
117
+ val = serialized.get(k)
118
+ serialized.pop(k, None)
119
+
120
+ optional_nullable = k in optional_fields and k in nullable_fields
121
+ is_set = (
122
+ self.__pydantic_fields_set__.intersection({n})
123
+ or k in null_default_fields
124
+ ) # pylint: disable=no-member
125
+
126
+ if val is not None and val != UNSET_SENTINEL:
127
+ m[k] = val
128
+ elif val != UNSET_SENTINEL and (
129
+ not k in optional_fields or (optional_nullable and is_set)
130
+ ):
131
+ m[k] = val
132
+
133
+ return m
@@ -0,0 +1,51 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .agenthandoffentry import AgentHandoffEntry, AgentHandoffEntryTypedDict
5
+ from .conversationusageinfo import ConversationUsageInfo, ConversationUsageInfoTypedDict
6
+ from .functioncallentry import FunctionCallEntry, FunctionCallEntryTypedDict
7
+ from .messageoutputentry import MessageOutputEntry, MessageOutputEntryTypedDict
8
+ from .toolexecutionentry import ToolExecutionEntry, ToolExecutionEntryTypedDict
9
+ from mistralai.types import BaseModel
10
+ from typing import List, Literal, Optional, Union
11
+ from typing_extensions import NotRequired, TypeAliasType, TypedDict
12
+
13
+
14
+ ConversationResponseObject = Literal["conversation.response"]
15
+
16
+ OutputsTypedDict = TypeAliasType(
17
+ "OutputsTypedDict",
18
+ Union[
19
+ ToolExecutionEntryTypedDict,
20
+ FunctionCallEntryTypedDict,
21
+ MessageOutputEntryTypedDict,
22
+ AgentHandoffEntryTypedDict,
23
+ ],
24
+ )
25
+
26
+
27
+ Outputs = TypeAliasType(
28
+ "Outputs",
29
+ Union[ToolExecutionEntry, FunctionCallEntry, MessageOutputEntry, AgentHandoffEntry],
30
+ )
31
+
32
+
33
+ class ConversationResponseTypedDict(TypedDict):
34
+ r"""The response after appending new entries to the conversation."""
35
+
36
+ conversation_id: str
37
+ outputs: List[OutputsTypedDict]
38
+ usage: ConversationUsageInfoTypedDict
39
+ object: NotRequired[ConversationResponseObject]
40
+
41
+
42
+ class ConversationResponse(BaseModel):
43
+ r"""The response after appending new entries to the conversation."""
44
+
45
+ conversation_id: str
46
+
47
+ outputs: List[Outputs]
48
+
49
+ usage: ConversationUsageInfo
50
+
51
+ object: Optional[ConversationResponseObject] = "conversation.response"
@@ -0,0 +1,42 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .completionargs import CompletionArgs, CompletionArgsTypedDict
5
+ from .conversationinputs import ConversationInputs, ConversationInputsTypedDict
6
+ from mistralai.types import BaseModel
7
+ from typing import Literal, Optional
8
+ from typing_extensions import NotRequired, TypedDict
9
+
10
+
11
+ ConversationRestartRequestHandoffExecution = Literal["client", "server"]
12
+
13
+
14
+ class ConversationRestartRequestTypedDict(TypedDict):
15
+ r"""Request to restart a new conversation from a given entry in the conversation."""
16
+
17
+ inputs: ConversationInputsTypedDict
18
+ from_entry_id: str
19
+ stream: NotRequired[bool]
20
+ store: NotRequired[bool]
21
+ r"""Whether to store the results into our servers or not."""
22
+ handoff_execution: NotRequired[ConversationRestartRequestHandoffExecution]
23
+ completion_args: NotRequired[CompletionArgsTypedDict]
24
+ r"""White-listed arguments from the completion API"""
25
+
26
+
27
+ class ConversationRestartRequest(BaseModel):
28
+ r"""Request to restart a new conversation from a given entry in the conversation."""
29
+
30
+ inputs: ConversationInputs
31
+
32
+ from_entry_id: str
33
+
34
+ stream: Optional[bool] = False
35
+
36
+ store: Optional[bool] = True
37
+ r"""Whether to store the results into our servers or not."""
38
+
39
+ handoff_execution: Optional[ConversationRestartRequestHandoffExecution] = "server"
40
+
41
+ completion_args: Optional[CompletionArgs] = None
42
+ r"""White-listed arguments from the completion API"""
@@ -0,0 +1,44 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .completionargs import CompletionArgs, CompletionArgsTypedDict
5
+ from .conversationinputs import ConversationInputs, ConversationInputsTypedDict
6
+ from mistralai.types import BaseModel
7
+ from typing import Literal, Optional
8
+ from typing_extensions import NotRequired, TypedDict
9
+
10
+
11
+ ConversationRestartStreamRequestHandoffExecution = Literal["client", "server"]
12
+
13
+
14
+ class ConversationRestartStreamRequestTypedDict(TypedDict):
15
+ r"""Request to restart a new conversation from a given entry in the conversation."""
16
+
17
+ inputs: ConversationInputsTypedDict
18
+ from_entry_id: str
19
+ stream: NotRequired[bool]
20
+ store: NotRequired[bool]
21
+ r"""Whether to store the results into our servers or not."""
22
+ handoff_execution: NotRequired[ConversationRestartStreamRequestHandoffExecution]
23
+ completion_args: NotRequired[CompletionArgsTypedDict]
24
+ r"""White-listed arguments from the completion API"""
25
+
26
+
27
+ class ConversationRestartStreamRequest(BaseModel):
28
+ r"""Request to restart a new conversation from a given entry in the conversation."""
29
+
30
+ inputs: ConversationInputs
31
+
32
+ from_entry_id: str
33
+
34
+ stream: Optional[bool] = True
35
+
36
+ store: Optional[bool] = True
37
+ r"""Whether to store the results into our servers or not."""
38
+
39
+ handoff_execution: Optional[ConversationRestartStreamRequestHandoffExecution] = (
40
+ "server"
41
+ )
42
+
43
+ completion_args: Optional[CompletionArgs] = None
44
+ r"""White-listed arguments from the completion API"""
@@ -0,0 +1,135 @@
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 .conversationinputs import ConversationInputs, ConversationInputsTypedDict
7
+ from .documentlibrarytool import DocumentLibraryTool, DocumentLibraryToolTypedDict
8
+ from .functiontool import FunctionTool, FunctionToolTypedDict
9
+ from .imagegenerationtool import ImageGenerationTool, ImageGenerationToolTypedDict
10
+ from .websearchpremiumtool import WebSearchPremiumTool, WebSearchPremiumToolTypedDict
11
+ from .websearchtool import WebSearchTool, WebSearchToolTypedDict
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
+ ConversationStreamRequestHandoffExecution = Literal["client", "server"]
20
+
21
+ ConversationStreamRequestToolsTypedDict = TypeAliasType(
22
+ "ConversationStreamRequestToolsTypedDict",
23
+ Union[
24
+ WebSearchToolTypedDict,
25
+ WebSearchPremiumToolTypedDict,
26
+ CodeInterpreterToolTypedDict,
27
+ ImageGenerationToolTypedDict,
28
+ FunctionToolTypedDict,
29
+ DocumentLibraryToolTypedDict,
30
+ ],
31
+ )
32
+
33
+
34
+ ConversationStreamRequestTools = Annotated[
35
+ Union[
36
+ Annotated[CodeInterpreterTool, Tag("code_interpreter")],
37
+ Annotated[DocumentLibraryTool, Tag("document_library")],
38
+ Annotated[FunctionTool, Tag("function")],
39
+ Annotated[ImageGenerationTool, Tag("image_generation")],
40
+ Annotated[WebSearchTool, Tag("web_search")],
41
+ Annotated[WebSearchPremiumTool, Tag("web_search_premium")],
42
+ ],
43
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
44
+ ]
45
+
46
+
47
+ class ConversationStreamRequestTypedDict(TypedDict):
48
+ inputs: ConversationInputsTypedDict
49
+ stream: NotRequired[bool]
50
+ store: NotRequired[Nullable[bool]]
51
+ handoff_execution: NotRequired[Nullable[ConversationStreamRequestHandoffExecution]]
52
+ instructions: NotRequired[Nullable[str]]
53
+ tools: NotRequired[Nullable[List[ConversationStreamRequestToolsTypedDict]]]
54
+ completion_args: NotRequired[Nullable[CompletionArgsTypedDict]]
55
+ name: NotRequired[Nullable[str]]
56
+ description: NotRequired[Nullable[str]]
57
+ agent_id: NotRequired[Nullable[str]]
58
+ model: NotRequired[Nullable[str]]
59
+
60
+
61
+ class ConversationStreamRequest(BaseModel):
62
+ inputs: ConversationInputs
63
+
64
+ stream: Optional[bool] = True
65
+
66
+ store: OptionalNullable[bool] = UNSET
67
+
68
+ handoff_execution: OptionalNullable[ConversationStreamRequestHandoffExecution] = (
69
+ UNSET
70
+ )
71
+
72
+ instructions: OptionalNullable[str] = UNSET
73
+
74
+ tools: OptionalNullable[List[ConversationStreamRequestTools]] = UNSET
75
+
76
+ completion_args: OptionalNullable[CompletionArgs] = UNSET
77
+
78
+ name: OptionalNullable[str] = UNSET
79
+
80
+ description: OptionalNullable[str] = UNSET
81
+
82
+ agent_id: OptionalNullable[str] = UNSET
83
+
84
+ model: OptionalNullable[str] = UNSET
85
+
86
+ @model_serializer(mode="wrap")
87
+ def serialize_model(self, handler):
88
+ optional_fields = [
89
+ "stream",
90
+ "store",
91
+ "handoff_execution",
92
+ "instructions",
93
+ "tools",
94
+ "completion_args",
95
+ "name",
96
+ "description",
97
+ "agent_id",
98
+ "model",
99
+ ]
100
+ nullable_fields = [
101
+ "store",
102
+ "handoff_execution",
103
+ "instructions",
104
+ "tools",
105
+ "completion_args",
106
+ "name",
107
+ "description",
108
+ "agent_id",
109
+ "model",
110
+ ]
111
+ null_default_fields = []
112
+
113
+ serialized = handler(self)
114
+
115
+ m = {}
116
+
117
+ for n, f in self.model_fields.items():
118
+ k = f.alias or n
119
+ val = serialized.get(k)
120
+ serialized.pop(k, None)
121
+
122
+ optional_nullable = k in optional_fields and k in nullable_fields
123
+ is_set = (
124
+ self.__pydantic_fields_set__.intersection({n})
125
+ or k in null_default_fields
126
+ ) # pylint: disable=no-member
127
+
128
+ if val is not None and val != UNSET_SENTINEL:
129
+ m[k] = val
130
+ elif val != UNSET_SENTINEL and (
131
+ not k in optional_fields or (optional_nullable and is_set)
132
+ ):
133
+ m[k] = val
134
+
135
+ return m
@@ -0,0 +1,63 @@
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 import Dict, Optional
7
+ from typing_extensions import NotRequired, TypedDict
8
+
9
+
10
+ class ConversationUsageInfoTypedDict(TypedDict):
11
+ prompt_tokens: NotRequired[int]
12
+ completion_tokens: NotRequired[int]
13
+ total_tokens: NotRequired[int]
14
+ connector_tokens: NotRequired[Nullable[int]]
15
+ connectors: NotRequired[Nullable[Dict[str, int]]]
16
+
17
+
18
+ class ConversationUsageInfo(BaseModel):
19
+ prompt_tokens: Optional[int] = 0
20
+
21
+ completion_tokens: Optional[int] = 0
22
+
23
+ total_tokens: Optional[int] = 0
24
+
25
+ connector_tokens: OptionalNullable[int] = UNSET
26
+
27
+ connectors: OptionalNullable[Dict[str, int]] = UNSET
28
+
29
+ @model_serializer(mode="wrap")
30
+ def serialize_model(self, handler):
31
+ optional_fields = [
32
+ "prompt_tokens",
33
+ "completion_tokens",
34
+ "total_tokens",
35
+ "connector_tokens",
36
+ "connectors",
37
+ ]
38
+ nullable_fields = ["connector_tokens", "connectors"]
39
+ null_default_fields = []
40
+
41
+ serialized = handler(self)
42
+
43
+ m = {}
44
+
45
+ for n, f in self.model_fields.items():
46
+ k = f.alias or n
47
+ val = serialized.get(k)
48
+ serialized.pop(k, None)
49
+
50
+ optional_nullable = k in optional_fields and k in nullable_fields
51
+ is_set = (
52
+ self.__pydantic_fields_set__.intersection({n})
53
+ or k in null_default_fields
54
+ ) # pylint: disable=no-member
55
+
56
+ if val is not None and val != UNSET_SENTINEL:
57
+ m[k] = val
58
+ elif val != UNSET_SENTINEL and (
59
+ not k in optional_fields or (optional_nullable and is_set)
60
+ ):
61
+ m[k] = val
62
+
63
+ return m
@@ -0,0 +1,22 @@
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 List, Literal, Optional
6
+ from typing_extensions import NotRequired, TypedDict
7
+
8
+
9
+ DocumentLibraryToolType = Literal["document_library"]
10
+
11
+
12
+ class DocumentLibraryToolTypedDict(TypedDict):
13
+ library_ids: List[str]
14
+ r"""Ids of the library in which to search."""
15
+ type: NotRequired[DocumentLibraryToolType]
16
+
17
+
18
+ class DocumentLibraryTool(BaseModel):
19
+ library_ids: List[str]
20
+ r"""Ids of the library in which to search."""
21
+
22
+ type: Optional[DocumentLibraryToolType] = "document_library"
@@ -0,0 +1,76 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .functioncallentryarguments import (
5
+ FunctionCallEntryArguments,
6
+ FunctionCallEntryArgumentsTypedDict,
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 Literal, Optional
12
+ from typing_extensions import NotRequired, TypedDict
13
+
14
+
15
+ FunctionCallEntryObject = Literal["entry"]
16
+
17
+ FunctionCallEntryType = Literal["function.call"]
18
+
19
+
20
+ class FunctionCallEntryTypedDict(TypedDict):
21
+ tool_call_id: str
22
+ name: str
23
+ arguments: FunctionCallEntryArgumentsTypedDict
24
+ object: NotRequired[FunctionCallEntryObject]
25
+ type: NotRequired[FunctionCallEntryType]
26
+ created_at: NotRequired[datetime]
27
+ completed_at: NotRequired[Nullable[datetime]]
28
+ id: NotRequired[str]
29
+
30
+
31
+ class FunctionCallEntry(BaseModel):
32
+ tool_call_id: str
33
+
34
+ name: str
35
+
36
+ arguments: FunctionCallEntryArguments
37
+
38
+ object: Optional[FunctionCallEntryObject] = "entry"
39
+
40
+ type: Optional[FunctionCallEntryType] = "function.call"
41
+
42
+ created_at: Optional[datetime] = None
43
+
44
+ completed_at: OptionalNullable[datetime] = UNSET
45
+
46
+ id: Optional[str] = None
47
+
48
+ @model_serializer(mode="wrap")
49
+ def serialize_model(self, handler):
50
+ optional_fields = ["object", "type", "created_at", "completed_at", "id"]
51
+ nullable_fields = ["completed_at"]
52
+ null_default_fields = []
53
+
54
+ serialized = handler(self)
55
+
56
+ m = {}
57
+
58
+ for n, f in 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
+ return m
@@ -0,0 +1,15 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from typing import Any, Dict, Union
5
+ from typing_extensions import TypeAliasType
6
+
7
+
8
+ FunctionCallEntryArgumentsTypedDict = TypeAliasType(
9
+ "FunctionCallEntryArgumentsTypedDict", Union[Dict[str, Any], str]
10
+ )
11
+
12
+
13
+ FunctionCallEntryArguments = TypeAliasType(
14
+ "FunctionCallEntryArguments", Union[Dict[str, Any], str]
15
+ )
@@ -0,0 +1,36 @@
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
+ FunctionCallEventType = Literal["function.call.delta"]
11
+
12
+
13
+ class FunctionCallEventTypedDict(TypedDict):
14
+ id: str
15
+ name: str
16
+ tool_call_id: str
17
+ arguments: str
18
+ type: NotRequired[FunctionCallEventType]
19
+ created_at: NotRequired[datetime]
20
+ output_index: NotRequired[int]
21
+
22
+
23
+ class FunctionCallEvent(BaseModel):
24
+ id: str
25
+
26
+ name: str
27
+
28
+ tool_call_id: str
29
+
30
+ arguments: str
31
+
32
+ type: Optional[FunctionCallEventType] = "function.call.delta"
33
+
34
+ created_at: Optional[datetime] = None
35
+
36
+ output_index: Optional[int] = 0
@@ -0,0 +1,69 @@
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 import Literal, Optional
8
+ from typing_extensions import NotRequired, TypedDict
9
+
10
+
11
+ FunctionResultEntryObject = Literal["entry"]
12
+
13
+ FunctionResultEntryType = Literal["function.result"]
14
+
15
+
16
+ class FunctionResultEntryTypedDict(TypedDict):
17
+ tool_call_id: str
18
+ result: str
19
+ object: NotRequired[FunctionResultEntryObject]
20
+ type: NotRequired[FunctionResultEntryType]
21
+ created_at: NotRequired[datetime]
22
+ completed_at: NotRequired[Nullable[datetime]]
23
+ id: NotRequired[str]
24
+
25
+
26
+ class FunctionResultEntry(BaseModel):
27
+ tool_call_id: str
28
+
29
+ result: str
30
+
31
+ object: Optional[FunctionResultEntryObject] = "entry"
32
+
33
+ type: Optional[FunctionResultEntryType] = "function.result"
34
+
35
+ created_at: Optional[datetime] = None
36
+
37
+ completed_at: OptionalNullable[datetime] = UNSET
38
+
39
+ id: Optional[str] = None
40
+
41
+ @model_serializer(mode="wrap")
42
+ def serialize_model(self, handler):
43
+ optional_fields = ["object", "type", "created_at", "completed_at", "id"]
44
+ nullable_fields = ["completed_at"]
45
+ null_default_fields = []
46
+
47
+ serialized = handler(self)
48
+
49
+ m = {}
50
+
51
+ for n, f in self.model_fields.items():
52
+ k = f.alias or n
53
+ val = serialized.get(k)
54
+ serialized.pop(k, None)
55
+
56
+ optional_nullable = k in optional_fields and k in nullable_fields
57
+ is_set = (
58
+ self.__pydantic_fields_set__.intersection({n})
59
+ or k in null_default_fields
60
+ ) # pylint: disable=no-member
61
+
62
+ if val is not None and val != UNSET_SENTINEL:
63
+ m[k] = val
64
+ elif val != UNSET_SENTINEL and (
65
+ not k in optional_fields or (optional_nullable and is_set)
66
+ ):
67
+ m[k] = val
68
+
69
+ return m