mistralai 0.4.2__py3-none-any.whl → 1.0.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 (246) hide show
  1. mistralai/__init__.py +5 -0
  2. mistralai/_hooks/__init__.py +5 -0
  3. mistralai/_hooks/custom_user_agent.py +16 -0
  4. mistralai/_hooks/deprecation_warning.py +26 -0
  5. mistralai/_hooks/registration.py +17 -0
  6. mistralai/_hooks/sdkhooks.py +57 -0
  7. mistralai/_hooks/types.py +76 -0
  8. mistralai/agents.py +434 -0
  9. mistralai/async_client.py +5 -413
  10. mistralai/basesdk.py +253 -0
  11. mistralai/chat.py +470 -0
  12. mistralai/client.py +5 -414
  13. mistralai/embeddings.py +182 -0
  14. mistralai/files.py +600 -84
  15. mistralai/fim.py +438 -0
  16. mistralai/fine_tuning.py +16 -0
  17. mistralai/httpclient.py +78 -0
  18. mistralai/jobs.py +822 -150
  19. mistralai/models/__init__.py +82 -0
  20. mistralai/models/agentscompletionrequest.py +96 -0
  21. mistralai/models/agentscompletionstreamrequest.py +92 -0
  22. mistralai/models/archiveftmodelout.py +19 -0
  23. mistralai/models/assistantmessage.py +53 -0
  24. mistralai/models/chatcompletionchoice.py +22 -0
  25. mistralai/models/chatcompletionrequest.py +109 -0
  26. mistralai/models/chatcompletionresponse.py +27 -0
  27. mistralai/models/chatcompletionstreamrequest.py +107 -0
  28. mistralai/models/checkpointout.py +25 -0
  29. mistralai/models/completionchunk.py +27 -0
  30. mistralai/models/completionevent.py +15 -0
  31. mistralai/models/completionresponsestreamchoice.py +48 -0
  32. mistralai/models/contentchunk.py +17 -0
  33. mistralai/models/delete_model_v1_models_model_id_deleteop.py +18 -0
  34. mistralai/models/deletefileout.py +24 -0
  35. mistralai/models/deletemodelout.py +25 -0
  36. mistralai/models/deltamessage.py +47 -0
  37. mistralai/models/detailedjobout.py +91 -0
  38. mistralai/models/embeddingrequest.py +61 -0
  39. mistralai/models/embeddingresponse.py +24 -0
  40. mistralai/models/embeddingresponsedata.py +19 -0
  41. mistralai/models/eventout.py +50 -0
  42. mistralai/models/files_api_routes_delete_fileop.py +16 -0
  43. mistralai/models/files_api_routes_retrieve_fileop.py +16 -0
  44. mistralai/models/files_api_routes_upload_fileop.py +51 -0
  45. mistralai/models/fileschema.py +71 -0
  46. mistralai/models/fimcompletionrequest.py +94 -0
  47. mistralai/models/fimcompletionresponse.py +27 -0
  48. mistralai/models/fimcompletionstreamrequest.py +92 -0
  49. mistralai/models/finetuneablemodel.py +8 -0
  50. mistralai/models/ftmodelcapabilitiesout.py +21 -0
  51. mistralai/models/ftmodelout.py +65 -0
  52. mistralai/models/function.py +19 -0
  53. mistralai/models/functioncall.py +22 -0
  54. mistralai/models/githubrepositoryin.py +52 -0
  55. mistralai/models/githubrepositoryout.py +52 -0
  56. mistralai/models/httpvalidationerror.py +23 -0
  57. mistralai/models/jobin.py +73 -0
  58. mistralai/models/jobmetadataout.py +54 -0
  59. mistralai/models/jobout.py +107 -0
  60. mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +18 -0
  61. mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +18 -0
  62. mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +15 -0
  63. mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +18 -0
  64. mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +81 -0
  65. mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +16 -0
  66. mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +18 -0
  67. mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +21 -0
  68. mistralai/models/jobsout.py +20 -0
  69. mistralai/models/legacyjobmetadataout.py +80 -0
  70. mistralai/models/listfilesout.py +17 -0
  71. mistralai/models/metricout.py +50 -0
  72. mistralai/models/modelcapabilities.py +21 -0
  73. mistralai/models/modelcard.py +66 -0
  74. mistralai/models/modellist.py +18 -0
  75. mistralai/models/responseformat.py +18 -0
  76. mistralai/models/retrieve_model_v1_models_model_id_getop.py +18 -0
  77. mistralai/models/retrievefileout.py +71 -0
  78. mistralai/models/sampletype.py +7 -0
  79. mistralai/models/sdkerror.py +22 -0
  80. mistralai/models/security.py +16 -0
  81. mistralai/models/source.py +7 -0
  82. mistralai/models/systemmessage.py +26 -0
  83. mistralai/models/textchunk.py +17 -0
  84. mistralai/models/tool.py +18 -0
  85. mistralai/models/toolcall.py +20 -0
  86. mistralai/models/toolmessage.py +50 -0
  87. mistralai/models/trainingfile.py +17 -0
  88. mistralai/models/trainingparameters.py +48 -0
  89. mistralai/models/trainingparametersin.py +56 -0
  90. mistralai/models/unarchiveftmodelout.py +19 -0
  91. mistralai/models/updateftmodelin.py +44 -0
  92. mistralai/models/uploadfileout.py +71 -0
  93. mistralai/models/usageinfo.py +18 -0
  94. mistralai/models/usermessage.py +26 -0
  95. mistralai/models/validationerror.py +24 -0
  96. mistralai/models/wandbintegration.py +56 -0
  97. mistralai/models/wandbintegrationout.py +52 -0
  98. mistralai/models_.py +928 -0
  99. mistralai/py.typed +1 -0
  100. mistralai/sdk.py +119 -0
  101. mistralai/sdkconfiguration.py +54 -0
  102. mistralai/types/__init__.py +21 -0
  103. mistralai/types/basemodel.py +39 -0
  104. mistralai/utils/__init__.py +86 -0
  105. mistralai/utils/annotations.py +19 -0
  106. mistralai/utils/enums.py +34 -0
  107. mistralai/utils/eventstreaming.py +178 -0
  108. mistralai/utils/forms.py +207 -0
  109. mistralai/utils/headers.py +136 -0
  110. mistralai/utils/logger.py +16 -0
  111. mistralai/utils/metadata.py +118 -0
  112. mistralai/utils/queryparams.py +203 -0
  113. mistralai/utils/requestbodies.py +66 -0
  114. mistralai/utils/retries.py +216 -0
  115. mistralai/utils/security.py +185 -0
  116. mistralai/utils/serializers.py +181 -0
  117. mistralai/utils/url.py +150 -0
  118. mistralai/utils/values.py +128 -0
  119. {mistralai-0.4.2.dist-info → mistralai-1.0.0.dist-info}/LICENSE +1 -1
  120. mistralai-1.0.0.dist-info/METADATA +695 -0
  121. mistralai-1.0.0.dist-info/RECORD +235 -0
  122. mistralai_azure/__init__.py +5 -0
  123. mistralai_azure/_hooks/__init__.py +5 -0
  124. mistralai_azure/_hooks/custom_user_agent.py +16 -0
  125. mistralai_azure/_hooks/registration.py +15 -0
  126. mistralai_azure/_hooks/sdkhooks.py +57 -0
  127. mistralai_azure/_hooks/types.py +76 -0
  128. mistralai_azure/basesdk.py +253 -0
  129. mistralai_azure/chat.py +470 -0
  130. mistralai_azure/httpclient.py +78 -0
  131. mistralai_azure/models/__init__.py +28 -0
  132. mistralai_azure/models/assistantmessage.py +53 -0
  133. mistralai_azure/models/chatcompletionchoice.py +22 -0
  134. mistralai_azure/models/chatcompletionrequest.py +109 -0
  135. mistralai_azure/models/chatcompletionresponse.py +27 -0
  136. mistralai_azure/models/chatcompletionstreamrequest.py +107 -0
  137. mistralai_azure/models/completionchunk.py +27 -0
  138. mistralai_azure/models/completionevent.py +15 -0
  139. mistralai_azure/models/completionresponsestreamchoice.py +48 -0
  140. mistralai_azure/models/contentchunk.py +17 -0
  141. mistralai_azure/models/deltamessage.py +47 -0
  142. mistralai_azure/models/function.py +19 -0
  143. mistralai_azure/models/functioncall.py +22 -0
  144. mistralai_azure/models/httpvalidationerror.py +23 -0
  145. mistralai_azure/models/responseformat.py +18 -0
  146. mistralai_azure/models/sdkerror.py +22 -0
  147. mistralai_azure/models/security.py +16 -0
  148. mistralai_azure/models/systemmessage.py +26 -0
  149. mistralai_azure/models/textchunk.py +17 -0
  150. mistralai_azure/models/tool.py +18 -0
  151. mistralai_azure/models/toolcall.py +20 -0
  152. mistralai_azure/models/toolmessage.py +50 -0
  153. mistralai_azure/models/usageinfo.py +18 -0
  154. mistralai_azure/models/usermessage.py +26 -0
  155. mistralai_azure/models/validationerror.py +24 -0
  156. mistralai_azure/py.typed +1 -0
  157. mistralai_azure/sdk.py +107 -0
  158. mistralai_azure/sdkconfiguration.py +54 -0
  159. mistralai_azure/types/__init__.py +21 -0
  160. mistralai_azure/types/basemodel.py +39 -0
  161. mistralai_azure/utils/__init__.py +84 -0
  162. mistralai_azure/utils/annotations.py +19 -0
  163. mistralai_azure/utils/enums.py +34 -0
  164. mistralai_azure/utils/eventstreaming.py +178 -0
  165. mistralai_azure/utils/forms.py +207 -0
  166. mistralai_azure/utils/headers.py +136 -0
  167. mistralai_azure/utils/logger.py +16 -0
  168. mistralai_azure/utils/metadata.py +118 -0
  169. mistralai_azure/utils/queryparams.py +203 -0
  170. mistralai_azure/utils/requestbodies.py +66 -0
  171. mistralai_azure/utils/retries.py +216 -0
  172. mistralai_azure/utils/security.py +168 -0
  173. mistralai_azure/utils/serializers.py +181 -0
  174. mistralai_azure/utils/url.py +150 -0
  175. mistralai_azure/utils/values.py +128 -0
  176. mistralai_gcp/__init__.py +5 -0
  177. mistralai_gcp/_hooks/__init__.py +5 -0
  178. mistralai_gcp/_hooks/custom_user_agent.py +16 -0
  179. mistralai_gcp/_hooks/registration.py +15 -0
  180. mistralai_gcp/_hooks/sdkhooks.py +57 -0
  181. mistralai_gcp/_hooks/types.py +76 -0
  182. mistralai_gcp/basesdk.py +253 -0
  183. mistralai_gcp/chat.py +458 -0
  184. mistralai_gcp/fim.py +438 -0
  185. mistralai_gcp/httpclient.py +78 -0
  186. mistralai_gcp/models/__init__.py +31 -0
  187. mistralai_gcp/models/assistantmessage.py +53 -0
  188. mistralai_gcp/models/chatcompletionchoice.py +22 -0
  189. mistralai_gcp/models/chatcompletionrequest.py +105 -0
  190. mistralai_gcp/models/chatcompletionresponse.py +27 -0
  191. mistralai_gcp/models/chatcompletionstreamrequest.py +103 -0
  192. mistralai_gcp/models/completionchunk.py +27 -0
  193. mistralai_gcp/models/completionevent.py +15 -0
  194. mistralai_gcp/models/completionresponsestreamchoice.py +48 -0
  195. mistralai_gcp/models/contentchunk.py +17 -0
  196. mistralai_gcp/models/deltamessage.py +47 -0
  197. mistralai_gcp/models/fimcompletionrequest.py +94 -0
  198. mistralai_gcp/models/fimcompletionresponse.py +27 -0
  199. mistralai_gcp/models/fimcompletionstreamrequest.py +92 -0
  200. mistralai_gcp/models/function.py +19 -0
  201. mistralai_gcp/models/functioncall.py +22 -0
  202. mistralai_gcp/models/httpvalidationerror.py +23 -0
  203. mistralai_gcp/models/responseformat.py +18 -0
  204. mistralai_gcp/models/sdkerror.py +22 -0
  205. mistralai_gcp/models/security.py +16 -0
  206. mistralai_gcp/models/systemmessage.py +26 -0
  207. mistralai_gcp/models/textchunk.py +17 -0
  208. mistralai_gcp/models/tool.py +18 -0
  209. mistralai_gcp/models/toolcall.py +20 -0
  210. mistralai_gcp/models/toolmessage.py +50 -0
  211. mistralai_gcp/models/usageinfo.py +18 -0
  212. mistralai_gcp/models/usermessage.py +26 -0
  213. mistralai_gcp/models/validationerror.py +24 -0
  214. mistralai_gcp/py.typed +1 -0
  215. mistralai_gcp/sdk.py +174 -0
  216. mistralai_gcp/sdkconfiguration.py +54 -0
  217. mistralai_gcp/types/__init__.py +21 -0
  218. mistralai_gcp/types/basemodel.py +39 -0
  219. mistralai_gcp/utils/__init__.py +84 -0
  220. mistralai_gcp/utils/annotations.py +19 -0
  221. mistralai_gcp/utils/enums.py +34 -0
  222. mistralai_gcp/utils/eventstreaming.py +178 -0
  223. mistralai_gcp/utils/forms.py +207 -0
  224. mistralai_gcp/utils/headers.py +136 -0
  225. mistralai_gcp/utils/logger.py +16 -0
  226. mistralai_gcp/utils/metadata.py +118 -0
  227. mistralai_gcp/utils/queryparams.py +203 -0
  228. mistralai_gcp/utils/requestbodies.py +66 -0
  229. mistralai_gcp/utils/retries.py +216 -0
  230. mistralai_gcp/utils/security.py +168 -0
  231. mistralai_gcp/utils/serializers.py +181 -0
  232. mistralai_gcp/utils/url.py +150 -0
  233. mistralai_gcp/utils/values.py +128 -0
  234. py.typed +1 -0
  235. mistralai/client_base.py +0 -211
  236. mistralai/constants.py +0 -5
  237. mistralai/exceptions.py +0 -54
  238. mistralai/models/chat_completion.py +0 -93
  239. mistralai/models/common.py +0 -9
  240. mistralai/models/embeddings.py +0 -19
  241. mistralai/models/files.py +0 -23
  242. mistralai/models/jobs.py +0 -100
  243. mistralai/models/models.py +0 -39
  244. mistralai-0.4.2.dist-info/METADATA +0 -82
  245. mistralai-0.4.2.dist-info/RECORD +0 -20
  246. {mistralai-0.4.2.dist-info → mistralai-1.0.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,82 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .agentscompletionrequest import AgentsCompletionRequest, AgentsCompletionRequestMessages, AgentsCompletionRequestMessagesTypedDict, AgentsCompletionRequestStop, AgentsCompletionRequestStopTypedDict, AgentsCompletionRequestToolChoice, AgentsCompletionRequestTypedDict
4
+ from .agentscompletionstreamrequest import AgentsCompletionStreamRequest, AgentsCompletionStreamRequestStop, AgentsCompletionStreamRequestStopTypedDict, AgentsCompletionStreamRequestTypedDict
5
+ from .archiveftmodelout import ArchiveFTModelOut, ArchiveFTModelOutTypedDict
6
+ from .assistantmessage import AssistantMessage, AssistantMessageRole, AssistantMessageTypedDict
7
+ from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceTypedDict, FinishReason
8
+ from .chatcompletionrequest import ChatCompletionRequest, ChatCompletionRequestTypedDict, Messages, MessagesTypedDict, Stop, StopTypedDict, ToolChoice
9
+ from .chatcompletionresponse import ChatCompletionResponse, ChatCompletionResponseTypedDict
10
+ from .chatcompletionstreamrequest import ChatCompletionStreamRequest, ChatCompletionStreamRequestMessages, ChatCompletionStreamRequestMessagesTypedDict, ChatCompletionStreamRequestStop, ChatCompletionStreamRequestStopTypedDict, ChatCompletionStreamRequestToolChoice, ChatCompletionStreamRequestTypedDict
11
+ from .checkpointout import CheckpointOut, CheckpointOutTypedDict
12
+ from .completionchunk import CompletionChunk, CompletionChunkTypedDict
13
+ from .completionevent import CompletionEvent, CompletionEventTypedDict
14
+ from .completionresponsestreamchoice import CompletionResponseStreamChoice, CompletionResponseStreamChoiceFinishReason, CompletionResponseStreamChoiceTypedDict
15
+ from .contentchunk import ContentChunk, ContentChunkTypedDict
16
+ from .delete_model_v1_models_model_id_deleteop import DeleteModelV1ModelsModelIDDeleteRequest, DeleteModelV1ModelsModelIDDeleteRequestTypedDict
17
+ from .deletefileout import DeleteFileOut, DeleteFileOutTypedDict
18
+ from .deletemodelout import DeleteModelOut, DeleteModelOutTypedDict
19
+ from .deltamessage import DeltaMessage, DeltaMessageTypedDict
20
+ from .detailedjobout import DetailedJobOut, DetailedJobOutStatus, DetailedJobOutTypedDict
21
+ from .embeddingrequest import EmbeddingRequest, EmbeddingRequestTypedDict, Inputs, InputsTypedDict
22
+ from .embeddingresponse import EmbeddingResponse, EmbeddingResponseTypedDict
23
+ from .embeddingresponsedata import EmbeddingResponseData, EmbeddingResponseDataTypedDict
24
+ from .eventout import EventOut, EventOutTypedDict
25
+ from .files_api_routes_delete_fileop import FilesAPIRoutesDeleteFileRequest, FilesAPIRoutesDeleteFileRequestTypedDict
26
+ from .files_api_routes_retrieve_fileop import FilesAPIRoutesRetrieveFileRequest, FilesAPIRoutesRetrieveFileRequestTypedDict
27
+ from .files_api_routes_upload_fileop import File, FileTypedDict, FilesAPIRoutesUploadFileMultiPartBodyParams, FilesAPIRoutesUploadFileMultiPartBodyParamsTypedDict
28
+ from .fileschema import FileSchema, FileSchemaTypedDict
29
+ from .fimcompletionrequest import FIMCompletionRequest, FIMCompletionRequestStop, FIMCompletionRequestStopTypedDict, FIMCompletionRequestTypedDict
30
+ from .fimcompletionresponse import FIMCompletionResponse, FIMCompletionResponseTypedDict
31
+ from .fimcompletionstreamrequest import FIMCompletionStreamRequest, FIMCompletionStreamRequestStop, FIMCompletionStreamRequestStopTypedDict, FIMCompletionStreamRequestTypedDict
32
+ from .finetuneablemodel import FineTuneableModel
33
+ from .ftmodelcapabilitiesout import FTModelCapabilitiesOut, FTModelCapabilitiesOutTypedDict
34
+ from .ftmodelout import FTModelOut, FTModelOutTypedDict
35
+ from .function import Function, FunctionTypedDict
36
+ from .functioncall import Arguments, ArgumentsTypedDict, FunctionCall, FunctionCallTypedDict
37
+ from .githubrepositoryin import GithubRepositoryIn, GithubRepositoryInTypedDict
38
+ from .githubrepositoryout import GithubRepositoryOut, GithubRepositoryOutTypedDict
39
+ from .httpvalidationerror import HTTPValidationError, HTTPValidationErrorData
40
+ from .jobin import JobIn, JobInTypedDict
41
+ from .jobmetadataout import JobMetadataOut, JobMetadataOutTypedDict
42
+ from .jobout import JobOut, JobOutTypedDict, Status
43
+ from .jobs_api_routes_fine_tuning_archive_fine_tuned_modelop import JobsAPIRoutesFineTuningArchiveFineTunedModelRequest, JobsAPIRoutesFineTuningArchiveFineTunedModelRequestTypedDict
44
+ from .jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop import JobsAPIRoutesFineTuningCancelFineTuningJobRequest, JobsAPIRoutesFineTuningCancelFineTuningJobRequestTypedDict
45
+ from .jobs_api_routes_fine_tuning_create_fine_tuning_jobop import JobsAPIRoutesFineTuningCreateFineTuningJobResponse, JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict
46
+ from .jobs_api_routes_fine_tuning_get_fine_tuning_jobop import JobsAPIRoutesFineTuningGetFineTuningJobRequest, JobsAPIRoutesFineTuningGetFineTuningJobRequestTypedDict
47
+ from .jobs_api_routes_fine_tuning_get_fine_tuning_jobsop import JobsAPIRoutesFineTuningGetFineTuningJobsRequest, JobsAPIRoutesFineTuningGetFineTuningJobsRequestTypedDict, QueryParamStatus
48
+ from .jobs_api_routes_fine_tuning_start_fine_tuning_jobop import JobsAPIRoutesFineTuningStartFineTuningJobRequest, JobsAPIRoutesFineTuningStartFineTuningJobRequestTypedDict
49
+ from .jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop import JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequest, JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequestTypedDict
50
+ from .jobs_api_routes_fine_tuning_update_fine_tuned_modelop import JobsAPIRoutesFineTuningUpdateFineTunedModelRequest, JobsAPIRoutesFineTuningUpdateFineTunedModelRequestTypedDict
51
+ from .jobsout import JobsOut, JobsOutTypedDict
52
+ from .legacyjobmetadataout import LegacyJobMetadataOut, LegacyJobMetadataOutTypedDict
53
+ from .listfilesout import ListFilesOut, ListFilesOutTypedDict
54
+ from .metricout import MetricOut, MetricOutTypedDict
55
+ from .modelcapabilities import ModelCapabilities, ModelCapabilitiesTypedDict
56
+ from .modelcard import ModelCard, ModelCardTypedDict
57
+ from .modellist import ModelList, ModelListTypedDict
58
+ from .responseformat import ResponseFormat, ResponseFormatTypedDict, ResponseFormats
59
+ from .retrieve_model_v1_models_model_id_getop import RetrieveModelV1ModelsModelIDGetRequest, RetrieveModelV1ModelsModelIDGetRequestTypedDict
60
+ from .retrievefileout import RetrieveFileOut, RetrieveFileOutTypedDict
61
+ from .sampletype import SampleType
62
+ from .sdkerror import SDKError
63
+ from .security import Security, SecurityTypedDict
64
+ from .source import Source
65
+ from .systemmessage import Content, ContentTypedDict, Role, SystemMessage, SystemMessageTypedDict
66
+ from .textchunk import TextChunk, TextChunkTypedDict
67
+ from .tool import Tool, ToolTypedDict
68
+ from .toolcall import ToolCall, ToolCallTypedDict
69
+ from .toolmessage import ToolMessage, ToolMessageRole, ToolMessageTypedDict
70
+ from .trainingfile import TrainingFile, TrainingFileTypedDict
71
+ from .trainingparameters import TrainingParameters, TrainingParametersTypedDict
72
+ from .trainingparametersin import TrainingParametersIn, TrainingParametersInTypedDict
73
+ from .unarchiveftmodelout import UnarchiveFTModelOut, UnarchiveFTModelOutTypedDict
74
+ from .updateftmodelin import UpdateFTModelIn, UpdateFTModelInTypedDict
75
+ from .uploadfileout import UploadFileOut, UploadFileOutTypedDict
76
+ from .usageinfo import UsageInfo, UsageInfoTypedDict
77
+ from .usermessage import UserMessage, UserMessageContent, UserMessageContentTypedDict, UserMessageRole, UserMessageTypedDict
78
+ from .validationerror import Loc, LocTypedDict, ValidationError, ValidationErrorTypedDict
79
+ from .wandbintegration import WandbIntegration, WandbIntegrationTypedDict
80
+ from .wandbintegrationout import WandbIntegrationOut, WandbIntegrationOutTypedDict
81
+
82
+ __all__ = ["AgentsCompletionRequest", "AgentsCompletionRequestMessages", "AgentsCompletionRequestMessagesTypedDict", "AgentsCompletionRequestStop", "AgentsCompletionRequestStopTypedDict", "AgentsCompletionRequestToolChoice", "AgentsCompletionRequestTypedDict", "AgentsCompletionStreamRequest", "AgentsCompletionStreamRequestStop", "AgentsCompletionStreamRequestStopTypedDict", "AgentsCompletionStreamRequestTypedDict", "ArchiveFTModelOut", "ArchiveFTModelOutTypedDict", "Arguments", "ArgumentsTypedDict", "AssistantMessage", "AssistantMessageRole", "AssistantMessageTypedDict", "ChatCompletionChoice", "ChatCompletionChoiceTypedDict", "ChatCompletionRequest", "ChatCompletionRequestTypedDict", "ChatCompletionResponse", "ChatCompletionResponseTypedDict", "ChatCompletionStreamRequest", "ChatCompletionStreamRequestMessages", "ChatCompletionStreamRequestMessagesTypedDict", "ChatCompletionStreamRequestStop", "ChatCompletionStreamRequestStopTypedDict", "ChatCompletionStreamRequestToolChoice", "ChatCompletionStreamRequestTypedDict", "CheckpointOut", "CheckpointOutTypedDict", "CompletionChunk", "CompletionChunkTypedDict", "CompletionEvent", "CompletionEventTypedDict", "CompletionResponseStreamChoice", "CompletionResponseStreamChoiceFinishReason", "CompletionResponseStreamChoiceTypedDict", "Content", "ContentChunk", "ContentChunkTypedDict", "ContentTypedDict", "DeleteFileOut", "DeleteFileOutTypedDict", "DeleteModelOut", "DeleteModelOutTypedDict", "DeleteModelV1ModelsModelIDDeleteRequest", "DeleteModelV1ModelsModelIDDeleteRequestTypedDict", "DeltaMessage", "DeltaMessageTypedDict", "DetailedJobOut", "DetailedJobOutStatus", "DetailedJobOutTypedDict", "EmbeddingRequest", "EmbeddingRequestTypedDict", "EmbeddingResponse", "EmbeddingResponseData", "EmbeddingResponseDataTypedDict", "EmbeddingResponseTypedDict", "EventOut", "EventOutTypedDict", "FIMCompletionRequest", "FIMCompletionRequestStop", "FIMCompletionRequestStopTypedDict", "FIMCompletionRequestTypedDict", "FIMCompletionResponse", "FIMCompletionResponseTypedDict", "FIMCompletionStreamRequest", "FIMCompletionStreamRequestStop", "FIMCompletionStreamRequestStopTypedDict", "FIMCompletionStreamRequestTypedDict", "FTModelCapabilitiesOut", "FTModelCapabilitiesOutTypedDict", "FTModelOut", "FTModelOutTypedDict", "File", "FileSchema", "FileSchemaTypedDict", "FileTypedDict", "FilesAPIRoutesDeleteFileRequest", "FilesAPIRoutesDeleteFileRequestTypedDict", "FilesAPIRoutesRetrieveFileRequest", "FilesAPIRoutesRetrieveFileRequestTypedDict", "FilesAPIRoutesUploadFileMultiPartBodyParams", "FilesAPIRoutesUploadFileMultiPartBodyParamsTypedDict", "FineTuneableModel", "FinishReason", "Function", "FunctionCall", "FunctionCallTypedDict", "FunctionTypedDict", "GithubRepositoryIn", "GithubRepositoryInTypedDict", "GithubRepositoryOut", "GithubRepositoryOutTypedDict", "HTTPValidationError", "HTTPValidationErrorData", "Inputs", "InputsTypedDict", "JobIn", "JobInTypedDict", "JobMetadataOut", "JobMetadataOutTypedDict", "JobOut", "JobOutTypedDict", "JobsAPIRoutesFineTuningArchiveFineTunedModelRequest", "JobsAPIRoutesFineTuningArchiveFineTunedModelRequestTypedDict", "JobsAPIRoutesFineTuningCancelFineTuningJobRequest", "JobsAPIRoutesFineTuningCancelFineTuningJobRequestTypedDict", "JobsAPIRoutesFineTuningCreateFineTuningJobResponse", "JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict", "JobsAPIRoutesFineTuningGetFineTuningJobRequest", "JobsAPIRoutesFineTuningGetFineTuningJobRequestTypedDict", "JobsAPIRoutesFineTuningGetFineTuningJobsRequest", "JobsAPIRoutesFineTuningGetFineTuningJobsRequestTypedDict", "JobsAPIRoutesFineTuningStartFineTuningJobRequest", "JobsAPIRoutesFineTuningStartFineTuningJobRequestTypedDict", "JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequest", "JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequestTypedDict", "JobsAPIRoutesFineTuningUpdateFineTunedModelRequest", "JobsAPIRoutesFineTuningUpdateFineTunedModelRequestTypedDict", "JobsOut", "JobsOutTypedDict", "LegacyJobMetadataOut", "LegacyJobMetadataOutTypedDict", "ListFilesOut", "ListFilesOutTypedDict", "Loc", "LocTypedDict", "Messages", "MessagesTypedDict", "MetricOut", "MetricOutTypedDict", "ModelCapabilities", "ModelCapabilitiesTypedDict", "ModelCard", "ModelCardTypedDict", "ModelList", "ModelListTypedDict", "QueryParamStatus", "ResponseFormat", "ResponseFormatTypedDict", "ResponseFormats", "RetrieveFileOut", "RetrieveFileOutTypedDict", "RetrieveModelV1ModelsModelIDGetRequest", "RetrieveModelV1ModelsModelIDGetRequestTypedDict", "Role", "SDKError", "SampleType", "Security", "SecurityTypedDict", "Source", "Status", "Stop", "StopTypedDict", "SystemMessage", "SystemMessageTypedDict", "TextChunk", "TextChunkTypedDict", "Tool", "ToolCall", "ToolCallTypedDict", "ToolChoice", "ToolMessage", "ToolMessageRole", "ToolMessageTypedDict", "ToolTypedDict", "TrainingFile", "TrainingFileTypedDict", "TrainingParameters", "TrainingParametersIn", "TrainingParametersInTypedDict", "TrainingParametersTypedDict", "UnarchiveFTModelOut", "UnarchiveFTModelOutTypedDict", "UpdateFTModelIn", "UpdateFTModelInTypedDict", "UploadFileOut", "UploadFileOutTypedDict", "UsageInfo", "UsageInfoTypedDict", "UserMessage", "UserMessageContent", "UserMessageContentTypedDict", "UserMessageRole", "UserMessageTypedDict", "ValidationError", "ValidationErrorTypedDict", "WandbIntegration", "WandbIntegrationOut", "WandbIntegrationOutTypedDict", "WandbIntegrationTypedDict"]
@@ -0,0 +1,96 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
5
+ from .responseformat import ResponseFormat, ResponseFormatTypedDict
6
+ from .tool import Tool, ToolTypedDict
7
+ from .toolmessage import ToolMessage, ToolMessageTypedDict
8
+ from .usermessage import UserMessage, UserMessageTypedDict
9
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
10
+ from mistralai.utils import get_discriminator
11
+ from pydantic import Discriminator, Tag, model_serializer
12
+ from typing import List, Literal, Optional, TypedDict, Union
13
+ from typing_extensions import Annotated, NotRequired
14
+
15
+
16
+ AgentsCompletionRequestToolChoice = Literal["auto", "none", "any"]
17
+
18
+ class AgentsCompletionRequestTypedDict(TypedDict):
19
+ messages: List[AgentsCompletionRequestMessagesTypedDict]
20
+ r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
21
+ agent_id: str
22
+ r"""The ID of the agent to use for this completion."""
23
+ max_tokens: NotRequired[Nullable[int]]
24
+ 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."""
25
+ min_tokens: NotRequired[Nullable[int]]
26
+ r"""The minimum number of tokens to generate in the completion."""
27
+ stream: NotRequired[bool]
28
+ 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."""
29
+ stop: NotRequired[AgentsCompletionRequestStopTypedDict]
30
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
31
+ random_seed: NotRequired[Nullable[int]]
32
+ r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
33
+ response_format: NotRequired[ResponseFormatTypedDict]
34
+ tools: NotRequired[Nullable[List[ToolTypedDict]]]
35
+ tool_choice: NotRequired[AgentsCompletionRequestToolChoice]
36
+
37
+
38
+ class AgentsCompletionRequest(BaseModel):
39
+ messages: List[AgentsCompletionRequestMessages]
40
+ r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
41
+ agent_id: str
42
+ r"""The ID of the agent to use for this completion."""
43
+ max_tokens: OptionalNullable[int] = UNSET
44
+ 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."""
45
+ min_tokens: OptionalNullable[int] = UNSET
46
+ r"""The minimum number of tokens to generate in the completion."""
47
+ stream: Optional[bool] = False
48
+ 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."""
49
+ stop: Optional[AgentsCompletionRequestStop] = None
50
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
51
+ random_seed: OptionalNullable[int] = UNSET
52
+ r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
53
+ response_format: Optional[ResponseFormat] = None
54
+ tools: OptionalNullable[List[Tool]] = UNSET
55
+ tool_choice: Optional[AgentsCompletionRequestToolChoice] = "auto"
56
+
57
+ @model_serializer(mode="wrap")
58
+ def serialize_model(self, handler):
59
+ optional_fields = ["max_tokens", "min_tokens", "stream", "stop", "random_seed", "response_format", "tools", "tool_choice"]
60
+ nullable_fields = ["max_tokens", "min_tokens", "random_seed", "tools"]
61
+ null_default_fields = []
62
+
63
+ serialized = handler(self)
64
+
65
+ m = {}
66
+
67
+ for n, f in self.model_fields.items():
68
+ k = f.alias or n
69
+ val = serialized.get(k)
70
+
71
+ optional_nullable = k in optional_fields and k in nullable_fields
72
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
73
+
74
+ if val is not None and val != UNSET_SENTINEL:
75
+ m[k] = val
76
+ elif val != UNSET_SENTINEL and (
77
+ not k in optional_fields or (optional_nullable and is_set)
78
+ ):
79
+ m[k] = val
80
+
81
+ return m
82
+
83
+
84
+ AgentsCompletionRequestStopTypedDict = Union[str, List[str]]
85
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
86
+
87
+
88
+ AgentsCompletionRequestStop = Union[str, List[str]]
89
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
90
+
91
+
92
+ AgentsCompletionRequestMessagesTypedDict = Union[UserMessageTypedDict, AssistantMessageTypedDict, ToolMessageTypedDict]
93
+
94
+
95
+ AgentsCompletionRequestMessages = Annotated[Union[Annotated[AssistantMessage, Tag("assistant")], Annotated[ToolMessage, Tag("tool")], Annotated[UserMessage, Tag("user")]], Discriminator(lambda m: get_discriminator(m, "role", "role"))]
96
+
@@ -0,0 +1,92 @@
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 List, Optional, TypedDict, Union
7
+ from typing_extensions import NotRequired
8
+
9
+
10
+ class AgentsCompletionStreamRequestTypedDict(TypedDict):
11
+ model: Nullable[str]
12
+ r"""ID of the model to use. Only compatible for now with:
13
+ - `codestral-2405`
14
+ - `codestral-latest`
15
+ """
16
+ prompt: str
17
+ r"""The text/code to complete."""
18
+ temperature: NotRequired[float]
19
+ r"""What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 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."""
20
+ top_p: NotRequired[float]
21
+ 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."""
22
+ max_tokens: NotRequired[Nullable[int]]
23
+ 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."""
24
+ min_tokens: NotRequired[Nullable[int]]
25
+ r"""The minimum number of tokens to generate in the completion."""
26
+ stream: NotRequired[bool]
27
+ stop: NotRequired[AgentsCompletionStreamRequestStopTypedDict]
28
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
29
+ random_seed: NotRequired[Nullable[int]]
30
+ r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
31
+ suffix: NotRequired[Nullable[str]]
32
+ r"""Optional text/code that adds more context for the model. When given a `prompt` and a `suffix` the model will fill what is between them. When `suffix` is not provided, the model will simply execute completion starting with `prompt`."""
33
+
34
+
35
+ class AgentsCompletionStreamRequest(BaseModel):
36
+ model: Nullable[str]
37
+ r"""ID of the model to use. Only compatible for now with:
38
+ - `codestral-2405`
39
+ - `codestral-latest`
40
+ """
41
+ prompt: str
42
+ r"""The text/code to complete."""
43
+ temperature: Optional[float] = 0.7
44
+ r"""What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 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."""
45
+ top_p: Optional[float] = 1
46
+ 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."""
47
+ max_tokens: OptionalNullable[int] = UNSET
48
+ 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."""
49
+ min_tokens: OptionalNullable[int] = UNSET
50
+ r"""The minimum number of tokens to generate in the completion."""
51
+ stream: Optional[bool] = True
52
+ stop: Optional[AgentsCompletionStreamRequestStop] = None
53
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
54
+ random_seed: OptionalNullable[int] = UNSET
55
+ r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
56
+ suffix: OptionalNullable[str] = UNSET
57
+ r"""Optional text/code that adds more context for the model. When given a `prompt` and a `suffix` the model will fill what is between them. When `suffix` is not provided, the model will simply execute completion starting with `prompt`."""
58
+
59
+ @model_serializer(mode="wrap")
60
+ def serialize_model(self, handler):
61
+ optional_fields = ["temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "suffix"]
62
+ nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "suffix"]
63
+ null_default_fields = []
64
+
65
+ serialized = handler(self)
66
+
67
+ m = {}
68
+
69
+ for n, f in self.model_fields.items():
70
+ k = f.alias or n
71
+ val = serialized.get(k)
72
+
73
+ optional_nullable = k in optional_fields and k in nullable_fields
74
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
75
+
76
+ if val is not None and val != UNSET_SENTINEL:
77
+ m[k] = val
78
+ elif val != UNSET_SENTINEL and (
79
+ not k in optional_fields or (optional_nullable and is_set)
80
+ ):
81
+ m[k] = val
82
+
83
+ return m
84
+
85
+
86
+ AgentsCompletionStreamRequestStopTypedDict = Union[str, List[str]]
87
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
88
+
89
+
90
+ AgentsCompletionStreamRequestStop = Union[str, List[str]]
91
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
92
+
@@ -0,0 +1,19 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel
5
+ import pydantic
6
+ from typing import Final, Optional, TypedDict
7
+ from typing_extensions import Annotated, NotRequired
8
+
9
+
10
+ class ArchiveFTModelOutTypedDict(TypedDict):
11
+ id: str
12
+ archived: NotRequired[bool]
13
+
14
+
15
+ class ArchiveFTModelOut(BaseModel):
16
+ id: str
17
+ OBJECT: Annotated[Final[Optional[str]], pydantic.Field(alias="object")] = "model" # type: ignore
18
+ archived: Optional[bool] = True
19
+
@@ -0,0 +1,53 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .toolcall import ToolCall, ToolCallTypedDict
5
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
6
+ from pydantic import model_serializer
7
+ from typing import List, Literal, Optional, TypedDict
8
+ from typing_extensions import NotRequired
9
+
10
+
11
+ AssistantMessageRole = Literal["assistant"]
12
+
13
+ class AssistantMessageTypedDict(TypedDict):
14
+ content: NotRequired[Nullable[str]]
15
+ tool_calls: NotRequired[Nullable[List[ToolCallTypedDict]]]
16
+ 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
+ role: NotRequired[AssistantMessageRole]
19
+
20
+
21
+ class AssistantMessage(BaseModel):
22
+ content: OptionalNullable[str] = UNSET
23
+ tool_calls: OptionalNullable[List[ToolCall]] = UNSET
24
+ prefix: Optional[bool] = False
25
+ 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."""
26
+ role: Optional[AssistantMessageRole] = "assistant"
27
+
28
+ @model_serializer(mode="wrap")
29
+ def serialize_model(self, handler):
30
+ optional_fields = ["content", "tool_calls", "prefix", "role"]
31
+ nullable_fields = ["content", "tool_calls"]
32
+ null_default_fields = []
33
+
34
+ serialized = handler(self)
35
+
36
+ m = {}
37
+
38
+ for n, f in self.model_fields.items():
39
+ k = f.alias or n
40
+ val = serialized.get(k)
41
+
42
+ optional_nullable = k in optional_fields and k in nullable_fields
43
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
44
+
45
+ if val is not None and val != UNSET_SENTINEL:
46
+ m[k] = val
47
+ elif val != UNSET_SENTINEL and (
48
+ not k in optional_fields or (optional_nullable and is_set)
49
+ ):
50
+ m[k] = val
51
+
52
+ return m
53
+
@@ -0,0 +1,22 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
5
+ from mistralai.types import BaseModel
6
+ from typing import Literal, Optional, TypedDict
7
+ from typing_extensions import NotRequired
8
+
9
+
10
+ FinishReason = Literal["stop", "length", "model_length", "error", "tool_calls"]
11
+
12
+ class ChatCompletionChoiceTypedDict(TypedDict):
13
+ index: int
14
+ finish_reason: FinishReason
15
+ message: NotRequired[AssistantMessageTypedDict]
16
+
17
+
18
+ class ChatCompletionChoice(BaseModel):
19
+ index: int
20
+ finish_reason: FinishReason
21
+ message: Optional[AssistantMessage] = None
22
+
@@ -0,0 +1,109 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
5
+ from .responseformat import ResponseFormat, ResponseFormatTypedDict
6
+ from .systemmessage import SystemMessage, SystemMessageTypedDict
7
+ from .tool import Tool, ToolTypedDict
8
+ from .toolmessage import ToolMessage, ToolMessageTypedDict
9
+ from .usermessage import UserMessage, UserMessageTypedDict
10
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
11
+ from mistralai.utils import get_discriminator
12
+ from pydantic import Discriminator, Tag, model_serializer
13
+ from typing import List, Literal, Optional, TypedDict, Union
14
+ from typing_extensions import Annotated, NotRequired
15
+
16
+
17
+ ToolChoice = Literal["auto", "none", "any"]
18
+
19
+ class ChatCompletionRequestTypedDict(TypedDict):
20
+ model: Nullable[str]
21
+ r"""ID of the model to use. You can use the [List Available Models](/api#operation/listModels) API to see all of your available models, or see our [Model overview](/models) for model descriptions."""
22
+ messages: List[MessagesTypedDict]
23
+ r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
24
+ temperature: NotRequired[float]
25
+ r"""What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 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."""
26
+ top_p: NotRequired[float]
27
+ 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."""
28
+ max_tokens: NotRequired[Nullable[int]]
29
+ 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."""
30
+ min_tokens: NotRequired[Nullable[int]]
31
+ r"""The minimum number of tokens to generate in the completion."""
32
+ stream: NotRequired[bool]
33
+ 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."""
34
+ stop: NotRequired[StopTypedDict]
35
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
36
+ random_seed: NotRequired[Nullable[int]]
37
+ r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
38
+ response_format: NotRequired[ResponseFormatTypedDict]
39
+ tools: NotRequired[Nullable[List[ToolTypedDict]]]
40
+ tool_choice: NotRequired[ToolChoice]
41
+ safe_prompt: NotRequired[bool]
42
+ r"""Whether to inject a safety prompt before all conversations."""
43
+
44
+
45
+ class ChatCompletionRequest(BaseModel):
46
+ model: Nullable[str]
47
+ r"""ID of the model to use. You can use the [List Available Models](/api#operation/listModels) API to see all of your available models, or see our [Model overview](/models) for model descriptions."""
48
+ messages: List[Messages]
49
+ r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
50
+ temperature: Optional[float] = 0.7
51
+ r"""What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 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."""
52
+ top_p: Optional[float] = 1
53
+ 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."""
54
+ max_tokens: OptionalNullable[int] = UNSET
55
+ 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."""
56
+ min_tokens: OptionalNullable[int] = UNSET
57
+ r"""The minimum number of tokens to generate in the completion."""
58
+ stream: Optional[bool] = False
59
+ 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."""
60
+ stop: Optional[Stop] = None
61
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
62
+ random_seed: OptionalNullable[int] = UNSET
63
+ r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
64
+ response_format: Optional[ResponseFormat] = None
65
+ tools: OptionalNullable[List[Tool]] = UNSET
66
+ tool_choice: Optional[ToolChoice] = "auto"
67
+ safe_prompt: Optional[bool] = False
68
+ r"""Whether to inject a safety prompt before all conversations."""
69
+
70
+ @model_serializer(mode="wrap")
71
+ def serialize_model(self, handler):
72
+ optional_fields = ["temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "response_format", "tools", "tool_choice", "safe_prompt"]
73
+ nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "tools"]
74
+ null_default_fields = []
75
+
76
+ serialized = handler(self)
77
+
78
+ m = {}
79
+
80
+ for n, f in self.model_fields.items():
81
+ k = f.alias or n
82
+ val = serialized.get(k)
83
+
84
+ optional_nullable = k in optional_fields and k in nullable_fields
85
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
86
+
87
+ if val is not None and val != UNSET_SENTINEL:
88
+ m[k] = val
89
+ elif val != UNSET_SENTINEL and (
90
+ not k in optional_fields or (optional_nullable and is_set)
91
+ ):
92
+ m[k] = val
93
+
94
+ return m
95
+
96
+
97
+ StopTypedDict = Union[str, List[str]]
98
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
99
+
100
+
101
+ Stop = Union[str, List[str]]
102
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
103
+
104
+
105
+ MessagesTypedDict = Union[SystemMessageTypedDict, UserMessageTypedDict, AssistantMessageTypedDict, ToolMessageTypedDict]
106
+
107
+
108
+ Messages = Annotated[Union[Annotated[AssistantMessage, Tag("assistant")], Annotated[SystemMessage, Tag("system")], Annotated[ToolMessage, Tag("tool")], Annotated[UserMessage, Tag("user")]], Discriminator(lambda m: get_discriminator(m, "role", "role"))]
109
+
@@ -0,0 +1,27 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceTypedDict
5
+ from .usageinfo import UsageInfo, UsageInfoTypedDict
6
+ from mistralai.types import BaseModel
7
+ from typing import List, Optional, TypedDict
8
+ from typing_extensions import NotRequired
9
+
10
+
11
+ class ChatCompletionResponseTypedDict(TypedDict):
12
+ id: str
13
+ object: str
14
+ model: str
15
+ usage: UsageInfoTypedDict
16
+ created: NotRequired[int]
17
+ choices: NotRequired[List[ChatCompletionChoiceTypedDict]]
18
+
19
+
20
+ class ChatCompletionResponse(BaseModel):
21
+ id: str
22
+ object: str
23
+ model: str
24
+ usage: UsageInfo
25
+ created: Optional[int] = None
26
+ choices: Optional[List[ChatCompletionChoice]] = None
27
+
@@ -0,0 +1,107 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
5
+ from .responseformat import ResponseFormat, ResponseFormatTypedDict
6
+ from .systemmessage import SystemMessage, SystemMessageTypedDict
7
+ from .tool import Tool, ToolTypedDict
8
+ from .toolmessage import ToolMessage, ToolMessageTypedDict
9
+ from .usermessage import UserMessage, UserMessageTypedDict
10
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
11
+ from mistralai.utils import get_discriminator
12
+ from pydantic import Discriminator, Tag, model_serializer
13
+ from typing import List, Literal, Optional, TypedDict, Union
14
+ from typing_extensions import Annotated, NotRequired
15
+
16
+
17
+ ChatCompletionStreamRequestToolChoice = Literal["auto", "none", "any"]
18
+
19
+ class ChatCompletionStreamRequestTypedDict(TypedDict):
20
+ model: Nullable[str]
21
+ r"""ID of the model to use. You can use the [List Available Models](/api#operation/listModels) API to see all of your available models, or see our [Model overview](/models) for model descriptions."""
22
+ messages: List[ChatCompletionStreamRequestMessagesTypedDict]
23
+ r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
24
+ temperature: NotRequired[float]
25
+ r"""What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 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."""
26
+ top_p: NotRequired[float]
27
+ 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."""
28
+ max_tokens: NotRequired[Nullable[int]]
29
+ 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."""
30
+ min_tokens: NotRequired[Nullable[int]]
31
+ r"""The minimum number of tokens to generate in the completion."""
32
+ stream: NotRequired[bool]
33
+ stop: NotRequired[ChatCompletionStreamRequestStopTypedDict]
34
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
35
+ random_seed: NotRequired[Nullable[int]]
36
+ r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
37
+ response_format: NotRequired[ResponseFormatTypedDict]
38
+ tools: NotRequired[Nullable[List[ToolTypedDict]]]
39
+ tool_choice: NotRequired[ChatCompletionStreamRequestToolChoice]
40
+ safe_prompt: NotRequired[bool]
41
+ r"""Whether to inject a safety prompt before all conversations."""
42
+
43
+
44
+ class ChatCompletionStreamRequest(BaseModel):
45
+ model: Nullable[str]
46
+ r"""ID of the model to use. You can use the [List Available Models](/api#operation/listModels) API to see all of your available models, or see our [Model overview](/models) for model descriptions."""
47
+ messages: List[ChatCompletionStreamRequestMessages]
48
+ r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
49
+ temperature: Optional[float] = 0.7
50
+ r"""What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 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."""
51
+ top_p: Optional[float] = 1
52
+ 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."""
53
+ max_tokens: OptionalNullable[int] = UNSET
54
+ 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."""
55
+ min_tokens: OptionalNullable[int] = UNSET
56
+ r"""The minimum number of tokens to generate in the completion."""
57
+ stream: Optional[bool] = True
58
+ stop: Optional[ChatCompletionStreamRequestStop] = None
59
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
60
+ random_seed: OptionalNullable[int] = UNSET
61
+ r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
62
+ response_format: Optional[ResponseFormat] = None
63
+ tools: OptionalNullable[List[Tool]] = UNSET
64
+ tool_choice: Optional[ChatCompletionStreamRequestToolChoice] = "auto"
65
+ safe_prompt: Optional[bool] = False
66
+ r"""Whether to inject a safety prompt before all conversations."""
67
+
68
+ @model_serializer(mode="wrap")
69
+ def serialize_model(self, handler):
70
+ optional_fields = ["temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "response_format", "tools", "tool_choice", "safe_prompt"]
71
+ nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "tools"]
72
+ null_default_fields = []
73
+
74
+ serialized = handler(self)
75
+
76
+ m = {}
77
+
78
+ for n, f in self.model_fields.items():
79
+ k = f.alias or n
80
+ val = serialized.get(k)
81
+
82
+ optional_nullable = k in optional_fields and k in nullable_fields
83
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
84
+
85
+ if val is not None and val != UNSET_SENTINEL:
86
+ m[k] = val
87
+ elif val != UNSET_SENTINEL and (
88
+ not k in optional_fields or (optional_nullable and is_set)
89
+ ):
90
+ m[k] = val
91
+
92
+ return m
93
+
94
+
95
+ ChatCompletionStreamRequestStopTypedDict = Union[str, List[str]]
96
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
97
+
98
+
99
+ ChatCompletionStreamRequestStop = Union[str, List[str]]
100
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
101
+
102
+
103
+ ChatCompletionStreamRequestMessagesTypedDict = Union[SystemMessageTypedDict, UserMessageTypedDict, AssistantMessageTypedDict, ToolMessageTypedDict]
104
+
105
+
106
+ ChatCompletionStreamRequestMessages = Annotated[Union[Annotated[AssistantMessage, Tag("assistant")], Annotated[SystemMessage, Tag("system")], Annotated[ToolMessage, Tag("tool")], Annotated[UserMessage, Tag("user")]], Discriminator(lambda m: get_discriminator(m, "role", "role"))]
107
+