@mistralai/mistralai 1.1.0 → 1.2.0

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 (340) hide show
  1. package/README.md +76 -31
  2. package/docs/sdks/agents/README.md +8 -9
  3. package/docs/sdks/chat/README.md +8 -9
  4. package/docs/sdks/classifiers/README.md +181 -0
  5. package/docs/sdks/embeddings/README.md +13 -7
  6. package/docs/sdks/files/README.md +21 -23
  7. package/docs/sdks/fim/README.md +8 -9
  8. package/docs/sdks/jobs/README.md +25 -29
  9. package/docs/sdks/models/README.md +30 -35
  10. package/examples/src/async_chat_with_image_no_streaming.ts +27 -0
  11. package/funcs/agentsComplete.d.ts +1 -1
  12. package/funcs/agentsComplete.d.ts.map +1 -1
  13. package/funcs/agentsComplete.js +34 -32
  14. package/funcs/agentsComplete.js.map +1 -1
  15. package/funcs/agentsStream.d.ts +1 -1
  16. package/funcs/agentsStream.d.ts.map +1 -1
  17. package/funcs/agentsStream.js +35 -33
  18. package/funcs/agentsStream.js.map +1 -1
  19. package/funcs/chatComplete.d.ts +1 -1
  20. package/funcs/chatComplete.d.ts.map +1 -1
  21. package/funcs/chatComplete.js +34 -32
  22. package/funcs/chatComplete.js.map +1 -1
  23. package/funcs/chatStream.d.ts +1 -1
  24. package/funcs/chatStream.d.ts.map +1 -1
  25. package/funcs/chatStream.js +35 -33
  26. package/funcs/chatStream.js.map +1 -1
  27. package/funcs/classifiersModerate.d.ts +13 -0
  28. package/funcs/classifiersModerate.d.ts.map +1 -0
  29. package/funcs/classifiersModerate.js +95 -0
  30. package/funcs/classifiersModerate.js.map +1 -0
  31. package/funcs/classifiersModerateChat.d.ts +13 -0
  32. package/funcs/classifiersModerateChat.d.ts.map +1 -0
  33. package/funcs/classifiersModerateChat.js +95 -0
  34. package/funcs/classifiersModerateChat.js.map +1 -0
  35. package/funcs/embeddingsCreate.d.ts +1 -1
  36. package/funcs/embeddingsCreate.d.ts.map +1 -1
  37. package/funcs/embeddingsCreate.js +34 -32
  38. package/funcs/embeddingsCreate.js.map +1 -1
  39. package/funcs/filesDelete.d.ts +1 -1
  40. package/funcs/filesDelete.d.ts.map +1 -1
  41. package/funcs/filesDelete.js +34 -32
  42. package/funcs/filesDelete.js.map +1 -1
  43. package/funcs/filesList.d.ts +2 -1
  44. package/funcs/filesList.d.ts.map +1 -1
  45. package/funcs/filesList.js +44 -22
  46. package/funcs/filesList.js.map +1 -1
  47. package/funcs/filesRetrieve.d.ts +1 -1
  48. package/funcs/filesRetrieve.d.ts.map +1 -1
  49. package/funcs/filesRetrieve.js +34 -32
  50. package/funcs/filesRetrieve.js.map +1 -1
  51. package/funcs/filesUpload.d.ts +1 -1
  52. package/funcs/filesUpload.d.ts.map +1 -1
  53. package/funcs/filesUpload.js +41 -39
  54. package/funcs/filesUpload.js.map +1 -1
  55. package/funcs/fimComplete.d.ts +1 -1
  56. package/funcs/fimComplete.d.ts.map +1 -1
  57. package/funcs/fimComplete.js +34 -32
  58. package/funcs/fimComplete.js.map +1 -1
  59. package/funcs/fimStream.d.ts +1 -1
  60. package/funcs/fimStream.d.ts.map +1 -1
  61. package/funcs/fimStream.js +35 -33
  62. package/funcs/fimStream.js.map +1 -1
  63. package/funcs/fineTuningJobsCancel.d.ts +1 -1
  64. package/funcs/fineTuningJobsCancel.d.ts.map +1 -1
  65. package/funcs/fineTuningJobsCancel.js +35 -33
  66. package/funcs/fineTuningJobsCancel.js.map +1 -1
  67. package/funcs/fineTuningJobsCreate.d.ts +1 -1
  68. package/funcs/fineTuningJobsCreate.d.ts.map +1 -1
  69. package/funcs/fineTuningJobsCreate.js +33 -31
  70. package/funcs/fineTuningJobsCreate.js.map +1 -1
  71. package/funcs/fineTuningJobsGet.d.ts +1 -1
  72. package/funcs/fineTuningJobsGet.d.ts.map +1 -1
  73. package/funcs/fineTuningJobsGet.js +35 -33
  74. package/funcs/fineTuningJobsGet.js.map +1 -1
  75. package/funcs/fineTuningJobsList.d.ts +1 -1
  76. package/funcs/fineTuningJobsList.d.ts.map +1 -1
  77. package/funcs/fineTuningJobsList.js +44 -42
  78. package/funcs/fineTuningJobsList.js.map +1 -1
  79. package/funcs/fineTuningJobsStart.d.ts +1 -1
  80. package/funcs/fineTuningJobsStart.d.ts.map +1 -1
  81. package/funcs/fineTuningJobsStart.js +35 -33
  82. package/funcs/fineTuningJobsStart.js.map +1 -1
  83. package/funcs/modelsArchive.d.ts +1 -1
  84. package/funcs/modelsArchive.d.ts.map +1 -1
  85. package/funcs/modelsArchive.js +35 -33
  86. package/funcs/modelsArchive.js.map +1 -1
  87. package/funcs/modelsDelete.d.ts +1 -1
  88. package/funcs/modelsDelete.d.ts.map +1 -1
  89. package/funcs/modelsDelete.js +36 -34
  90. package/funcs/modelsDelete.js.map +1 -1
  91. package/funcs/modelsList.d.ts +1 -1
  92. package/funcs/modelsList.d.ts.map +1 -1
  93. package/funcs/modelsList.js +27 -24
  94. package/funcs/modelsList.js.map +1 -1
  95. package/funcs/modelsRetrieve.d.ts +1 -1
  96. package/funcs/modelsRetrieve.d.ts.map +1 -1
  97. package/funcs/modelsRetrieve.js +37 -35
  98. package/funcs/modelsRetrieve.js.map +1 -1
  99. package/funcs/modelsUnarchive.d.ts +1 -1
  100. package/funcs/modelsUnarchive.d.ts.map +1 -1
  101. package/funcs/modelsUnarchive.js +35 -33
  102. package/funcs/modelsUnarchive.js.map +1 -1
  103. package/funcs/modelsUpdate.d.ts +1 -1
  104. package/funcs/modelsUpdate.d.ts.map +1 -1
  105. package/funcs/modelsUpdate.js +35 -35
  106. package/funcs/modelsUpdate.js.map +1 -1
  107. package/hooks/types.d.ts +2 -0
  108. package/hooks/types.d.ts.map +1 -1
  109. package/lib/config.d.ts +6 -6
  110. package/lib/config.d.ts.map +1 -1
  111. package/lib/config.js +8 -8
  112. package/lib/config.js.map +1 -1
  113. package/lib/event-streams.d.ts.map +1 -1
  114. package/lib/event-streams.js +6 -0
  115. package/lib/event-streams.js.map +1 -1
  116. package/lib/retries.d.ts +20 -0
  117. package/lib/retries.d.ts.map +1 -1
  118. package/lib/retries.js +51 -26
  119. package/lib/retries.js.map +1 -1
  120. package/lib/sdks.d.ts +7 -10
  121. package/lib/sdks.d.ts.map +1 -1
  122. package/lib/sdks.js +46 -28
  123. package/lib/sdks.js.map +1 -1
  124. package/models/components/agentscompletionrequest.d.ts +28 -9
  125. package/models/components/agentscompletionrequest.d.ts.map +1 -1
  126. package/models/components/agentscompletionrequest.js +23 -4
  127. package/models/components/agentscompletionrequest.js.map +1 -1
  128. package/models/components/agentscompletionstreamrequest.d.ts +28 -9
  129. package/models/components/agentscompletionstreamrequest.d.ts.map +1 -1
  130. package/models/components/agentscompletionstreamrequest.js +23 -4
  131. package/models/components/agentscompletionstreamrequest.js.map +1 -1
  132. package/models/components/assistantmessage.d.ts +22 -5
  133. package/models/components/assistantmessage.d.ts.map +1 -1
  134. package/models/components/assistantmessage.js +19 -3
  135. package/models/components/assistantmessage.js.map +1 -1
  136. package/models/components/basemodelcard.d.ts +27 -2
  137. package/models/components/basemodelcard.d.ts.map +1 -1
  138. package/models/components/basemodelcard.js +25 -3
  139. package/models/components/basemodelcard.js.map +1 -1
  140. package/models/components/chatclassificationrequest.d.ts +190 -0
  141. package/models/components/chatclassificationrequest.d.ts.map +1 -0
  142. package/models/components/chatclassificationrequest.js +280 -0
  143. package/models/components/chatclassificationrequest.js.map +1 -0
  144. package/models/components/chatcompletionchoice.d.ts +9 -21
  145. package/models/components/chatcompletionchoice.d.ts.map +1 -1
  146. package/models/components/chatcompletionchoice.js +13 -5
  147. package/models/components/chatcompletionchoice.js.map +1 -1
  148. package/models/components/chatcompletionrequest.d.ts +18 -8
  149. package/models/components/chatcompletionrequest.d.ts.map +1 -1
  150. package/models/components/chatcompletionrequest.js +12 -6
  151. package/models/components/chatcompletionrequest.js.map +1 -1
  152. package/models/components/chatcompletionstreamrequest.d.ts +18 -8
  153. package/models/components/chatcompletionstreamrequest.d.ts.map +1 -1
  154. package/models/components/chatcompletionstreamrequest.js +12 -6
  155. package/models/components/chatcompletionstreamrequest.js.map +1 -1
  156. package/models/components/classificationobject.d.ts +41 -0
  157. package/models/components/classificationobject.d.ts.map +1 -0
  158. package/models/components/classificationobject.js +61 -0
  159. package/models/components/classificationobject.js.map +1 -0
  160. package/models/components/classificationrequest.d.ts +52 -0
  161. package/models/components/classificationrequest.d.ts.map +1 -0
  162. package/models/components/classificationrequest.js +76 -0
  163. package/models/components/classificationrequest.js.map +1 -0
  164. package/models/components/classificationresponse.d.ts +30 -0
  165. package/models/components/classificationresponse.d.ts.map +1 -0
  166. package/models/components/classificationresponse.js +55 -0
  167. package/models/components/classificationresponse.js.map +1 -0
  168. package/models/components/completionresponsestreamchoice.d.ts +6 -16
  169. package/models/components/completionresponsestreamchoice.d.ts.map +1 -1
  170. package/models/components/completionresponsestreamchoice.js +9 -2
  171. package/models/components/completionresponsestreamchoice.js.map +1 -1
  172. package/models/components/deltamessage.d.ts +24 -4
  173. package/models/components/deltamessage.d.ts.map +1 -1
  174. package/models/components/deltamessage.js +21 -5
  175. package/models/components/deltamessage.js.map +1 -1
  176. package/models/components/embeddingrequest.d.ts +1 -1
  177. package/models/components/embeddingrequest.d.ts.map +1 -1
  178. package/models/components/embeddingrequest.js +2 -2
  179. package/models/components/embeddingrequest.js.map +1 -1
  180. package/models/components/filepurpose.d.ts +22 -0
  181. package/models/components/filepurpose.d.ts.map +1 -0
  182. package/models/components/filepurpose.js +58 -0
  183. package/models/components/filepurpose.js.map +1 -0
  184. package/models/components/fileschema.d.ts +3 -30
  185. package/models/components/fileschema.d.ts.map +1 -1
  186. package/models/components/fileschema.js +4 -32
  187. package/models/components/fileschema.js.map +1 -1
  188. package/models/components/fimcompletionrequest.d.ts +8 -8
  189. package/models/components/fimcompletionrequest.d.ts.map +1 -1
  190. package/models/components/fimcompletionrequest.js +6 -6
  191. package/models/components/fimcompletionrequest.js.map +1 -1
  192. package/models/components/fimcompletionstreamrequest.d.ts +8 -8
  193. package/models/components/fimcompletionstreamrequest.d.ts.map +1 -1
  194. package/models/components/fimcompletionstreamrequest.js +6 -6
  195. package/models/components/fimcompletionstreamrequest.js.map +1 -1
  196. package/models/components/ftmodelcard.d.ts +27 -2
  197. package/models/components/ftmodelcard.d.ts.map +1 -1
  198. package/models/components/ftmodelcard.js +25 -3
  199. package/models/components/ftmodelcard.js.map +1 -1
  200. package/models/components/index.d.ts +5 -0
  201. package/models/components/index.d.ts.map +1 -1
  202. package/models/components/index.js +5 -0
  203. package/models/components/index.js.map +1 -1
  204. package/models/components/listfilesout.d.ts +2 -0
  205. package/models/components/listfilesout.d.ts.map +1 -1
  206. package/models/components/listfilesout.js +2 -0
  207. package/models/components/listfilesout.js.map +1 -1
  208. package/models/components/retrievefileout.d.ts +5 -30
  209. package/models/components/retrievefileout.d.ts.map +1 -1
  210. package/models/components/retrievefileout.js +6 -32
  211. package/models/components/retrievefileout.js.map +1 -1
  212. package/models/components/sampletype.d.ts +9 -12
  213. package/models/components/sampletype.d.ts.map +1 -1
  214. package/models/components/sampletype.js +12 -2
  215. package/models/components/sampletype.js.map +1 -1
  216. package/models/components/source.d.ts +7 -12
  217. package/models/components/source.d.ts.map +1 -1
  218. package/models/components/source.js +11 -2
  219. package/models/components/source.js.map +1 -1
  220. package/models/components/systemmessage.d.ts +11 -11
  221. package/models/components/systemmessage.d.ts.map +1 -1
  222. package/models/components/systemmessage.js +10 -10
  223. package/models/components/systemmessage.js.map +1 -1
  224. package/models/components/trainingparameters.d.ts +2 -0
  225. package/models/components/trainingparameters.d.ts.map +1 -1
  226. package/models/components/trainingparameters.js +4 -0
  227. package/models/components/trainingparameters.js.map +1 -1
  228. package/models/components/trainingparametersin.d.ts +2 -0
  229. package/models/components/trainingparametersin.d.ts.map +1 -1
  230. package/models/components/trainingparametersin.js +4 -0
  231. package/models/components/trainingparametersin.js.map +1 -1
  232. package/models/components/uploadfileout.d.ts +3 -30
  233. package/models/components/uploadfileout.d.ts.map +1 -1
  234. package/models/components/uploadfileout.js +4 -32
  235. package/models/components/uploadfileout.js.map +1 -1
  236. package/models/components/usermessage.d.ts +2 -2
  237. package/models/components/usermessage.d.ts.map +1 -1
  238. package/models/components/usermessage.js +2 -2
  239. package/models/components/usermessage.js.map +1 -1
  240. package/models/components/wandbintegrationout.d.ts +7 -7
  241. package/models/components/wandbintegrationout.d.ts.map +1 -1
  242. package/models/components/wandbintegrationout.js +11 -11
  243. package/models/components/wandbintegrationout.js.map +1 -1
  244. package/models/errors/httpvalidationerror.d.ts +0 -6
  245. package/models/errors/httpvalidationerror.d.ts.map +1 -1
  246. package/models/errors/httpvalidationerror.js +0 -3
  247. package/models/errors/httpvalidationerror.js.map +1 -1
  248. package/models/operations/filesapirouteslistfiles.d.ts +36 -0
  249. package/models/operations/filesapirouteslistfiles.d.ts.map +1 -0
  250. package/models/operations/filesapirouteslistfiles.js +74 -0
  251. package/models/operations/filesapirouteslistfiles.js.map +1 -0
  252. package/models/operations/filesapiroutesuploadfile.d.ts +3 -21
  253. package/models/operations/filesapiroutesuploadfile.d.ts.map +1 -1
  254. package/models/operations/filesapiroutesuploadfile.js +4 -29
  255. package/models/operations/filesapiroutesuploadfile.js.map +1 -1
  256. package/models/operations/index.d.ts +1 -0
  257. package/models/operations/index.d.ts.map +1 -1
  258. package/models/operations/index.js +1 -0
  259. package/models/operations/index.js.map +1 -1
  260. package/package.json +1 -1
  261. package/sdk/classifiers.d.ts +13 -0
  262. package/sdk/classifiers.d.ts.map +1 -0
  263. package/sdk/classifiers.js +26 -0
  264. package/sdk/classifiers.js.map +1 -0
  265. package/sdk/files.d.ts +1 -1
  266. package/sdk/files.d.ts.map +1 -1
  267. package/sdk/files.js +2 -2
  268. package/sdk/files.js.map +1 -1
  269. package/sdk/finetuning.js +1 -1
  270. package/sdk/sdk.d.ts +3 -0
  271. package/sdk/sdk.d.ts.map +1 -1
  272. package/sdk/sdk.js +12 -7
  273. package/sdk/sdk.js.map +1 -1
  274. package/src/funcs/agentsComplete.ts +42 -40
  275. package/src/funcs/agentsStream.ts +43 -41
  276. package/src/funcs/chatComplete.ts +42 -40
  277. package/src/funcs/chatStream.ts +43 -41
  278. package/src/funcs/classifiersModerate.ts +125 -0
  279. package/src/funcs/classifiersModerateChat.ts +125 -0
  280. package/src/funcs/embeddingsCreate.ts +42 -40
  281. package/src/funcs/filesDelete.ts +41 -39
  282. package/src/funcs/filesList.ts +57 -24
  283. package/src/funcs/filesRetrieve.ts +41 -39
  284. package/src/funcs/filesUpload.ts +48 -46
  285. package/src/funcs/fimComplete.ts +42 -40
  286. package/src/funcs/fimStream.ts +43 -41
  287. package/src/funcs/fineTuningJobsCancel.ts +41 -39
  288. package/src/funcs/fineTuningJobsCreate.ts +38 -36
  289. package/src/funcs/fineTuningJobsGet.ts +41 -39
  290. package/src/funcs/fineTuningJobsList.ts +50 -48
  291. package/src/funcs/fineTuningJobsStart.ts +41 -39
  292. package/src/funcs/modelsArchive.ts +42 -40
  293. package/src/funcs/modelsDelete.ts +45 -43
  294. package/src/funcs/modelsList.ts +32 -28
  295. package/src/funcs/modelsRetrieve.ts +45 -43
  296. package/src/funcs/modelsUnarchive.ts +42 -40
  297. package/src/funcs/modelsUpdate.ts +41 -44
  298. package/src/hooks/types.ts +2 -0
  299. package/src/lib/config.ts +7 -7
  300. package/src/lib/event-streams.ts +6 -0
  301. package/src/lib/retries.ts +63 -31
  302. package/src/lib/sdks.ts +41 -37
  303. package/src/models/components/agentscompletionrequest.ts +55 -9
  304. package/src/models/components/agentscompletionstreamrequest.ts +55 -9
  305. package/src/models/components/assistantmessage.ts +48 -7
  306. package/src/models/components/basemodelcard.ts +37 -5
  307. package/src/models/components/chatclassificationrequest.ts +534 -0
  308. package/src/models/components/chatcompletionchoice.ts +32 -15
  309. package/src/models/components/chatcompletionrequest.ts +30 -14
  310. package/src/models/components/chatcompletionstreamrequest.ts +30 -14
  311. package/src/models/components/classificationobject.ts +64 -0
  312. package/src/models/components/classificationrequest.ts +96 -0
  313. package/src/models/components/classificationresponse.ts +59 -0
  314. package/src/models/components/completionresponsestreamchoice.ts +20 -6
  315. package/src/models/components/deltamessage.ts +47 -8
  316. package/src/models/components/embeddingrequest.ts +3 -3
  317. package/src/models/components/filepurpose.ts +48 -0
  318. package/src/models/components/fileschema.ts +8 -54
  319. package/src/models/components/fimcompletionrequest.ts +14 -14
  320. package/src/models/components/fimcompletionstreamrequest.ts +14 -14
  321. package/src/models/components/ftmodelcard.ts +38 -5
  322. package/src/models/components/index.ts +5 -0
  323. package/src/models/components/listfilesout.ts +4 -0
  324. package/src/models/components/retrievefileout.ts +12 -54
  325. package/src/models/components/sampletype.ts +26 -6
  326. package/src/models/components/source.ts +17 -6
  327. package/src/models/components/systemmessage.ts +17 -14
  328. package/src/models/components/trainingparameters.ts +6 -0
  329. package/src/models/components/trainingparametersin.ts +6 -0
  330. package/src/models/components/uploadfileout.ts +8 -48
  331. package/src/models/components/usermessage.ts +8 -4
  332. package/src/models/components/wandbintegrationout.ts +15 -12
  333. package/src/models/errors/httpvalidationerror.ts +0 -6
  334. package/src/models/operations/filesapirouteslistfiles.ts +79 -0
  335. package/src/models/operations/filesapiroutesuploadfile.ts +5 -40
  336. package/src/models/operations/index.ts +1 -0
  337. package/src/sdk/classifiers.ts +39 -0
  338. package/src/sdk/files.ts +2 -0
  339. package/src/sdk/finetuning.ts +1 -1
  340. package/src/sdk/sdk.ts +13 -7
