mistralai 1.7.1__py3-none-any.whl → 1.8.1__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 (91) hide show
  1. mistralai/_version.py +2 -2
  2. mistralai/beta.py +22 -0
  3. mistralai/conversations.py +2660 -0
  4. mistralai/embeddings.py +12 -0
  5. mistralai/extra/__init__.py +10 -2
  6. mistralai/extra/exceptions.py +14 -0
  7. mistralai/extra/mcp/__init__.py +0 -0
  8. mistralai/extra/mcp/auth.py +166 -0
  9. mistralai/extra/mcp/base.py +155 -0
  10. mistralai/extra/mcp/sse.py +165 -0
  11. mistralai/extra/mcp/stdio.py +22 -0
  12. mistralai/extra/run/__init__.py +0 -0
  13. mistralai/extra/run/context.py +295 -0
  14. mistralai/extra/run/result.py +212 -0
  15. mistralai/extra/run/tools.py +225 -0
  16. mistralai/extra/run/utils.py +36 -0
  17. mistralai/extra/tests/test_struct_chat.py +1 -1
  18. mistralai/mistral_agents.py +1160 -0
  19. mistralai/models/__init__.py +472 -1
  20. mistralai/models/agent.py +129 -0
  21. mistralai/models/agentconversation.py +71 -0
  22. mistralai/models/agentcreationrequest.py +109 -0
  23. mistralai/models/agenthandoffdoneevent.py +33 -0
  24. mistralai/models/agenthandoffentry.py +75 -0
  25. mistralai/models/agenthandoffstartedevent.py +33 -0
  26. mistralai/models/agents_api_v1_agents_getop.py +16 -0
  27. mistralai/models/agents_api_v1_agents_listop.py +24 -0
  28. mistralai/models/agents_api_v1_agents_update_versionop.py +21 -0
  29. mistralai/models/agents_api_v1_agents_updateop.py +23 -0
  30. mistralai/models/agents_api_v1_conversations_append_streamop.py +28 -0
  31. mistralai/models/agents_api_v1_conversations_appendop.py +28 -0
  32. mistralai/models/agents_api_v1_conversations_getop.py +33 -0
  33. mistralai/models/agents_api_v1_conversations_historyop.py +16 -0
  34. mistralai/models/agents_api_v1_conversations_listop.py +37 -0
  35. mistralai/models/agents_api_v1_conversations_messagesop.py +16 -0
  36. mistralai/models/agents_api_v1_conversations_restart_streamop.py +26 -0
  37. mistralai/models/agents_api_v1_conversations_restartop.py +26 -0
  38. mistralai/models/agentupdaterequest.py +111 -0
  39. mistralai/models/builtinconnectors.py +13 -0
  40. mistralai/models/chatcompletionresponse.py +6 -6
  41. mistralai/models/codeinterpretertool.py +17 -0
  42. mistralai/models/completionargs.py +100 -0
  43. mistralai/models/completionargsstop.py +13 -0
  44. mistralai/models/completionjobout.py +3 -3
  45. mistralai/models/conversationappendrequest.py +35 -0
  46. mistralai/models/conversationappendstreamrequest.py +37 -0
  47. mistralai/models/conversationevents.py +72 -0
  48. mistralai/models/conversationhistory.py +58 -0
  49. mistralai/models/conversationinputs.py +14 -0
  50. mistralai/models/conversationmessages.py +28 -0
  51. mistralai/models/conversationrequest.py +133 -0
  52. mistralai/models/conversationresponse.py +51 -0
  53. mistralai/models/conversationrestartrequest.py +42 -0
  54. mistralai/models/conversationrestartstreamrequest.py +44 -0
  55. mistralai/models/conversationstreamrequest.py +135 -0
  56. mistralai/models/conversationusageinfo.py +63 -0
  57. mistralai/models/documentlibrarytool.py +22 -0
  58. mistralai/models/embeddingdtype.py +7 -0
  59. mistralai/models/embeddingrequest.py +43 -3
  60. mistralai/models/fimcompletionresponse.py +6 -6
  61. mistralai/models/functioncallentry.py +76 -0
  62. mistralai/models/functioncallentryarguments.py +15 -0
  63. mistralai/models/functioncallevent.py +36 -0
  64. mistralai/models/functionresultentry.py +69 -0
  65. mistralai/models/functiontool.py +21 -0
  66. mistralai/models/imagegenerationtool.py +17 -0
  67. mistralai/models/inputentries.py +18 -0
  68. mistralai/models/messageentries.py +18 -0
  69. mistralai/models/messageinputcontentchunks.py +26 -0
  70. mistralai/models/messageinputentry.py +89 -0
  71. mistralai/models/messageoutputcontentchunks.py +30 -0
  72. mistralai/models/messageoutputentry.py +100 -0
  73. mistralai/models/messageoutputevent.py +93 -0
  74. mistralai/models/modelconversation.py +127 -0
  75. mistralai/models/outputcontentchunks.py +30 -0
  76. mistralai/models/responsedoneevent.py +25 -0
  77. mistralai/models/responseerrorevent.py +27 -0
  78. mistralai/models/responsestartedevent.py +24 -0
  79. mistralai/models/ssetypes.py +18 -0
  80. mistralai/models/toolexecutiondoneevent.py +34 -0
  81. mistralai/models/toolexecutionentry.py +70 -0
  82. mistralai/models/toolexecutionstartedevent.py +31 -0
  83. mistralai/models/toolfilechunk.py +61 -0
  84. mistralai/models/toolreferencechunk.py +61 -0
  85. mistralai/models/websearchpremiumtool.py +17 -0
  86. mistralai/models/websearchtool.py +17 -0
  87. mistralai/sdk.py +3 -0
  88. {mistralai-1.7.1.dist-info → mistralai-1.8.1.dist-info}/METADATA +42 -7
  89. {mistralai-1.7.1.dist-info → mistralai-1.8.1.dist-info}/RECORD +91 -14
  90. {mistralai-1.7.1.dist-info → mistralai-1.8.1.dist-info}/LICENSE +0 -0
  91. {mistralai-1.7.1.dist-info → mistralai-1.8.1.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,7 @@
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
+ EmbeddingDtype = Literal["float", "int8", "uint8", "binary", "ubinary"]
@@ -1,10 +1,12 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from mistralai.types import BaseModel
4
+ from .embeddingdtype import EmbeddingDtype
5
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
6
  import pydantic
6
- from typing import List, Union
7
- from typing_extensions import Annotated, TypeAliasType, TypedDict
7
+ from pydantic import model_serializer
8
+ from typing import List, Optional, Union
9
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
8
10
 
9
11
 
10
12
  EmbeddingRequestInputsTypedDict = TypeAliasType(
@@ -22,6 +24,9 @@ class EmbeddingRequestTypedDict(TypedDict):
22
24
  r"""ID of the model to use."""
23
25
  inputs: EmbeddingRequestInputsTypedDict
24
26
  r"""Text to embed."""
27
+ output_dimension: NotRequired[Nullable[int]]
28
+ r"""The dimension of the output embeddings."""
29
+ output_dtype: NotRequired[EmbeddingDtype]
25
30
 
26
31
 
27
32
  class EmbeddingRequest(BaseModel):
@@ -30,3 +35,38 @@ class EmbeddingRequest(BaseModel):
30
35
 
31
36
  inputs: Annotated[EmbeddingRequestInputs, pydantic.Field(alias="input")]
32
37
  r"""Text to embed."""
38
+
39
+ output_dimension: OptionalNullable[int] = UNSET
40
+ r"""The dimension of the output embeddings."""
41
+
42
+ output_dtype: Optional[EmbeddingDtype] = None
43
+
44
+ @model_serializer(mode="wrap")
45
+ def serialize_model(self, handler):
46
+ optional_fields = ["output_dimension", "output_dtype"]
47
+ nullable_fields = ["output_dimension"]
48
+ null_default_fields = []
49
+
50
+ serialized = handler(self)
51
+
52
+ m = {}
53
+
54
+ for n, f in self.model_fields.items():
55
+ k = f.alias or n
56
+ val = serialized.get(k)
57
+ serialized.pop(k, None)
58
+
59
+ optional_nullable = k in optional_fields and k in nullable_fields
60
+ is_set = (
61
+ self.__pydantic_fields_set__.intersection({n})
62
+ or k in null_default_fields
63
+ ) # pylint: disable=no-member
64
+
65
+ if val is not None and val != UNSET_SENTINEL:
66
+ m[k] = val
67
+ elif val != UNSET_SENTINEL and (
68
+ not k in optional_fields or (optional_nullable and is_set)
69
+ ):
70
+ m[k] = val
71
+
72
+ return m
@@ -4,8 +4,8 @@ from __future__ import annotations
4
4
  from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceTypedDict
5
5
  from .usageinfo import UsageInfo, UsageInfoTypedDict
6
6
  from mistralai.types import BaseModel
7
- from typing import List, Optional
8
- from typing_extensions import NotRequired, TypedDict
7
+ from typing import List
8
+ from typing_extensions import TypedDict
9
9
 
10
10
 
11
11
  class FIMCompletionResponseTypedDict(TypedDict):
@@ -13,8 +13,8 @@ class FIMCompletionResponseTypedDict(TypedDict):
13
13
  object: str
14
14
  model: str
15
15
  usage: UsageInfoTypedDict
16
- created: NotRequired[int]
17
- choices: NotRequired[List[ChatCompletionChoiceTypedDict]]
16
+ created: int
17
+ choices: List[ChatCompletionChoiceTypedDict]
18
18
 
19
19
 
20
20
  class FIMCompletionResponse(BaseModel):
@@ -26,6 +26,6 @@ class FIMCompletionResponse(BaseModel):
26
26
 
27
27
  usage: UsageInfo
28
28
 
29
- created: Optional[int] = None
29
+ created: int
30
30
 
31
- choices: Optional[List[ChatCompletionChoice]] = None
31
+ choices: List[ChatCompletionChoice]
@@ -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
+ )