mistralai 1.0.3__py3-none-any.whl → 1.2.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/__init__.py +4 -0
- mistralai/_hooks/sdkhooks.py +23 -4
- mistralai/_hooks/types.py +27 -9
- mistralai/_version.py +12 -0
- mistralai/agents.py +334 -164
- mistralai/basesdk.py +90 -5
- mistralai/batch.py +17 -0
- mistralai/chat.py +316 -166
- mistralai/classifiers.py +396 -0
- mistralai/embeddings.py +79 -55
- mistralai/files.py +487 -194
- mistralai/fim.py +206 -132
- mistralai/fine_tuning.py +3 -2
- mistralai/jobs.py +392 -263
- mistralai/mistral_jobs.py +733 -0
- mistralai/models/__init__.py +593 -50
- mistralai/models/agentscompletionrequest.py +70 -17
- mistralai/models/agentscompletionstreamrequest.py +72 -17
- mistralai/models/apiendpoint.py +9 -0
- mistralai/models/archiveftmodelout.py +15 -5
- mistralai/models/assistantmessage.py +22 -10
- mistralai/models/{modelcard.py → basemodelcard.py} +53 -14
- mistralai/models/batcherror.py +17 -0
- mistralai/models/batchjobin.py +58 -0
- mistralai/models/batchjobout.py +117 -0
- mistralai/models/batchjobsout.py +30 -0
- mistralai/models/batchjobstatus.py +15 -0
- mistralai/models/chatclassificationrequest.py +104 -0
- mistralai/models/chatcompletionchoice.py +13 -6
- mistralai/models/chatcompletionrequest.py +86 -21
- mistralai/models/chatcompletionresponse.py +8 -4
- mistralai/models/chatcompletionstreamrequest.py +88 -21
- mistralai/models/checkpointout.py +4 -3
- mistralai/models/classificationobject.py +21 -0
- mistralai/models/classificationrequest.py +59 -0
- mistralai/models/classificationresponse.py +21 -0
- mistralai/models/completionchunk.py +12 -5
- mistralai/models/completionevent.py +2 -3
- mistralai/models/completionresponsestreamchoice.py +22 -8
- mistralai/models/contentchunk.py +13 -10
- mistralai/models/delete_model_v1_models_model_id_deleteop.py +5 -5
- mistralai/models/deletefileout.py +4 -3
- mistralai/models/deletemodelout.py +5 -4
- mistralai/models/deltamessage.py +23 -11
- mistralai/models/detailedjobout.py +70 -12
- mistralai/models/embeddingrequest.py +14 -9
- mistralai/models/embeddingresponse.py +7 -3
- mistralai/models/embeddingresponsedata.py +5 -4
- mistralai/models/eventout.py +11 -6
- mistralai/models/filepurpose.py +8 -0
- mistralai/models/files_api_routes_delete_fileop.py +5 -5
- mistralai/models/files_api_routes_download_fileop.py +16 -0
- mistralai/models/files_api_routes_list_filesop.py +96 -0
- mistralai/models/files_api_routes_retrieve_fileop.py +5 -5
- mistralai/models/files_api_routes_upload_fileop.py +33 -14
- mistralai/models/fileschema.py +22 -15
- mistralai/models/fimcompletionrequest.py +44 -16
- mistralai/models/fimcompletionresponse.py +8 -4
- mistralai/models/fimcompletionstreamrequest.py +44 -16
- mistralai/models/finetuneablemodel.py +7 -1
- mistralai/models/ftmodelcapabilitiesout.py +6 -4
- mistralai/models/ftmodelcard.py +121 -0
- mistralai/models/ftmodelout.py +39 -9
- mistralai/models/function.py +5 -4
- mistralai/models/functioncall.py +4 -3
- mistralai/models/functionname.py +17 -0
- mistralai/models/githubrepositoryin.py +24 -7
- mistralai/models/githubrepositoryout.py +24 -7
- mistralai/models/httpvalidationerror.py +1 -3
- mistralai/models/imageurl.py +47 -0
- mistralai/models/imageurlchunk.py +38 -0
- mistralai/models/jobin.py +24 -7
- mistralai/models/jobmetadataout.py +32 -8
- mistralai/models/jobout.py +65 -12
- mistralai/models/jobs_api_routes_batch_cancel_batch_jobop.py +16 -0
- mistralai/models/jobs_api_routes_batch_get_batch_jobop.py +16 -0
- mistralai/models/jobs_api_routes_batch_get_batch_jobsop.py +95 -0
- mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +3 -2
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +85 -18
- mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +10 -6
- mistralai/models/jobsout.py +13 -5
- mistralai/models/legacyjobmetadataout.py +55 -9
- mistralai/models/listfilesout.py +7 -3
- mistralai/models/metricout.py +12 -8
- mistralai/models/modelcapabilities.py +9 -4
- mistralai/models/modellist.py +21 -7
- mistralai/models/responseformat.py +7 -8
- mistralai/models/responseformats.py +8 -0
- mistralai/models/retrieve_model_v1_models_model_id_getop.py +25 -6
- mistralai/models/retrievefileout.py +25 -15
- mistralai/models/sampletype.py +6 -2
- mistralai/models/security.py +14 -5
- mistralai/models/source.py +3 -2
- mistralai/models/systemmessage.py +10 -9
- mistralai/models/textchunk.py +14 -5
- mistralai/models/tool.py +10 -9
- mistralai/models/toolcall.py +10 -8
- mistralai/models/toolchoice.py +29 -0
- mistralai/models/toolchoiceenum.py +7 -0
- mistralai/models/toolmessage.py +13 -6
- mistralai/models/tooltypes.py +8 -0
- mistralai/models/trainingfile.py +4 -4
- mistralai/models/trainingparameters.py +34 -8
- mistralai/models/trainingparametersin.py +36 -10
- mistralai/models/unarchiveftmodelout.py +15 -5
- mistralai/models/updateftmodelin.py +9 -6
- mistralai/models/uploadfileout.py +22 -15
- mistralai/models/usageinfo.py +4 -3
- mistralai/models/usermessage.py +42 -10
- mistralai/models/validationerror.py +5 -3
- mistralai/models/wandbintegration.py +23 -7
- mistralai/models/wandbintegrationout.py +23 -8
- mistralai/models_.py +416 -294
- mistralai/sdk.py +31 -19
- mistralai/sdkconfiguration.py +9 -11
- mistralai/utils/__init__.py +14 -1
- mistralai/utils/annotations.py +13 -2
- mistralai/utils/logger.py +4 -1
- mistralai/utils/retries.py +2 -1
- mistralai/utils/security.py +13 -6
- mistralai/utils/serializers.py +25 -0
- {mistralai-1.0.3.dist-info → mistralai-1.2.0.dist-info}/METADATA +171 -66
- mistralai-1.2.0.dist-info/RECORD +276 -0
- {mistralai-1.0.3.dist-info → mistralai-1.2.0.dist-info}/WHEEL +1 -1
- mistralai_azure/__init__.py +4 -0
- mistralai_azure/_hooks/sdkhooks.py +23 -4
- mistralai_azure/_hooks/types.py +27 -9
- mistralai_azure/_version.py +12 -0
- mistralai_azure/basesdk.py +91 -6
- mistralai_azure/chat.py +308 -166
- mistralai_azure/models/__init__.py +164 -16
- mistralai_azure/models/assistantmessage.py +29 -11
- mistralai_azure/models/chatcompletionchoice.py +15 -6
- mistralai_azure/models/chatcompletionrequest.py +94 -22
- mistralai_azure/models/chatcompletionresponse.py +8 -4
- mistralai_azure/models/chatcompletionstreamrequest.py +96 -22
- mistralai_azure/models/completionchunk.py +12 -5
- mistralai_azure/models/completionevent.py +2 -3
- mistralai_azure/models/completionresponsestreamchoice.py +19 -8
- mistralai_azure/models/contentchunk.py +4 -11
- mistralai_azure/models/deltamessage.py +30 -12
- mistralai_azure/models/function.py +5 -4
- mistralai_azure/models/functioncall.py +4 -3
- mistralai_azure/models/functionname.py +17 -0
- mistralai_azure/models/httpvalidationerror.py +1 -3
- mistralai_azure/models/responseformat.py +7 -8
- mistralai_azure/models/responseformats.py +8 -0
- mistralai_azure/models/security.py +13 -5
- mistralai_azure/models/systemmessage.py +10 -9
- mistralai_azure/models/textchunk.py +14 -5
- mistralai_azure/models/tool.py +10 -9
- mistralai_azure/models/toolcall.py +10 -8
- mistralai_azure/models/toolchoice.py +29 -0
- mistralai_azure/models/toolchoiceenum.py +7 -0
- mistralai_azure/models/toolmessage.py +20 -7
- mistralai_azure/models/tooltypes.py +8 -0
- mistralai_azure/models/usageinfo.py +4 -3
- mistralai_azure/models/usermessage.py +42 -10
- mistralai_azure/models/validationerror.py +5 -3
- mistralai_azure/sdkconfiguration.py +9 -11
- mistralai_azure/utils/__init__.py +16 -3
- mistralai_azure/utils/annotations.py +13 -2
- mistralai_azure/utils/forms.py +10 -9
- mistralai_azure/utils/headers.py +8 -8
- mistralai_azure/utils/logger.py +6 -0
- mistralai_azure/utils/queryparams.py +16 -14
- mistralai_azure/utils/retries.py +2 -1
- mistralai_azure/utils/security.py +12 -6
- mistralai_azure/utils/serializers.py +42 -8
- mistralai_azure/utils/url.py +13 -8
- mistralai_azure/utils/values.py +6 -0
- mistralai_gcp/__init__.py +4 -0
- mistralai_gcp/_hooks/sdkhooks.py +23 -4
- mistralai_gcp/_hooks/types.py +27 -9
- mistralai_gcp/_version.py +12 -0
- mistralai_gcp/basesdk.py +91 -6
- mistralai_gcp/chat.py +308 -166
- mistralai_gcp/fim.py +198 -132
- mistralai_gcp/models/__init__.py +186 -18
- mistralai_gcp/models/assistantmessage.py +29 -11
- mistralai_gcp/models/chatcompletionchoice.py +15 -6
- mistralai_gcp/models/chatcompletionrequest.py +91 -22
- mistralai_gcp/models/chatcompletionresponse.py +8 -4
- mistralai_gcp/models/chatcompletionstreamrequest.py +93 -22
- mistralai_gcp/models/completionchunk.py +12 -5
- mistralai_gcp/models/completionevent.py +2 -3
- mistralai_gcp/models/completionresponsestreamchoice.py +19 -8
- mistralai_gcp/models/contentchunk.py +4 -11
- mistralai_gcp/models/deltamessage.py +30 -12
- mistralai_gcp/models/fimcompletionrequest.py +51 -17
- mistralai_gcp/models/fimcompletionresponse.py +8 -4
- mistralai_gcp/models/fimcompletionstreamrequest.py +51 -17
- mistralai_gcp/models/function.py +5 -4
- mistralai_gcp/models/functioncall.py +4 -3
- mistralai_gcp/models/functionname.py +17 -0
- mistralai_gcp/models/httpvalidationerror.py +1 -3
- mistralai_gcp/models/responseformat.py +7 -8
- mistralai_gcp/models/responseformats.py +8 -0
- mistralai_gcp/models/security.py +13 -5
- mistralai_gcp/models/systemmessage.py +10 -9
- mistralai_gcp/models/textchunk.py +14 -5
- mistralai_gcp/models/tool.py +10 -9
- mistralai_gcp/models/toolcall.py +10 -8
- mistralai_gcp/models/toolchoice.py +29 -0
- mistralai_gcp/models/toolchoiceenum.py +7 -0
- mistralai_gcp/models/toolmessage.py +20 -7
- mistralai_gcp/models/tooltypes.py +8 -0
- mistralai_gcp/models/usageinfo.py +4 -3
- mistralai_gcp/models/usermessage.py +42 -10
- mistralai_gcp/models/validationerror.py +5 -3
- mistralai_gcp/sdk.py +6 -7
- mistralai_gcp/sdkconfiguration.py +9 -11
- mistralai_gcp/utils/__init__.py +16 -3
- mistralai_gcp/utils/annotations.py +13 -2
- mistralai_gcp/utils/forms.py +10 -9
- mistralai_gcp/utils/headers.py +8 -8
- mistralai_gcp/utils/logger.py +6 -0
- mistralai_gcp/utils/queryparams.py +16 -14
- mistralai_gcp/utils/retries.py +2 -1
- mistralai_gcp/utils/security.py +12 -6
- mistralai_gcp/utils/serializers.py +42 -8
- mistralai_gcp/utils/url.py +13 -8
- mistralai_gcp/utils/values.py +6 -0
- mistralai-1.0.3.dist-info/RECORD +0 -236
- {mistralai-1.0.3.dist-info → mistralai-1.2.0.dist-info}/LICENSE +0 -0
mistralai_gcp/models/__init__.py
CHANGED
|
@@ -1,31 +1,199 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
|
-
from .assistantmessage import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
from .assistantmessage import (
|
|
4
|
+
AssistantMessage,
|
|
5
|
+
AssistantMessageContent,
|
|
6
|
+
AssistantMessageContentTypedDict,
|
|
7
|
+
AssistantMessageRole,
|
|
8
|
+
AssistantMessageTypedDict,
|
|
9
|
+
)
|
|
10
|
+
from .chatcompletionchoice import (
|
|
11
|
+
ChatCompletionChoice,
|
|
12
|
+
ChatCompletionChoiceFinishReason,
|
|
13
|
+
ChatCompletionChoiceTypedDict,
|
|
14
|
+
)
|
|
15
|
+
from .chatcompletionrequest import (
|
|
16
|
+
ChatCompletionRequest,
|
|
17
|
+
ChatCompletionRequestMessages,
|
|
18
|
+
ChatCompletionRequestMessagesTypedDict,
|
|
19
|
+
ChatCompletionRequestStop,
|
|
20
|
+
ChatCompletionRequestStopTypedDict,
|
|
21
|
+
ChatCompletionRequestToolChoice,
|
|
22
|
+
ChatCompletionRequestToolChoiceTypedDict,
|
|
23
|
+
ChatCompletionRequestTypedDict,
|
|
24
|
+
)
|
|
25
|
+
from .chatcompletionresponse import (
|
|
26
|
+
ChatCompletionResponse,
|
|
27
|
+
ChatCompletionResponseTypedDict,
|
|
28
|
+
)
|
|
29
|
+
from .chatcompletionstreamrequest import (
|
|
30
|
+
ChatCompletionStreamRequest,
|
|
31
|
+
ChatCompletionStreamRequestToolChoice,
|
|
32
|
+
ChatCompletionStreamRequestToolChoiceTypedDict,
|
|
33
|
+
ChatCompletionStreamRequestTypedDict,
|
|
34
|
+
Messages,
|
|
35
|
+
MessagesTypedDict,
|
|
36
|
+
Stop,
|
|
37
|
+
StopTypedDict,
|
|
38
|
+
)
|
|
8
39
|
from .completionchunk import CompletionChunk, CompletionChunkTypedDict
|
|
9
40
|
from .completionevent import CompletionEvent, CompletionEventTypedDict
|
|
10
|
-
from .completionresponsestreamchoice import
|
|
41
|
+
from .completionresponsestreamchoice import (
|
|
42
|
+
CompletionResponseStreamChoice,
|
|
43
|
+
CompletionResponseStreamChoiceTypedDict,
|
|
44
|
+
FinishReason,
|
|
45
|
+
)
|
|
11
46
|
from .contentchunk import ContentChunk, ContentChunkTypedDict
|
|
12
|
-
from .deltamessage import DeltaMessage, DeltaMessageTypedDict
|
|
13
|
-
from .fimcompletionrequest import
|
|
47
|
+
from .deltamessage import Content, ContentTypedDict, DeltaMessage, DeltaMessageTypedDict
|
|
48
|
+
from .fimcompletionrequest import (
|
|
49
|
+
FIMCompletionRequest,
|
|
50
|
+
FIMCompletionRequestStop,
|
|
51
|
+
FIMCompletionRequestStopTypedDict,
|
|
52
|
+
FIMCompletionRequestTypedDict,
|
|
53
|
+
)
|
|
14
54
|
from .fimcompletionresponse import FIMCompletionResponse, FIMCompletionResponseTypedDict
|
|
15
|
-
from .fimcompletionstreamrequest import
|
|
55
|
+
from .fimcompletionstreamrequest import (
|
|
56
|
+
FIMCompletionStreamRequest,
|
|
57
|
+
FIMCompletionStreamRequestStop,
|
|
58
|
+
FIMCompletionStreamRequestStopTypedDict,
|
|
59
|
+
FIMCompletionStreamRequestTypedDict,
|
|
60
|
+
)
|
|
16
61
|
from .function import Function, FunctionTypedDict
|
|
17
|
-
from .functioncall import
|
|
62
|
+
from .functioncall import (
|
|
63
|
+
Arguments,
|
|
64
|
+
ArgumentsTypedDict,
|
|
65
|
+
FunctionCall,
|
|
66
|
+
FunctionCallTypedDict,
|
|
67
|
+
)
|
|
68
|
+
from .functionname import FunctionName, FunctionNameTypedDict
|
|
18
69
|
from .httpvalidationerror import HTTPValidationError, HTTPValidationErrorData
|
|
19
|
-
from .responseformat import ResponseFormat, ResponseFormatTypedDict
|
|
70
|
+
from .responseformat import ResponseFormat, ResponseFormatTypedDict
|
|
71
|
+
from .responseformats import ResponseFormats
|
|
20
72
|
from .sdkerror import SDKError
|
|
21
73
|
from .security import Security, SecurityTypedDict
|
|
22
|
-
from .systemmessage import
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
74
|
+
from .systemmessage import (
|
|
75
|
+
Role,
|
|
76
|
+
SystemMessage,
|
|
77
|
+
SystemMessageContent,
|
|
78
|
+
SystemMessageContentTypedDict,
|
|
79
|
+
SystemMessageTypedDict,
|
|
80
|
+
)
|
|
81
|
+
from .textchunk import TextChunk, TextChunkTypedDict, Type
|
|
82
|
+
from .tool import Tool, ToolTypedDict
|
|
83
|
+
from .toolcall import ToolCall, ToolCallTypedDict
|
|
84
|
+
from .toolchoice import ToolChoice, ToolChoiceTypedDict
|
|
85
|
+
from .toolchoiceenum import ToolChoiceEnum
|
|
26
86
|
from .toolmessage import ToolMessage, ToolMessageRole, ToolMessageTypedDict
|
|
87
|
+
from .tooltypes import ToolTypes
|
|
27
88
|
from .usageinfo import UsageInfo, UsageInfoTypedDict
|
|
28
|
-
from .usermessage import
|
|
29
|
-
|
|
89
|
+
from .usermessage import (
|
|
90
|
+
UserMessage,
|
|
91
|
+
UserMessageContent,
|
|
92
|
+
UserMessageContentTypedDict,
|
|
93
|
+
UserMessageRole,
|
|
94
|
+
UserMessageTypedDict,
|
|
95
|
+
)
|
|
96
|
+
from .validationerror import (
|
|
97
|
+
Loc,
|
|
98
|
+
LocTypedDict,
|
|
99
|
+
ValidationError,
|
|
100
|
+
ValidationErrorTypedDict,
|
|
101
|
+
)
|
|
30
102
|
|
|
31
|
-
__all__ = [
|
|
103
|
+
__all__ = [
|
|
104
|
+
"Arguments",
|
|
105
|
+
"ArgumentsTypedDict",
|
|
106
|
+
"AssistantMessage",
|
|
107
|
+
"AssistantMessageContent",
|
|
108
|
+
"AssistantMessageContentTypedDict",
|
|
109
|
+
"AssistantMessageRole",
|
|
110
|
+
"AssistantMessageTypedDict",
|
|
111
|
+
"ChatCompletionChoice",
|
|
112
|
+
"ChatCompletionChoiceFinishReason",
|
|
113
|
+
"ChatCompletionChoiceTypedDict",
|
|
114
|
+
"ChatCompletionRequest",
|
|
115
|
+
"ChatCompletionRequestMessages",
|
|
116
|
+
"ChatCompletionRequestMessagesTypedDict",
|
|
117
|
+
"ChatCompletionRequestStop",
|
|
118
|
+
"ChatCompletionRequestStopTypedDict",
|
|
119
|
+
"ChatCompletionRequestToolChoice",
|
|
120
|
+
"ChatCompletionRequestToolChoiceTypedDict",
|
|
121
|
+
"ChatCompletionRequestTypedDict",
|
|
122
|
+
"ChatCompletionResponse",
|
|
123
|
+
"ChatCompletionResponseTypedDict",
|
|
124
|
+
"ChatCompletionStreamRequest",
|
|
125
|
+
"ChatCompletionStreamRequestToolChoice",
|
|
126
|
+
"ChatCompletionStreamRequestToolChoiceTypedDict",
|
|
127
|
+
"ChatCompletionStreamRequestTypedDict",
|
|
128
|
+
"CompletionChunk",
|
|
129
|
+
"CompletionChunkTypedDict",
|
|
130
|
+
"CompletionEvent",
|
|
131
|
+
"CompletionEventTypedDict",
|
|
132
|
+
"CompletionResponseStreamChoice",
|
|
133
|
+
"CompletionResponseStreamChoiceTypedDict",
|
|
134
|
+
"Content",
|
|
135
|
+
"ContentChunk",
|
|
136
|
+
"ContentChunkTypedDict",
|
|
137
|
+
"ContentTypedDict",
|
|
138
|
+
"DeltaMessage",
|
|
139
|
+
"DeltaMessageTypedDict",
|
|
140
|
+
"FIMCompletionRequest",
|
|
141
|
+
"FIMCompletionRequestStop",
|
|
142
|
+
"FIMCompletionRequestStopTypedDict",
|
|
143
|
+
"FIMCompletionRequestTypedDict",
|
|
144
|
+
"FIMCompletionResponse",
|
|
145
|
+
"FIMCompletionResponseTypedDict",
|
|
146
|
+
"FIMCompletionStreamRequest",
|
|
147
|
+
"FIMCompletionStreamRequestStop",
|
|
148
|
+
"FIMCompletionStreamRequestStopTypedDict",
|
|
149
|
+
"FIMCompletionStreamRequestTypedDict",
|
|
150
|
+
"FinishReason",
|
|
151
|
+
"Function",
|
|
152
|
+
"FunctionCall",
|
|
153
|
+
"FunctionCallTypedDict",
|
|
154
|
+
"FunctionName",
|
|
155
|
+
"FunctionNameTypedDict",
|
|
156
|
+
"FunctionTypedDict",
|
|
157
|
+
"HTTPValidationError",
|
|
158
|
+
"HTTPValidationErrorData",
|
|
159
|
+
"Loc",
|
|
160
|
+
"LocTypedDict",
|
|
161
|
+
"Messages",
|
|
162
|
+
"MessagesTypedDict",
|
|
163
|
+
"ResponseFormat",
|
|
164
|
+
"ResponseFormatTypedDict",
|
|
165
|
+
"ResponseFormats",
|
|
166
|
+
"Role",
|
|
167
|
+
"SDKError",
|
|
168
|
+
"Security",
|
|
169
|
+
"SecurityTypedDict",
|
|
170
|
+
"Stop",
|
|
171
|
+
"StopTypedDict",
|
|
172
|
+
"SystemMessage",
|
|
173
|
+
"SystemMessageContent",
|
|
174
|
+
"SystemMessageContentTypedDict",
|
|
175
|
+
"SystemMessageTypedDict",
|
|
176
|
+
"TextChunk",
|
|
177
|
+
"TextChunkTypedDict",
|
|
178
|
+
"Tool",
|
|
179
|
+
"ToolCall",
|
|
180
|
+
"ToolCallTypedDict",
|
|
181
|
+
"ToolChoice",
|
|
182
|
+
"ToolChoiceEnum",
|
|
183
|
+
"ToolChoiceTypedDict",
|
|
184
|
+
"ToolMessage",
|
|
185
|
+
"ToolMessageRole",
|
|
186
|
+
"ToolMessageTypedDict",
|
|
187
|
+
"ToolTypedDict",
|
|
188
|
+
"ToolTypes",
|
|
189
|
+
"Type",
|
|
190
|
+
"UsageInfo",
|
|
191
|
+
"UsageInfoTypedDict",
|
|
192
|
+
"UserMessage",
|
|
193
|
+
"UserMessageContent",
|
|
194
|
+
"UserMessageContentTypedDict",
|
|
195
|
+
"UserMessageRole",
|
|
196
|
+
"UserMessageTypedDict",
|
|
197
|
+
"ValidationError",
|
|
198
|
+
"ValidationErrorTypedDict",
|
|
199
|
+
]
|
|
@@ -1,30 +1,45 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .contentchunk import ContentChunk, ContentChunkTypedDict
|
|
4
5
|
from .toolcall import ToolCall, ToolCallTypedDict
|
|
5
|
-
from mistralai_gcp.types import
|
|
6
|
+
from mistralai_gcp.types import (
|
|
7
|
+
BaseModel,
|
|
8
|
+
Nullable,
|
|
9
|
+
OptionalNullable,
|
|
10
|
+
UNSET,
|
|
11
|
+
UNSET_SENTINEL,
|
|
12
|
+
)
|
|
6
13
|
from pydantic import model_serializer
|
|
7
|
-
from typing import List, Literal, Optional,
|
|
8
|
-
from typing_extensions import NotRequired
|
|
14
|
+
from typing import List, Literal, Optional, Union
|
|
15
|
+
from typing_extensions import NotRequired, TypedDict
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
AssistantMessageContentTypedDict = Union[str, List[ContentChunkTypedDict]]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
AssistantMessageContent = Union[str, List[ContentChunk]]
|
|
9
22
|
|
|
10
23
|
|
|
11
24
|
AssistantMessageRole = Literal["assistant"]
|
|
12
25
|
|
|
26
|
+
|
|
13
27
|
class AssistantMessageTypedDict(TypedDict):
|
|
14
|
-
content: NotRequired[Nullable[
|
|
28
|
+
content: NotRequired[Nullable[AssistantMessageContentTypedDict]]
|
|
15
29
|
tool_calls: NotRequired[Nullable[List[ToolCallTypedDict]]]
|
|
16
30
|
prefix: NotRequired[bool]
|
|
17
|
-
r"""Set this to `true` when adding an assistant message as prefix to condition the model response. The role of the prefix message is to force the model to start its answer by the content of the message."""
|
|
18
31
|
role: NotRequired[AssistantMessageRole]
|
|
19
|
-
|
|
32
|
+
|
|
20
33
|
|
|
21
34
|
class AssistantMessage(BaseModel):
|
|
22
|
-
content: OptionalNullable[
|
|
35
|
+
content: OptionalNullable[AssistantMessageContent] = UNSET
|
|
36
|
+
|
|
23
37
|
tool_calls: OptionalNullable[List[ToolCall]] = UNSET
|
|
38
|
+
|
|
24
39
|
prefix: Optional[bool] = False
|
|
25
|
-
|
|
40
|
+
|
|
26
41
|
role: Optional[AssistantMessageRole] = "assistant"
|
|
27
|
-
|
|
42
|
+
|
|
28
43
|
@model_serializer(mode="wrap")
|
|
29
44
|
def serialize_model(self, handler):
|
|
30
45
|
optional_fields = ["content", "tool_calls", "prefix", "role"]
|
|
@@ -38,9 +53,13 @@ class AssistantMessage(BaseModel):
|
|
|
38
53
|
for n, f in self.model_fields.items():
|
|
39
54
|
k = f.alias or n
|
|
40
55
|
val = serialized.get(k)
|
|
56
|
+
serialized.pop(k, None)
|
|
41
57
|
|
|
42
58
|
optional_nullable = k in optional_fields and k in nullable_fields
|
|
43
|
-
is_set = (
|
|
59
|
+
is_set = (
|
|
60
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
61
|
+
or k in null_default_fields
|
|
62
|
+
) # pylint: disable=no-member
|
|
44
63
|
|
|
45
64
|
if val is not None and val != UNSET_SENTINEL:
|
|
46
65
|
m[k] = val
|
|
@@ -50,4 +69,3 @@ class AssistantMessage(BaseModel):
|
|
|
50
69
|
m[k] = val
|
|
51
70
|
|
|
52
71
|
return m
|
|
53
|
-
|
|
@@ -2,20 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
|
|
5
|
-
from mistralai_gcp.types import BaseModel
|
|
6
|
-
from
|
|
5
|
+
from mistralai_gcp.types import BaseModel, UnrecognizedStr
|
|
6
|
+
from mistralai_gcp.utils import validate_open_enum
|
|
7
|
+
from pydantic.functional_validators import PlainValidator
|
|
8
|
+
from typing import Literal, Union
|
|
9
|
+
from typing_extensions import Annotated, TypedDict
|
|
7
10
|
|
|
8
11
|
|
|
9
|
-
ChatCompletionChoiceFinishReason =
|
|
12
|
+
ChatCompletionChoiceFinishReason = Union[
|
|
13
|
+
Literal["stop", "length", "model_length", "error", "tool_calls"], UnrecognizedStr
|
|
14
|
+
]
|
|
15
|
+
|
|
10
16
|
|
|
11
17
|
class ChatCompletionChoiceTypedDict(TypedDict):
|
|
12
18
|
index: int
|
|
13
19
|
message: AssistantMessageTypedDict
|
|
14
20
|
finish_reason: ChatCompletionChoiceFinishReason
|
|
15
|
-
|
|
21
|
+
|
|
16
22
|
|
|
17
23
|
class ChatCompletionChoice(BaseModel):
|
|
18
24
|
index: int
|
|
25
|
+
|
|
19
26
|
message: AssistantMessage
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
|
|
28
|
+
finish_reason: Annotated[
|
|
29
|
+
ChatCompletionChoiceFinishReason, PlainValidator(validate_open_enum(False))
|
|
30
|
+
]
|
|
@@ -5,13 +5,21 @@ from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
|
|
|
5
5
|
from .responseformat import ResponseFormat, ResponseFormatTypedDict
|
|
6
6
|
from .systemmessage import SystemMessage, SystemMessageTypedDict
|
|
7
7
|
from .tool import Tool, ToolTypedDict
|
|
8
|
+
from .toolchoice import ToolChoice, ToolChoiceTypedDict
|
|
9
|
+
from .toolchoiceenum import ToolChoiceEnum
|
|
8
10
|
from .toolmessage import ToolMessage, ToolMessageTypedDict
|
|
9
11
|
from .usermessage import UserMessage, UserMessageTypedDict
|
|
10
|
-
from mistralai_gcp.types import
|
|
12
|
+
from mistralai_gcp.types import (
|
|
13
|
+
BaseModel,
|
|
14
|
+
Nullable,
|
|
15
|
+
OptionalNullable,
|
|
16
|
+
UNSET,
|
|
17
|
+
UNSET_SENTINEL,
|
|
18
|
+
)
|
|
11
19
|
from mistralai_gcp.utils import get_discriminator
|
|
12
20
|
from pydantic import Discriminator, Tag, model_serializer
|
|
13
|
-
from typing import List,
|
|
14
|
-
from typing_extensions import Annotated, NotRequired
|
|
21
|
+
from typing import List, Optional, Union
|
|
22
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
15
23
|
|
|
16
24
|
|
|
17
25
|
ChatCompletionRequestStopTypedDict = Union[str, List[str]]
|
|
@@ -22,27 +30,42 @@ ChatCompletionRequestStop = Union[str, List[str]]
|
|
|
22
30
|
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
|
|
23
31
|
|
|
24
32
|
|
|
25
|
-
ChatCompletionRequestMessagesTypedDict = Union[
|
|
33
|
+
ChatCompletionRequestMessagesTypedDict = Union[
|
|
34
|
+
SystemMessageTypedDict,
|
|
35
|
+
UserMessageTypedDict,
|
|
36
|
+
AssistantMessageTypedDict,
|
|
37
|
+
ToolMessageTypedDict,
|
|
38
|
+
]
|
|
26
39
|
|
|
27
40
|
|
|
28
|
-
ChatCompletionRequestMessages = Annotated[
|
|
41
|
+
ChatCompletionRequestMessages = Annotated[
|
|
42
|
+
Union[
|
|
43
|
+
Annotated[AssistantMessage, Tag("assistant")],
|
|
44
|
+
Annotated[SystemMessage, Tag("system")],
|
|
45
|
+
Annotated[ToolMessage, Tag("tool")],
|
|
46
|
+
Annotated[UserMessage, Tag("user")],
|
|
47
|
+
],
|
|
48
|
+
Discriminator(lambda m: get_discriminator(m, "role", "role")),
|
|
49
|
+
]
|
|
29
50
|
|
|
30
51
|
|
|
31
|
-
|
|
52
|
+
ChatCompletionRequestToolChoiceTypedDict = Union[ToolChoiceTypedDict, ToolChoiceEnum]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
ChatCompletionRequestToolChoice = Union[ToolChoice, ToolChoiceEnum]
|
|
56
|
+
|
|
32
57
|
|
|
33
58
|
class ChatCompletionRequestTypedDict(TypedDict):
|
|
34
59
|
model: Nullable[str]
|
|
35
60
|
r"""ID of the model to use. You can use the [List Available Models](/api/#tag/models/operation/list_models_v1_models_get) API to see all of your available models, or see our [Model overview](/models) for model descriptions."""
|
|
36
61
|
messages: List[ChatCompletionRequestMessagesTypedDict]
|
|
37
62
|
r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
|
|
38
|
-
temperature: NotRequired[float]
|
|
39
|
-
r"""What sampling temperature to use, between 0.0 and
|
|
63
|
+
temperature: NotRequired[Nullable[float]]
|
|
64
|
+
r"""What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value."""
|
|
40
65
|
top_p: NotRequired[float]
|
|
41
66
|
r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both."""
|
|
42
67
|
max_tokens: NotRequired[Nullable[int]]
|
|
43
68
|
r"""The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length."""
|
|
44
|
-
min_tokens: NotRequired[Nullable[int]]
|
|
45
|
-
r"""The minimum number of tokens to generate in the completion."""
|
|
46
69
|
stream: NotRequired[bool]
|
|
47
70
|
r"""Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON."""
|
|
48
71
|
stop: NotRequired[ChatCompletionRequestStopTypedDict]
|
|
@@ -51,36 +74,79 @@ class ChatCompletionRequestTypedDict(TypedDict):
|
|
|
51
74
|
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
52
75
|
response_format: NotRequired[ResponseFormatTypedDict]
|
|
53
76
|
tools: NotRequired[Nullable[List[ToolTypedDict]]]
|
|
54
|
-
tool_choice: NotRequired[
|
|
55
|
-
|
|
77
|
+
tool_choice: NotRequired[ChatCompletionRequestToolChoiceTypedDict]
|
|
78
|
+
presence_penalty: NotRequired[float]
|
|
79
|
+
r"""presence_penalty determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative."""
|
|
80
|
+
frequency_penalty: NotRequired[float]
|
|
81
|
+
r"""frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition."""
|
|
82
|
+
n: NotRequired[Nullable[int]]
|
|
83
|
+
r"""Number of completions to return for each request, input tokens are only billed once."""
|
|
84
|
+
|
|
56
85
|
|
|
57
86
|
class ChatCompletionRequest(BaseModel):
|
|
58
87
|
model: Nullable[str]
|
|
59
88
|
r"""ID of the model to use. You can use the [List Available Models](/api/#tag/models/operation/list_models_v1_models_get) API to see all of your available models, or see our [Model overview](/models) for model descriptions."""
|
|
89
|
+
|
|
60
90
|
messages: List[ChatCompletionRequestMessages]
|
|
61
91
|
r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
|
|
62
|
-
|
|
63
|
-
|
|
92
|
+
|
|
93
|
+
temperature: OptionalNullable[float] = UNSET
|
|
94
|
+
r"""What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value."""
|
|
95
|
+
|
|
64
96
|
top_p: Optional[float] = 1
|
|
65
97
|
r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both."""
|
|
98
|
+
|
|
66
99
|
max_tokens: OptionalNullable[int] = UNSET
|
|
67
100
|
r"""The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length."""
|
|
68
|
-
|
|
69
|
-
r"""The minimum number of tokens to generate in the completion."""
|
|
101
|
+
|
|
70
102
|
stream: Optional[bool] = False
|
|
71
103
|
r"""Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON."""
|
|
104
|
+
|
|
72
105
|
stop: Optional[ChatCompletionRequestStop] = None
|
|
73
106
|
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
|
|
107
|
+
|
|
74
108
|
random_seed: OptionalNullable[int] = UNSET
|
|
75
109
|
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
110
|
+
|
|
76
111
|
response_format: Optional[ResponseFormat] = None
|
|
112
|
+
|
|
77
113
|
tools: OptionalNullable[List[Tool]] = UNSET
|
|
78
|
-
|
|
79
|
-
|
|
114
|
+
|
|
115
|
+
tool_choice: Optional[ChatCompletionRequestToolChoice] = None
|
|
116
|
+
|
|
117
|
+
presence_penalty: Optional[float] = 0
|
|
118
|
+
r"""presence_penalty determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative."""
|
|
119
|
+
|
|
120
|
+
frequency_penalty: Optional[float] = 0
|
|
121
|
+
r"""frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition."""
|
|
122
|
+
|
|
123
|
+
n: OptionalNullable[int] = UNSET
|
|
124
|
+
r"""Number of completions to return for each request, input tokens are only billed once."""
|
|
125
|
+
|
|
80
126
|
@model_serializer(mode="wrap")
|
|
81
127
|
def serialize_model(self, handler):
|
|
82
|
-
optional_fields = [
|
|
83
|
-
|
|
128
|
+
optional_fields = [
|
|
129
|
+
"temperature",
|
|
130
|
+
"top_p",
|
|
131
|
+
"max_tokens",
|
|
132
|
+
"stream",
|
|
133
|
+
"stop",
|
|
134
|
+
"random_seed",
|
|
135
|
+
"response_format",
|
|
136
|
+
"tools",
|
|
137
|
+
"tool_choice",
|
|
138
|
+
"presence_penalty",
|
|
139
|
+
"frequency_penalty",
|
|
140
|
+
"n",
|
|
141
|
+
]
|
|
142
|
+
nullable_fields = [
|
|
143
|
+
"model",
|
|
144
|
+
"temperature",
|
|
145
|
+
"max_tokens",
|
|
146
|
+
"random_seed",
|
|
147
|
+
"tools",
|
|
148
|
+
"n",
|
|
149
|
+
]
|
|
84
150
|
null_default_fields = []
|
|
85
151
|
|
|
86
152
|
serialized = handler(self)
|
|
@@ -90,9 +156,13 @@ class ChatCompletionRequest(BaseModel):
|
|
|
90
156
|
for n, f in self.model_fields.items():
|
|
91
157
|
k = f.alias or n
|
|
92
158
|
val = serialized.get(k)
|
|
159
|
+
serialized.pop(k, None)
|
|
93
160
|
|
|
94
161
|
optional_nullable = k in optional_fields and k in nullable_fields
|
|
95
|
-
is_set = (
|
|
162
|
+
is_set = (
|
|
163
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
164
|
+
or k in null_default_fields
|
|
165
|
+
) # pylint: disable=no-member
|
|
96
166
|
|
|
97
167
|
if val is not None and val != UNSET_SENTINEL:
|
|
98
168
|
m[k] = val
|
|
@@ -102,4 +172,3 @@ class ChatCompletionRequest(BaseModel):
|
|
|
102
172
|
m[k] = val
|
|
103
173
|
|
|
104
174
|
return m
|
|
105
|
-
|
|
@@ -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_gcp.types import BaseModel
|
|
7
|
-
from typing import List, Optional
|
|
8
|
-
from typing_extensions import NotRequired
|
|
7
|
+
from typing import List, Optional
|
|
8
|
+
from typing_extensions import NotRequired, TypedDict
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class ChatCompletionResponseTypedDict(TypedDict):
|
|
@@ -15,13 +15,17 @@ class ChatCompletionResponseTypedDict(TypedDict):
|
|
|
15
15
|
usage: UsageInfoTypedDict
|
|
16
16
|
created: NotRequired[int]
|
|
17
17
|
choices: NotRequired[List[ChatCompletionChoiceTypedDict]]
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
|
|
20
20
|
class ChatCompletionResponse(BaseModel):
|
|
21
21
|
id: str
|
|
22
|
+
|
|
22
23
|
object: str
|
|
24
|
+
|
|
23
25
|
model: str
|
|
26
|
+
|
|
24
27
|
usage: UsageInfo
|
|
28
|
+
|
|
25
29
|
created: Optional[int] = None
|
|
30
|
+
|
|
26
31
|
choices: Optional[List[ChatCompletionChoice]] = None
|
|
27
|
-
|