package/README.md CHANGED
@@ -166,6 +166,34 @@ async function run() {
166
166
 
167
167
  run();
168
168
 
169
+ ```
170
+
171
+ ### Create Embedding Request
172
+
173
+ This example shows how to create embedding request.
174
+
175
+ ```typescript
176
+ import { Mistral } from "@mistralai/mistralai";
177
+
178
+ const mistral = new Mistral({
179
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
180
+ });
181
+
182
+ async function run() {
183
+ const result = await mistral.embeddings.create({
184
+ inputs: [
185
+ "Embed this sentence.",
186
+ "As well as this one.",
187
+ ],
188
+ model: "Wrangler",
189
+ });
190
+
191
+ // Handle the result
192
+ console.log(result);
193
+ }
194
+
195
+ run();
196
+
169
197
  ```
170
198
  <!-- End SDK Example Usage [usage] -->
171
199
 
@@ -192,6 +220,11 @@ We have dedicated SDKs for the following providers:
192
220
  * [complete](docs/sdks/chat/README.md#complete) - Chat Completion
193
221
  * [stream](docs/sdks/chat/README.md#stream) - Stream chat completion
194
222
 
223
+ ### [classifiers](docs/sdks/classifiers/README.md)
224
+
225
+ * [moderate](docs/sdks/classifiers/README.md#moderate) - Moderations
226
+ * [moderateChat](docs/sdks/classifiers/README.md#moderatechat) - Moderations Chat
227
+
195
228
  ### [embeddings](docs/sdks/embeddings/README.md)
196
229
 
197
230
  * [create](docs/sdks/embeddings/README.md#create) - Embeddings
@@ -378,15 +411,24 @@ run();
378
411
  <!-- Start Error Handling [errors] -->
379
412
  ## Error Handling
380
413
 
381
- All SDK methods return a response object or throw an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Error type.
414
+ All SDK methods return a response object or throw an error. By default, an API error will throw a `errors.SDKError`.
382
415
 
383
- | Error Object | Status Code | Content Type |
384
- | -------------------------- | -------------------------- | -------------------------- |
385
- | errors.HTTPValidationError | 422 | application/json |
386
- | errors.SDKError | 4xx-5xx | */* |
416
+ If a HTTP request fails, an operation my also throw an error from the `models/errors/httpclienterrors.ts` module:
387
417
 
388
- Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted string since validation errors can list many issues and the plain error string may be difficult read when debugging.
418
+ | HTTP Client Error | Description |
419
+ | ---------------------------------------------------- | ---------------------------------------------------- |
420
+ | RequestAbortedError | HTTP request was aborted by the client |
421
+ | RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
422
+ | ConnectionError | HTTP client was unable to make a request to a server |
423
+ | InvalidRequestError | Any input used to create a request is invalid |
424
+ | UnexpectedClientError | Unrecognised or unexpected error |
389
425
 
426
+ In addition, when custom error responses are specified for an operation, the SDK may throw their associated Error type. You can refer to respective *Errors* tables in SDK docs for more details on possible error types for each operation. For example, the `list` method may throw the following errors:
427
+
428
+ | Error Type | Status Code | Content Type |
429
+ | -------------------------- | -------------------------- | -------------------------- |
430
+ | errors.HTTPValidationError | 422 | application/json |
431
+ | errors.SDKError | 4XX, 5XX | \*/\* |
390
432
 
391
433
  ```typescript
392
434
  import { Mistral } from "@mistralai/mistralai";
@@ -430,6 +472,8 @@ async function run() {
430
472
  run();
431
473
 
432
474
  ```
475
+
476
+ Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted string since validation errors can list many issues and the plain error string may be difficult read when debugging.
433
477
  <!-- End Error Handling [errors] -->
434
478
 
435
479
  <!-- Start Server Selection [server] -->
@@ -441,13 +485,13 @@ You can override the default server globally by passing a server name to the `se
441
485
 
442
486
  | Name | Server | Variables |
443
487
  | ----- | ------ | --------- |
444
- | `prod` | `https://api.mistral.ai` | None |
488
+ | `eu` | `https://api.mistral.ai` | None |
445
489
 
446
490
  ```typescript
447
491
  import { Mistral } from "@mistralai/mistralai";
448
492
 
449
493
  const mistral = new Mistral({
450
- server: "prod",
494
+ server: "eu",
451
495
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
452
496
  });
453
497
 
@@ -589,29 +633,30 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
589
633
 
590
634
  <summary>Available standalone functions</summary>
591
635
 
592
- - [agentsComplete](docs/sdks/agents/README.md#complete)
593
- - [agentsStream](docs/sdks/agents/README.md#stream)
594
- - [chatComplete](docs/sdks/chat/README.md#complete)
595
- - [chatStream](docs/sdks/chat/README.md#stream)
596
- - [embeddingsCreate](docs/sdks/embeddings/README.md#create)
597
- - [filesDelete](docs/sdks/files/README.md#delete)
598
- - [filesList](docs/sdks/files/README.md#list)
599
- - [filesRetrieve](docs/sdks/files/README.md#retrieve)
600
- - [filesUpload](docs/sdks/files/README.md#upload)
601
- - [fimComplete](docs/sdks/fim/README.md#complete)
602
- - [fimStream](docs/sdks/fim/README.md#stream)
603
- - [fineTuningJobsCancel](docs/sdks/jobs/README.md#cancel)
604
- - [fineTuningJobsCreate](docs/sdks/jobs/README.md#create)
605
- - [fineTuningJobsGet](docs/sdks/jobs/README.md#get)
606
- - [fineTuningJobsList](docs/sdks/jobs/README.md#list)
607
- - [fineTuningJobsStart](docs/sdks/jobs/README.md#start)
608
- - [modelsArchive](docs/sdks/models/README.md#archive)
609
- - [modelsDelete](docs/sdks/models/README.md#delete)
610
- - [modelsList](docs/sdks/models/README.md#list)
611
- - [modelsRetrieve](docs/sdks/models/README.md#retrieve)
612
- - [modelsUnarchive](docs/sdks/models/README.md#unarchive)
613
- - [modelsUpdate](docs/sdks/models/README.md#update)
614
-
636
+ - [`agentsComplete`](docs/sdks/agents/README.md#complete) - Agents Completion
637
+ - [`agentsStream`](docs/sdks/agents/README.md#stream) - Stream Agents completion
638
+ - [`chatComplete`](docs/sdks/chat/README.md#complete) - Chat Completion
639
+ - [`chatStream`](docs/sdks/chat/README.md#stream) - Stream chat completion
640
+ - [`classifiersModerate`](docs/sdks/classifiers/README.md#moderate) - Moderations
641
+ - [`classifiersModerateChat`](docs/sdks/classifiers/README.md#moderatechat) - Moderations Chat
642
+ - [`embeddingsCreate`](docs/sdks/embeddings/README.md#create) - Embeddings
643
+ - [`filesDelete`](docs/sdks/files/README.md#delete) - Delete File
644
+ - [`filesList`](docs/sdks/files/README.md#list) - List Files
645
+ - [`filesRetrieve`](docs/sdks/files/README.md#retrieve) - Retrieve File
646
+ - [`filesUpload`](docs/sdks/files/README.md#upload) - Upload File
647
+ - [`fimComplete`](docs/sdks/fim/README.md#complete) - Fim Completion
648
+ - [`fimStream`](docs/sdks/fim/README.md#stream) - Stream fim completion
649
+ - [`fineTuningJobsCancel`](docs/sdks/jobs/README.md#cancel) - Cancel Fine Tuning Job
650
+ - [`fineTuningJobsCreate`](docs/sdks/jobs/README.md#create) - Create Fine Tuning Job
651
+ - [`fineTuningJobsGet`](docs/sdks/jobs/README.md#get) - Get Fine Tuning Job
652
+ - [`fineTuningJobsList`](docs/sdks/jobs/README.md#list) - Get Fine Tuning Jobs
653
+ - [`fineTuningJobsStart`](docs/sdks/jobs/README.md#start) - Start Fine Tuning Job
654
+ - [`modelsArchive`](docs/sdks/models/README.md#archive) - Archive Fine Tuned Model
655
+ - [`modelsDelete`](docs/sdks/models/README.md#delete) - Delete Model
656
+ - [`modelsList`](docs/sdks/models/README.md#list) - List Models
657
+ - [`modelsRetrieve`](docs/sdks/models/README.md#retrieve) - Retrieve Model
658
+ - [`modelsUnarchive`](docs/sdks/models/README.md#unarchive) - Unarchive Fine Tuned Model
659
+ - [`modelsUpdate`](docs/sdks/models/README.md#update) - Update Fine Tuned Model
615
660
 
616
661
  </details>
617
662
  <!-- End Standalone functions [standalone-funcs] -->
@@ -33,9 +33,9 @@ async function run() {
33
33
  ],
34
34
  agentId: "<value>",
35
35
  });
36
-
36
+
37
37
  // Handle the result
38
- console.log(result)
38
+ console.log(result);
39
39
  }
40
40
 
41
41
  run();
@@ -73,7 +73,7 @@ async function run() {
73
73
  const { value: result } = res;
74
74
 
75
75
  // Handle the result
76
- console.log(result)
76
+ console.log(result);
77
77
  }
78
78
 
79
79
  run();
@@ -94,11 +94,10 @@ run();
94
94
 
95
95
  ### Errors
96
96
 
97
- | Error Object | Status Code | Content Type |
97
+ | Error Type | Status Code | Content Type |
98
98
  | -------------------------- | -------------------------- | -------------------------- |
99
99
  | errors.HTTPValidationError | 422 | application/json |
100
- | errors.SDKError | 4xx-5xx | */* |
101
-
100
+ | errors.SDKError | 4XX, 5XX | \*/\* |
102
101
 
103
102
  ## stream
104
103
 
@@ -123,7 +122,7 @@ async function run() {
123
122
  ],
124
123
  agentId: "<value>",
125
124
  });
126
-
125
+
127
126
  for await (const event of result) {
128
127
  // Handle the event
129
128
  console.log(event);
@@ -188,7 +187,7 @@ run();
188
187
 
189
188
  ### Errors
190
189
 
191
- | Error Object | Status Code | Content Type |
190
+ | Error Type | Status Code | Content Type |
192
191
  | -------------------------- | -------------------------- | -------------------------- |
193
192
  | errors.HTTPValidationError | 422 | application/json |
194
- | errors.SDKError | 4xx-5xx | */* |
193
+ | errors.SDKError | 4XX, 5XX | \*/\* |
@@ -33,9 +33,9 @@ async function run() {
33
33
  },
34
34
  ],
35
35
  });
36
-
36
+
37
37
  // Handle the result
38
- console.log(result)
38
+ console.log(result);
39
39
  }
40
40
 
41
41
  run();
@@ -73,7 +73,7 @@ async function run() {
73
73
  const { value: result } = res;
74
74
 
75
75
  // Handle the result
76
- console.log(result)
76
+ console.log(result);
77
77
  }
78
78
 
79
79
  run();
@@ -94,11 +94,10 @@ run();
94
94
 
95
95
  ### Errors
96
96
 
97
- | Error Object | Status Code | Content Type |
97
+ | Error Type | Status Code | Content Type |
98
98
  | -------------------------- | -------------------------- | -------------------------- |
99
99
  | errors.HTTPValidationError | 422 | application/json |
100
- | errors.SDKError | 4xx-5xx | */* |
101
-
100
+ | errors.SDKError | 4XX, 5XX | \*/\* |
102
101
 
103
102
  ## stream
104
103
 
@@ -123,7 +122,7 @@ async function run() {
123
122
  },
124
123
  ],
125
124
  });
126
-
125
+
127
126
  for await (const event of result) {
128
127
  // Handle the event
129
128
  console.log(event);
@@ -188,7 +187,7 @@ run();
188
187
 
189
188
  ### Errors
190
189
 
191
- | Error Object | Status Code | Content Type |
190
+ | Error Type | Status Code | Content Type |
192
191
  | -------------------------- | -------------------------- | -------------------------- |
193
192
  | errors.HTTPValidationError | 422 | application/json |
194
- | errors.SDKError | 4xx-5xx | */* |
193
+ | errors.SDKError | 4XX, 5XX | \*/\* |
@@ -0,0 +1,181 @@
1
+ # Classifiers
2
+ (*classifiers*)
3
+
4
+ ## Overview
5
+
6
+ Classifiers API.
7
+
8
+ ### Available Operations
9
+
10
+ * [moderate](#moderate) - Moderations
11
+ * [moderateChat](#moderatechat) - Moderations Chat
12
+
13
+ ## moderate
14
+
15
+ Moderations
16
+
17
+ ### Example Usage
18
+
19
+ ```typescript
20
+ import { Mistral } from "@mistralai/mistralai";
21
+
22
+ const mistral = new Mistral({
23
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
24
+ });
25
+
26
+ async function run() {
27
+ const result = await mistral.classifiers.moderate({
28
+ inputs: [
29
+ "<value>",
30
+ ],
31
+ });
32
+
33
+ // Handle the result
34
+ console.log(result);
35
+ }
36
+
37
+ run();
38
+ ```
39
+
40
+ ### Standalone function
41
+
42
+ The standalone function version of this method:
43
+
44
+ ```typescript
45
+ import { MistralCore } from "@mistralai/mistralai/core.js";
46
+ import { classifiersModerate } from "@mistralai/mistralai/funcs/classifiersModerate.js";
47
+
48
+ // Use `MistralCore` for best tree-shaking performance.
49
+ // You can create one instance of it to use across an application.
50
+ const mistral = new MistralCore({
51
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
52
+ });
53
+
54
+ async function run() {
55
+ const res = await classifiersModerate(mistral, {
56
+ inputs: [
57
+ "<value>",
58
+ ],
59
+ });
60
+
61
+ if (!res.ok) {
62
+ throw res.error;
63
+ }
64
+
65
+ const { value: result } = res;
66
+
67
+ // Handle the result
68
+ console.log(result);
69
+ }
70
+
71
+ run();
72
+ ```
73
+
74
+ ### Parameters
75
+
76
+ | Parameter | Type | Required | Description |
77
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
78
+ | `request` | [components.ClassificationRequest](../../models/components/classificationrequest.md) | :heavy_check_mark: | The request object to use for the request. |
79
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
80
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
81
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
82
+
83
+ ### Response
84
+
85
+ **Promise\<[components.ClassificationResponse](../../models/components/classificationresponse.md)\>**
86
+
87
+ ### Errors
88
+
89
+ | Error Type | Status Code | Content Type |
90
+ | -------------------------- | -------------------------- | -------------------------- |
91
+ | errors.HTTPValidationError | 422 | application/json |
92
+ | errors.SDKError | 4XX, 5XX | \*/\* |
93
+
94
+ ## moderateChat
95
+
96
+ Moderations Chat
97
+
98
+ ### Example Usage
99
+
100
+ ```typescript
101
+ import { Mistral } from "@mistralai/mistralai";
102
+
103
+ const mistral = new Mistral({
104
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
105
+ });
106
+
107
+ async function run() {
108
+ const result = await mistral.classifiers.moderateChat({
109
+ inputs: [
110
+ [
111
+ {
112
+ content: "<value>",
113
+ },
114
+ ],
115
+ ],
116
+ model: "V90",
117
+ });
118
+
119
+ // Handle the result
120
+ console.log(result);
121
+ }
122
+
123
+ run();
124
+ ```
125
+
126
+ ### Standalone function
127
+
128
+ The standalone function version of this method:
129
+
130
+ ```typescript
131
+ import { MistralCore } from "@mistralai/mistralai/core.js";
132
+ import { classifiersModerateChat } from "@mistralai/mistralai/funcs/classifiersModerateChat.js";
133
+
134
+ // Use `MistralCore` for best tree-shaking performance.
135
+ // You can create one instance of it to use across an application.
136
+ const mistral = new MistralCore({
137
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
138
+ });
139
+
140
+ async function run() {
141
+ const res = await classifiersModerateChat(mistral, {
142
+ inputs: [
143
+ {
144
+ content: "<value>",
145
+ },
146
+ ],
147
+ model: "V90",
148
+ });
149
+
150
+ if (!res.ok) {
151
+ throw res.error;
152
+ }
153
+
154
+ const { value: result } = res;
155
+
156
+ // Handle the result
157
+ console.log(result);
158
+ }
159
+
160
+ run();
161
+ ```
162
+
163
+ ### Parameters
164
+
165
+ | Parameter | Type | Required | Description |
166
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
167
+ | `request` | [components.ChatClassificationRequest](../../models/components/chatclassificationrequest.md) | :heavy_check_mark: | The request object to use for the request. |
168
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
169
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
170
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
171
+
172
+ ### Response
173
+
174
+ **Promise\<[components.ClassificationResponse](../../models/components/classificationresponse.md)\>**
175
+
176
+ ### Errors
177
+
178
+ | Error Type | Status Code | Content Type |
179
+ | -------------------------- | -------------------------- | -------------------------- |
180
+ | errors.HTTPValidationError | 422 | application/json |
181
+ | errors.SDKError | 4XX, 5XX | \*/\* |
@@ -24,12 +24,15 @@ const mistral = new Mistral({
24
24
 
25
25
  async function run() {
26
26
  const result = await mistral.embeddings.create({
27
- inputs: "<value>",
27
+ inputs: [
28
+ "Embed this sentence.",
29
+ "As well as this one.",
30
+ ],
28
31
  model: "Wrangler",
29
32
  });
30
-
33
+
31
34
  // Handle the result
32
- console.log(result)
35
+ console.log(result);
33
36
  }
34
37
 
35
38
  run();
@@ -51,7 +54,10 @@ const mistral = new MistralCore({
51
54
 
52
55
  async function run() {
53
56
  const res = await embeddingsCreate(mistral, {
54
- inputs: "<value>",
57
+ inputs: [
58
+ "Embed this sentence.",
59
+ "As well as this one.",
60
+ ],
55
61
  model: "Wrangler",
56
62
  });
57
63
 
@@ -62,7 +68,7 @@ async function run() {
62
68
  const { value: result } = res;
63
69
 
64
70
  // Handle the result
65
- console.log(result)
71
+ console.log(result);
66
72
  }
67
73
 
68
74
  run();
@@ -83,7 +89,7 @@ run();
83
89
 
84
90
  ### Errors
85
91
 
86
- | Error Object | Status Code | Content Type |
92
+ | Error Type | Status Code | Content Type |
87
93
  | -------------------------- | -------------------------- | -------------------------- |
88
94
  | errors.HTTPValidationError | 422 | application/json |
89
- | errors.SDKError | 4xx-5xx | */* |
95
+ | errors.SDKError | 4XX, 5XX | \*/\* |
@@ -34,9 +34,9 @@ async function run() {
34
34
  const result = await mistral.files.upload({
35
35
  file: await openAsBlob("example.file"),
36
36
  });
37
-
37
+
38
38
  // Handle the result
39
- console.log(result)
39
+ console.log(result);
40
40
  }
41
41
 
42
42
  run();
@@ -69,7 +69,7 @@ async function run() {
69
69
  const { value: result } = res;
70
70
 
71
71
  // Handle the result
72
- console.log(result)
72
+ console.log(result);
73
73
  }
74
74
 
75
75
  run();
@@ -90,10 +90,9 @@ run();
90
90
 
91
91
  ### Errors
92
92
 
93
- | Error Object | Status Code | Content Type |
93
+ | Error Type | Status Code | Content Type |
94
94
  | --------------- | --------------- | --------------- |
95
- | errors.SDKError | 4xx-5xx | */* |
96
-
95
+ | errors.SDKError | 4XX, 5XX | \*/\* |
97
96
 
98
97
  ## list
99
98
 
@@ -110,9 +109,9 @@ const mistral = new Mistral({
110
109
 
111
110
  async function run() {
112
111
  const result = await mistral.files.list();
113
-
112
+
114
113
  // Handle the result
115
- console.log(result)
114
+ console.log(result);
116
115
  }
117
116
 
118
117
  run();
@@ -142,7 +141,7 @@ async function run() {
142
141
  const { value: result } = res;
143
142
 
144
143
  // Handle the result
145
- console.log(result)
144
+ console.log(result);
146
145
  }
147
146
 
148
147
  run();
@@ -152,6 +151,7 @@ run();
152
151
 
153
152
  | Parameter | Type | Required | Description |
154
153
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
154
+ | `request` | [operations.FilesApiRoutesListFilesRequest](../../models/operations/filesapirouteslistfilesrequest.md) | :heavy_check_mark: | The request object to use for the request. |
155
155
  | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
156
156
  | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
157
157
  | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
@@ -162,10 +162,9 @@ run();
162
162
 
163
163
  ### Errors
164
164
 
165
- | Error Object | Status Code | Content Type |
165
+ | Error Type | Status Code | Content Type |
166
166
  | --------------- | --------------- | --------------- |
167
- | errors.SDKError | 4xx-5xx | */* |
168
-
167
+ | errors.SDKError | 4XX, 5XX | \*/\* |
169
168
 
170
169
  ## retrieve
171
170
 
@@ -184,9 +183,9 @@ async function run() {
184
183
  const result = await mistral.files.retrieve({
185
184
  fileId: "<value>",
186
185
  });
187
-
186
+
188
187
  // Handle the result
189
- console.log(result)
188
+ console.log(result);
190
189
  }
191
190
 
192
191
  run();
@@ -218,7 +217,7 @@ async function run() {
218
217
  const { value: result } = res;
219
218
 
220
219
  // Handle the result
221
- console.log(result)
220
+ console.log(result);
222
221
  }
223
222
 
224
223
  run();
@@ -239,10 +238,9 @@ run();
239
238
 
240
239
  ### Errors
241
240
 
242
- | Error Object | Status Code | Content Type |
241
+ | Error Type | Status Code | Content Type |
243
242
  | --------------- | --------------- | --------------- |
244
- | errors.SDKError | 4xx-5xx | */* |
245
-
243
+ | errors.SDKError | 4XX, 5XX | \*/\* |
246
244
 
247
245
  ## delete
248
246
 
@@ -261,9 +259,9 @@ async function run() {
261
259
  const result = await mistral.files.delete({
262
260
  fileId: "<value>",
263
261
  });
264
-
262
+
265
263
  // Handle the result
266
- console.log(result)
264
+ console.log(result);
267
265
  }
268
266
 
269
267
  run();
@@ -295,7 +293,7 @@ async function run() {
295
293
  const { value: result } = res;
296
294
 
297
295
  // Handle the result
298
- console.log(result)
296
+ console.log(result);
299
297
  }
300
298
 
301
299
  run();
@@ -316,6 +314,6 @@ run();
316
314
 
317
315
  ### Errors
318
316
 
319
- | Error Object | Status Code | Content Type |
317
+ | Error Type | Status Code | Content Type |
320
318
  | --------------- | --------------- | --------------- |
321
- | errors.SDKError | 4xx-5xx | */* |
319
+ | errors.SDKError | 4XX, 5XX | \*/\* |