@mistralai/mistralai 2.0.0-alpha.1 → 2.1.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 (383) hide show
  1. package/README.md +51 -37
  2. package/RUNTIMES.md +1 -1
  3. package/esm/extra/structChat.d.ts.map +1 -1
  4. package/esm/extra/structChat.js +72 -5
  5. package/esm/extra/structChat.js.map +1 -1
  6. package/esm/funcs/audioSpeechComplete.d.ts +22 -0
  7. package/esm/funcs/audioSpeechComplete.d.ts.map +1 -0
  8. package/esm/funcs/audioSpeechComplete.js +88 -0
  9. package/esm/funcs/audioSpeechComplete.js.map +1 -0
  10. package/esm/funcs/audioVoicesCreate.d.ts +18 -0
  11. package/esm/funcs/audioVoicesCreate.d.ts.map +1 -0
  12. package/esm/funcs/audioVoicesCreate.js +83 -0
  13. package/esm/funcs/audioVoicesCreate.js.map +1 -0
  14. package/esm/funcs/audioVoicesDelete.d.ts +19 -0
  15. package/esm/funcs/audioVoicesDelete.d.ts.map +1 -0
  16. package/esm/funcs/audioVoicesDelete.js +90 -0
  17. package/esm/funcs/audioVoicesDelete.js.map +1 -0
  18. package/esm/funcs/audioVoicesGet.d.ts +19 -0
  19. package/esm/funcs/audioVoicesGet.d.ts.map +1 -0
  20. package/esm/funcs/audioVoicesGet.js +89 -0
  21. package/esm/funcs/audioVoicesGet.js.map +1 -0
  22. package/esm/funcs/audioVoicesGetSampleAudio.d.ts +18 -0
  23. package/esm/funcs/audioVoicesGetSampleAudio.d.ts.map +1 -0
  24. package/esm/funcs/audioVoicesGetSampleAudio.js +91 -0
  25. package/esm/funcs/audioVoicesGetSampleAudio.js.map +1 -0
  26. package/esm/funcs/audioVoicesList.d.ts +19 -0
  27. package/esm/funcs/audioVoicesList.d.ts.map +1 -0
  28. package/esm/funcs/audioVoicesList.js +89 -0
  29. package/esm/funcs/audioVoicesList.js.map +1 -0
  30. package/esm/funcs/audioVoicesUpdate.d.ts +19 -0
  31. package/esm/funcs/audioVoicesUpdate.d.ts.map +1 -0
  32. package/esm/funcs/audioVoicesUpdate.js +93 -0
  33. package/esm/funcs/audioVoicesUpdate.js.map +1 -0
  34. package/esm/funcs/betaConnectorsGetAuthUrl.d.ts +19 -0
  35. package/esm/funcs/betaConnectorsGetAuthUrl.d.ts.map +1 -0
  36. package/esm/funcs/betaConnectorsGetAuthUrl.js +90 -0
  37. package/esm/funcs/betaConnectorsGetAuthUrl.js.map +1 -0
  38. package/esm/funcs/betaObservabilityJudgesJudgeConversation.d.ts +16 -0
  39. package/esm/funcs/betaObservabilityJudgesJudgeConversation.d.ts.map +1 -0
  40. package/esm/funcs/betaObservabilityJudgesJudgeConversation.js +91 -0
  41. package/esm/funcs/betaObservabilityJudgesJudgeConversation.js.map +1 -0
  42. package/esm/lib/config.d.ts +2 -2
  43. package/esm/lib/config.js +2 -2
  44. package/esm/lib/config.js.map +1 -1
  45. package/esm/models/components/agent.d.ts +28 -5
  46. package/esm/models/components/agent.d.ts.map +1 -1
  47. package/esm/models/components/agent.js +14 -13
  48. package/esm/models/components/agent.js.map +1 -1
  49. package/esm/models/components/agentconversation.d.ts +2 -3
  50. package/esm/models/components/agentconversation.d.ts.map +1 -1
  51. package/esm/models/components/agentconversation.js +2 -1
  52. package/esm/models/components/agentconversation.js.map +1 -1
  53. package/esm/models/components/agentscompletionrequest.d.ts +28 -2
  54. package/esm/models/components/agentscompletionrequest.d.ts.map +1 -1
  55. package/esm/models/components/agentscompletionrequest.js +66 -13
  56. package/esm/models/components/agentscompletionrequest.js.map +1 -1
  57. package/esm/models/components/agentscompletionstreamrequest.d.ts +28 -2
  58. package/esm/models/components/agentscompletionstreamrequest.d.ts.map +1 -1
  59. package/esm/models/components/agentscompletionstreamrequest.js +66 -13
  60. package/esm/models/components/agentscompletionstreamrequest.js.map +1 -1
  61. package/esm/models/components/authurlresponse.d.ts +11 -0
  62. package/esm/models/components/authurlresponse.d.ts.map +1 -0
  63. package/esm/models/components/authurlresponse.js +20 -0
  64. package/esm/models/components/authurlresponse.js.map +1 -0
  65. package/esm/models/components/basefielddefinition.d.ts +4 -4
  66. package/esm/models/components/basefielddefinition.d.ts.map +1 -1
  67. package/esm/models/components/basefielddefinition.js +3 -4
  68. package/esm/models/components/basefielddefinition.js.map +1 -1
  69. package/esm/models/components/basemodelcard.d.ts +6 -0
  70. package/esm/models/components/basemodelcard.d.ts.map +1 -1
  71. package/esm/models/components/basemodelcard.js.map +1 -1
  72. package/esm/models/components/chatcompletionrequest.d.ts +31 -2
  73. package/esm/models/components/chatcompletionrequest.d.ts.map +1 -1
  74. package/esm/models/components/chatcompletionrequest.js +67 -14
  75. package/esm/models/components/chatcompletionrequest.js.map +1 -1
  76. package/esm/models/components/chatcompletionstreamrequest.d.ts +31 -2
  77. package/esm/models/components/chatcompletionstreamrequest.d.ts.map +1 -1
  78. package/esm/models/components/chatcompletionstreamrequest.js +67 -14
  79. package/esm/models/components/chatcompletionstreamrequest.js.map +1 -1
  80. package/esm/models/components/codeinterpretertool.d.ts +11 -2
  81. package/esm/models/components/codeinterpretertool.d.ts.map +1 -1
  82. package/esm/models/components/codeinterpretertool.js +9 -2
  83. package/esm/models/components/codeinterpretertool.js.map +1 -1
  84. package/esm/models/components/completionargs.d.ts +3 -0
  85. package/esm/models/components/completionargs.d.ts.map +1 -1
  86. package/esm/models/components/completionargs.js +5 -0
  87. package/esm/models/components/completionargs.js.map +1 -1
  88. package/esm/models/components/conversationrequest.d.ts +55 -10
  89. package/esm/models/components/conversationrequest.d.ts.map +1 -1
  90. package/esm/models/components/conversationrequest.js +14 -13
  91. package/esm/models/components/conversationrequest.js.map +1 -1
  92. package/esm/models/components/conversationresponse.d.ts +3 -5
  93. package/esm/models/components/conversationresponse.d.ts.map +1 -1
  94. package/esm/models/components/conversationresponse.js +1 -7
  95. package/esm/models/components/conversationresponse.js.map +1 -1
  96. package/esm/models/components/conversationrestartrequest.d.ts +3 -6
  97. package/esm/models/components/conversationrestartrequest.d.ts.map +1 -1
  98. package/esm/models/components/conversationrestartrequest.js +2 -1
  99. package/esm/models/components/conversationrestartrequest.js.map +1 -1
  100. package/esm/models/components/conversationrestartstreamrequest.d.ts +3 -6
  101. package/esm/models/components/conversationrestartstreamrequest.d.ts.map +1 -1
  102. package/esm/models/components/conversationrestartstreamrequest.js +2 -1
  103. package/esm/models/components/conversationrestartstreamrequest.js.map +1 -1
  104. package/esm/models/components/conversationstreamrequest.d.ts +55 -10
  105. package/esm/models/components/conversationstreamrequest.d.ts.map +1 -1
  106. package/esm/models/components/conversationstreamrequest.js +14 -13
  107. package/esm/models/components/conversationstreamrequest.js.map +1 -1
  108. package/esm/models/components/createagentrequest.d.ts +55 -10
  109. package/esm/models/components/createagentrequest.d.ts.map +1 -1
  110. package/esm/models/components/createagentrequest.js +14 -13
  111. package/esm/models/components/createagentrequest.js.map +1 -1
  112. package/esm/models/components/customconnector.d.ts +11 -2
  113. package/esm/models/components/customconnector.d.ts.map +1 -1
  114. package/esm/models/components/customconnector.js +9 -2
  115. package/esm/models/components/customconnector.js.map +1 -1
  116. package/esm/models/components/documentlibrarytool.d.ts +11 -2
  117. package/esm/models/components/documentlibrarytool.d.ts.map +1 -1
  118. package/esm/models/components/documentlibrarytool.js +9 -2
  119. package/esm/models/components/documentlibrarytool.js.map +1 -1
  120. package/esm/models/components/ftmodelcard.d.ts +6 -0
  121. package/esm/models/components/ftmodelcard.d.ts.map +1 -1
  122. package/esm/models/components/ftmodelcard.js.map +1 -1
  123. package/esm/models/components/imagegenerationtool.d.ts +11 -2
  124. package/esm/models/components/imagegenerationtool.d.ts.map +1 -1
  125. package/esm/models/components/imagegenerationtool.js +9 -2
  126. package/esm/models/components/imagegenerationtool.js.map +1 -1
  127. package/esm/models/components/imageurlchunk.d.ts +1 -1
  128. package/esm/models/components/index.d.ts +20 -0
  129. package/esm/models/components/index.d.ts.map +1 -1
  130. package/esm/models/components/index.js +20 -0
  131. package/esm/models/components/index.js.map +1 -1
  132. package/esm/models/components/instructrequest.d.ts +3 -0
  133. package/esm/models/components/instructrequest.d.ts.map +1 -1
  134. package/esm/models/components/instructrequest.js.map +1 -1
  135. package/esm/models/components/internalmetadata.d.ts +42 -0
  136. package/esm/models/components/internalmetadata.d.ts.map +1 -0
  137. package/esm/models/components/internalmetadata.js +56 -0
  138. package/esm/models/components/internalmetadata.js.map +1 -0
  139. package/esm/models/components/judgeconversationrequest.d.ts +22 -0
  140. package/esm/models/components/judgeconversationrequest.d.ts.map +1 -0
  141. package/esm/models/components/judgeconversationrequest.js +14 -0
  142. package/esm/models/components/judgeconversationrequest.js.map +1 -0
  143. package/esm/models/components/messagetokens.d.ts +17 -0
  144. package/esm/models/components/messagetokens.d.ts.map +1 -0
  145. package/esm/models/components/messagetokens.js +25 -0
  146. package/esm/models/components/messagetokens.js.map +1 -0
  147. package/esm/models/components/metadatadict.d.ts +23 -0
  148. package/esm/models/components/metadatadict.d.ts.map +1 -0
  149. package/esm/models/components/metadatadict.js +23 -0
  150. package/esm/models/components/metadatadict.js.map +1 -0
  151. package/esm/models/components/mirrorconfig.d.ts +24 -0
  152. package/esm/models/components/mirrorconfig.d.ts.map +1 -0
  153. package/esm/models/components/mirrorconfig.js +32 -0
  154. package/esm/models/components/mirrorconfig.js.map +1 -0
  155. package/esm/models/components/mirrorsource.d.ts +28 -0
  156. package/esm/models/components/mirrorsource.d.ts.map +1 -0
  157. package/esm/models/components/mirrorsource.js +43 -0
  158. package/esm/models/components/mirrorsource.js.map +1 -0
  159. package/esm/models/components/modelcapabilities.d.ts +9 -0
  160. package/esm/models/components/modelcapabilities.d.ts.map +1 -1
  161. package/esm/models/components/modelcapabilities.js +5 -0
  162. package/esm/models/components/modelcapabilities.js.map +1 -1
  163. package/esm/models/components/modelconversation.d.ts +28 -5
  164. package/esm/models/components/modelconversation.d.ts.map +1 -1
  165. package/esm/models/components/modelconversation.js +14 -13
  166. package/esm/models/components/modelconversation.js.map +1 -1
  167. package/esm/models/components/prompttokensdetails.d.ts +15 -0
  168. package/esm/models/components/prompttokensdetails.d.ts.map +1 -0
  169. package/esm/models/components/prompttokensdetails.js +21 -0
  170. package/esm/models/components/prompttokensdetails.js.map +1 -0
  171. package/esm/models/components/reasoningeffort.d.ts +12 -0
  172. package/esm/models/components/reasoningeffort.d.ts.map +1 -0
  173. package/esm/models/components/reasoningeffort.js +14 -0
  174. package/esm/models/components/reasoningeffort.js.map +1 -0
  175. package/esm/models/components/referencechunk.d.ts +11 -2
  176. package/esm/models/components/referencechunk.d.ts.map +1 -1
  177. package/esm/models/components/referencechunk.js +13 -2
  178. package/esm/models/components/referencechunk.js.map +1 -1
  179. package/esm/models/components/roles.d.ts +12 -0
  180. package/esm/models/components/roles.d.ts.map +1 -0
  181. package/esm/models/components/roles.js +15 -0
  182. package/esm/models/components/roles.js.map +1 -0
  183. package/esm/models/components/speechoutputformat.d.ts +13 -0
  184. package/esm/models/components/speechoutputformat.d.ts.map +1 -0
  185. package/esm/models/components/speechoutputformat.js +15 -0
  186. package/esm/models/components/speechoutputformat.js.map +1 -0
  187. package/esm/models/components/speechrequest.d.ts +37 -0
  188. package/esm/models/components/speechrequest.d.ts.map +1 -0
  189. package/esm/models/components/speechrequest.js +30 -0
  190. package/esm/models/components/speechrequest.js.map +1 -0
  191. package/esm/models/components/speechstreamaudiodelta.d.ts +11 -0
  192. package/esm/models/components/speechstreamaudiodelta.d.ts.map +1 -0
  193. package/esm/models/components/speechstreamaudiodelta.js +20 -0
  194. package/esm/models/components/speechstreamaudiodelta.js.map +1 -0
  195. package/esm/models/components/speechstreamdone.d.ts +12 -0
  196. package/esm/models/components/speechstreamdone.d.ts.map +1 -0
  197. package/esm/models/components/speechstreamdone.js +16 -0
  198. package/esm/models/components/speechstreamdone.js.map +1 -0
  199. package/esm/models/components/speechstreameventtypes.d.ts +10 -0
  200. package/esm/models/components/speechstreameventtypes.d.ts.map +1 -0
  201. package/esm/models/components/speechstreameventtypes.js +12 -0
  202. package/esm/models/components/speechstreameventtypes.js.map +1 -0
  203. package/esm/models/components/updateagentrequest.d.ts +55 -10
  204. package/esm/models/components/updateagentrequest.d.ts.map +1 -1
  205. package/esm/models/components/updateagentrequest.js +14 -13
  206. package/esm/models/components/updateagentrequest.js.map +1 -1
  207. package/esm/models/components/usageinfodollardefs.d.ts +18 -0
  208. package/esm/models/components/usageinfodollardefs.d.ts.map +1 -0
  209. package/esm/models/components/usageinfodollardefs.js +36 -0
  210. package/esm/models/components/usageinfodollardefs.js.map +1 -0
  211. package/esm/models/components/voicecreaterequest.d.ts +39 -0
  212. package/esm/models/components/voicecreaterequest.d.ts.map +1 -0
  213. package/esm/models/components/voicecreaterequest.js +29 -0
  214. package/esm/models/components/voicecreaterequest.js.map +1 -0
  215. package/esm/models/components/voicelistresponse.d.ts +18 -0
  216. package/esm/models/components/voicelistresponse.d.ts.map +1 -0
  217. package/esm/models/components/voicelistresponse.js +25 -0
  218. package/esm/models/components/voicelistresponse.js.map +1 -0
  219. package/esm/models/components/voiceresponse.d.ts +23 -0
  220. package/esm/models/components/voiceresponse.d.ts.map +1 -0
  221. package/esm/models/components/voiceresponse.js +32 -0
  222. package/esm/models/components/voiceresponse.js.map +1 -0
  223. package/esm/models/components/voiceupdaterequest.d.ts +23 -0
  224. package/esm/models/components/voiceupdaterequest.d.ts.map +1 -0
  225. package/esm/models/components/voiceupdaterequest.js +17 -0
  226. package/esm/models/components/voiceupdaterequest.js.map +1 -0
  227. package/esm/models/components/websearchpremiumtool.d.ts +11 -2
  228. package/esm/models/components/websearchpremiumtool.d.ts.map +1 -1
  229. package/esm/models/components/websearchpremiumtool.js +9 -2
  230. package/esm/models/components/websearchpremiumtool.js.map +1 -1
  231. package/esm/models/components/websearchtool.d.ts +11 -2
  232. package/esm/models/components/websearchtool.d.ts.map +1 -1
  233. package/esm/models/components/websearchtool.js +9 -2
  234. package/esm/models/components/websearchtool.js.map +1 -1
  235. package/esm/models/operations/connectorgetauthurlv1.d.ts +14 -0
  236. package/esm/models/operations/connectorgetauthurlv1.d.ts.map +1 -0
  237. package/esm/models/operations/connectorgetauthurlv1.js +20 -0
  238. package/esm/models/operations/connectorgetauthurlv1.js.map +1 -0
  239. package/esm/models/operations/deletevoicev1audiovoicesvoiceiddelete.d.ts +12 -0
  240. package/esm/models/operations/deletevoicev1audiovoicesvoiceiddelete.d.ts.map +1 -0
  241. package/esm/models/operations/deletevoicev1audiovoicesvoiceiddelete.js +18 -0
  242. package/esm/models/operations/deletevoicev1audiovoicesvoiceiddelete.js.map +1 -0
  243. package/esm/models/operations/getvoicesampleaudiov1audiovoicesvoiceidsampleget.d.ts +12 -0
  244. package/esm/models/operations/getvoicesampleaudiov1audiovoicesvoiceidsampleget.d.ts.map +1 -0
  245. package/esm/models/operations/getvoicesampleaudiov1audiovoicesvoiceidsampleget.js +19 -0
  246. package/esm/models/operations/getvoicesampleaudiov1audiovoicesvoiceidsampleget.js.map +1 -0
  247. package/esm/models/operations/getvoicev1audiovoicesvoiceidget.d.ts +12 -0
  248. package/esm/models/operations/getvoicev1audiovoicesvoiceidget.d.ts.map +1 -0
  249. package/esm/models/operations/getvoicev1audiovoicesvoiceidget.js +18 -0
  250. package/esm/models/operations/getvoicev1audiovoicesvoiceidget.js.map +1 -0
  251. package/esm/models/operations/index.d.ts +8 -0
  252. package/esm/models/operations/index.d.ts.map +1 -1
  253. package/esm/models/operations/index.js +8 -0
  254. package/esm/models/operations/index.js.map +1 -1
  255. package/esm/models/operations/judgeconversationv1observabilityjudgesjudgeidlivejudgingpost.d.ts +15 -0
  256. package/esm/models/operations/judgeconversationv1observabilityjudgesjudgeidlivejudgingpost.d.ts.map +1 -0
  257. package/esm/models/operations/judgeconversationv1observabilityjudgesjudgeidlivejudgingpost.js +22 -0
  258. package/esm/models/operations/judgeconversationv1observabilityjudgesjudgeidlivejudgingpost.js.map +1 -0
  259. package/esm/models/operations/listvoicesv1audiovoicesget.d.ts +20 -0
  260. package/esm/models/operations/listvoicesv1audiovoicesget.d.ts.map +1 -0
  261. package/esm/models/operations/listvoicesv1audiovoicesget.js +14 -0
  262. package/esm/models/operations/listvoicesv1audiovoicesget.js.map +1 -0
  263. package/esm/models/operations/speechv1audiospeechpost.d.ts +37 -0
  264. package/esm/models/operations/speechv1audiospeechpost.d.ts.map +1 -0
  265. package/esm/models/operations/speechv1audiospeechpost.js +70 -0
  266. package/esm/models/operations/speechv1audiospeechpost.js.map +1 -0
  267. package/esm/models/operations/updatevoicev1audiovoicesvoiceidpatch.d.ts +15 -0
  268. package/esm/models/operations/updatevoicev1audiovoicesvoiceidpatch.d.ts.map +1 -0
  269. package/esm/models/operations/updatevoicev1audiovoicesvoiceidpatch.js +21 -0
  270. package/esm/models/operations/updatevoicev1audiovoicesvoiceidpatch.js.map +1 -0
  271. package/esm/sdk/audio.d.ts +6 -0
  272. package/esm/sdk/audio.d.ts.map +1 -1
  273. package/esm/sdk/audio.js +10 -0
  274. package/esm/sdk/audio.js.map +1 -1
  275. package/esm/sdk/connectors.d.ts +7 -0
  276. package/esm/sdk/connectors.d.ts.map +1 -1
  277. package/esm/sdk/connectors.js +10 -0
  278. package/esm/sdk/connectors.js.map +1 -1
  279. package/esm/sdk/judges.d.ts +4 -0
  280. package/esm/sdk/judges.d.ts.map +1 -1
  281. package/esm/sdk/judges.js +7 -0
  282. package/esm/sdk/judges.js.map +1 -1
  283. package/esm/sdk/sdk.d.ts +2 -2
  284. package/esm/sdk/sdk.d.ts.map +1 -1
  285. package/esm/sdk/sdk.js +4 -4
  286. package/esm/sdk/sdk.js.map +1 -1
  287. package/esm/sdk/speech.d.ts +14 -0
  288. package/esm/sdk/speech.d.ts.map +1 -0
  289. package/esm/sdk/speech.js +17 -0
  290. package/esm/sdk/speech.js.map +1 -0
  291. package/esm/sdk/voices.d.ts +48 -0
  292. package/esm/sdk/voices.d.ts.map +1 -0
  293. package/esm/sdk/voices.js +69 -0
  294. package/esm/sdk/voices.js.map +1 -0
  295. package/examples/src/gcp/async_chat_no_streaming.ts +2 -2
  296. package/jsr.json +1 -1
  297. package/package.json +8 -3
  298. package/packages/mistralai-gcp/examples/chatComplete.example.ts +3 -3
  299. package/packages/mistralai-gcp/src/core.ts +1 -1
  300. package/packages/mistralai-gcp/src/funcs/chatComplete.ts +7 -7
  301. package/packages/mistralai-gcp/src/funcs/chatStream.ts +7 -7
  302. package/packages/mistralai-gcp/src/funcs/fimComplete.ts +7 -7
  303. package/packages/mistralai-gcp/src/funcs/fimStream.ts +7 -7
  304. package/packages/mistralai-gcp/src/models/errors/httpvalidationerror.ts +2 -2
  305. package/packages/mistralai-gcp/src/models/errors/mistralgoogleclouderror.ts +2 -2
  306. package/packages/mistralai-gcp/src/models/errors/responsevalidationerror.ts +2 -2
  307. package/packages/mistralai-gcp/src/models/errors/sdkerror.ts +2 -2
  308. package/packages/mistralai-gcp/src/sdk/sdk.ts +6 -5
  309. package/src/extra/structChat.ts +71 -5
  310. package/src/funcs/audioSpeechComplete.ts +175 -0
  311. package/src/funcs/audioVoicesCreate.ts +170 -0
  312. package/src/funcs/audioVoicesDelete.ts +179 -0
  313. package/src/funcs/audioVoicesGet.ts +180 -0
  314. package/src/funcs/audioVoicesGetSampleAudio.ts +180 -0
  315. package/src/funcs/audioVoicesList.ts +178 -0
  316. package/src/funcs/audioVoicesUpdate.ts +182 -0
  317. package/src/funcs/betaConnectorsGetAuthUrl.ts +186 -0
  318. package/src/funcs/betaObservabilityJudgesJudgeConversation.ts +188 -0
  319. package/src/lib/config.ts +2 -2
  320. package/src/models/components/agent.ts +51 -26
  321. package/src/models/components/agentconversation.ts +3 -2
  322. package/src/models/components/agentscompletionrequest.ts +201 -15
  323. package/src/models/components/agentscompletionstreamrequest.ts +201 -15
  324. package/src/models/components/authurlresponse.ts +38 -0
  325. package/src/models/components/basefielddefinition.ts +8 -6
  326. package/src/models/components/basemodelcard.ts +6 -0
  327. package/src/models/components/chatcompletionrequest.ts +205 -16
  328. package/src/models/components/chatcompletionstreamrequest.ts +205 -16
  329. package/src/models/components/codeinterpretertool.ts +21 -4
  330. package/src/models/components/completionargs.ts +11 -0
  331. package/src/models/components/conversationrequest.ts +66 -39
  332. package/src/models/components/conversationresponse.ts +2 -20
  333. package/src/models/components/conversationrestartrequest.ts +8 -3
  334. package/src/models/components/conversationrestartstreamrequest.ts +8 -3
  335. package/src/models/components/conversationstreamrequest.ts +66 -39
  336. package/src/models/components/createagentrequest.ts +66 -39
  337. package/src/models/components/customconnector.ts +19 -4
  338. package/src/models/components/documentlibrarytool.ts +21 -4
  339. package/src/models/components/ftmodelcard.ts +6 -0
  340. package/src/models/components/imagegenerationtool.ts +21 -4
  341. package/src/models/components/imageurlchunk.ts +1 -1
  342. package/src/models/components/index.ts +20 -0
  343. package/src/models/components/instructrequest.ts +3 -0
  344. package/src/models/components/internalmetadata.ts +126 -0
  345. package/src/models/components/judgeconversationrequest.ts +34 -0
  346. package/src/models/components/messagetokens.ts +45 -0
  347. package/src/models/components/metadatadict.ts +55 -0
  348. package/src/models/components/mirrorconfig.ts +65 -0
  349. package/src/models/components/mirrorsource.ts +76 -0
  350. package/src/models/components/modelcapabilities.ts +14 -0
  351. package/src/models/components/modelconversation.ts +51 -26
  352. package/src/models/components/prompttokensdetails.ts +42 -0
  353. package/src/models/components/reasoningeffort.ts +25 -0
  354. package/src/models/components/referencechunk.ts +32 -4
  355. package/src/models/components/roles.ts +20 -0
  356. package/src/models/components/speechoutputformat.ts +21 -0
  357. package/src/models/components/speechrequest.ts +74 -0
  358. package/src/models/components/speechstreamaudiodelta.ts +38 -0
  359. package/src/models/components/speechstreamdone.ts +37 -0
  360. package/src/models/components/speechstreameventtypes.ts +20 -0
  361. package/src/models/components/updateagentrequest.ts +66 -39
  362. package/src/models/components/usageinfodollardefs.ts +63 -0
  363. package/src/models/components/voicecreaterequest.ts +74 -0
  364. package/src/models/components/voicelistresponse.ts +49 -0
  365. package/src/models/components/voiceresponse.ts +59 -0
  366. package/src/models/components/voiceupdaterequest.ts +46 -0
  367. package/src/models/components/websearchpremiumtool.ts +21 -4
  368. package/src/models/components/websearchtool.ts +19 -4
  369. package/src/models/operations/connectorgetauthurlv1.ts +42 -0
  370. package/src/models/operations/deletevoicev1audiovoicesvoiceiddelete.ts +40 -0
  371. package/src/models/operations/getvoicesampleaudiov1audiovoicesvoiceidsampleget.ts +39 -0
  372. package/src/models/operations/getvoicev1audiovoicesvoiceidget.ts +39 -0
  373. package/src/models/operations/index.ts +8 -0
  374. package/src/models/operations/judgeconversationv1observabilityjudgesjudgeidlivejudgingpost.ts +49 -0
  375. package/src/models/operations/listvoicesv1audiovoicesget.ts +42 -0
  376. package/src/models/operations/speechv1audiospeechpost.ts +146 -0
  377. package/src/models/operations/updatevoicev1audiovoicesvoiceidpatch.ts +45 -0
  378. package/src/sdk/audio.ts +12 -0
  379. package/src/sdk/connectors.ts +18 -0
  380. package/src/sdk/judges.ts +16 -0
  381. package/src/sdk/sdk.ts +5 -5
  382. package/src/sdk/speech.ts +31 -0
  383. package/src/sdk/voices.ts +119 -0
@@ -0,0 +1,69 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 1c8e6b77a134
4
+ */
5
+ import { audioVoicesCreate } from "../funcs/audioVoicesCreate.js";
6
+ import { audioVoicesDelete } from "../funcs/audioVoicesDelete.js";
7
+ import { audioVoicesGet } from "../funcs/audioVoicesGet.js";
8
+ import { audioVoicesGetSampleAudio } from "../funcs/audioVoicesGetSampleAudio.js";
9
+ import { audioVoicesList } from "../funcs/audioVoicesList.js";
10
+ import { audioVoicesUpdate } from "../funcs/audioVoicesUpdate.js";
11
+ import { ClientSDK } from "../lib/sdks.js";
12
+ import { unwrapAsync } from "../types/fp.js";
13
+ export class Voices extends ClientSDK {
14
+ /**
15
+ * List all voices
16
+ *
17
+ * @remarks
18
+ * List all voices (excluding sample data)
19
+ */
20
+ async list(request, options) {
21
+ return unwrapAsync(audioVoicesList(this, request, options));
22
+ }
23
+ /**
24
+ * Create a new voice
25
+ *
26
+ * @remarks
27
+ * Create a new voice with a base64-encoded audio sample
28
+ */
29
+ async create(request, options) {
30
+ return unwrapAsync(audioVoicesCreate(this, request, options));
31
+ }
32
+ /**
33
+ * Delete a custom voice
34
+ *
35
+ * @remarks
36
+ * Delete a custom voice
37
+ */
38
+ async delete(request, options) {
39
+ return unwrapAsync(audioVoicesDelete(this, request, options));
40
+ }
41
+ /**
42
+ * Update voice metadata
43
+ *
44
+ * @remarks
45
+ * Update voice metadata (name, gender, languages, age, tags).
46
+ */
47
+ async update(request, options) {
48
+ return unwrapAsync(audioVoicesUpdate(this, request, options));
49
+ }
50
+ /**
51
+ * Get voice details
52
+ *
53
+ * @remarks
54
+ * Get voice details (excluding sample)
55
+ */
56
+ async get(request, options) {
57
+ return unwrapAsync(audioVoicesGet(this, request, options));
58
+ }
59
+ /**
60
+ * Get voice sample audio
61
+ *
62
+ * @remarks
63
+ * Get the audio sample for a voice
64
+ */
65
+ async getSampleAudio(request, options) {
66
+ return unwrapAsync(audioVoicesGetSampleAudio(this, request, options));
67
+ }
68
+ }
69
+ //# sourceMappingURL=voices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voices.js","sourceRoot":"","sources":["../../src/sdk/voices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAAO,MAAO,SAAQ,SAAS;IACnC;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CACR,OAAkE,EAClE,OAAwB,EACe;QACvC,OAAO,WAAW,CAAC,eAAe,CAChC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IAAA,CACJ;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CACV,OAAsC,EACtC,OAAwB,EACW;QACnC,OAAO,WAAW,CAAC,iBAAiB,CAClC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IAAA,CACJ;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CACV,OAAgE,EAChE,OAAwB,EACW;QACnC,OAAO,WAAW,CAAC,iBAAiB,CAClC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IAAA,CACJ;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CACV,OAA+D,EAC/D,OAAwB,EACW;QACnC,OAAO,WAAW,CAAC,iBAAiB,CAClC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IAAA,CACJ;IAED;;;;;OAKG;IACH,KAAK,CAAC,GAAG,CACP,OAA0D,EAC1D,OAAwB,EACW;QACnC,OAAO,WAAW,CAAC,cAAc,CAC/B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IAAA,CACJ;IAED;;;;;OAKG;IACH,KAAK,CAAC,cAAc,CAClB,OAA2E,EAC3E,OAAwB,EACP;QACjB,OAAO,WAAW,CAAC,yBAAyB,CAC1C,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IAAA,CACJ;CACF"}
@@ -1,11 +1,11 @@
1
- import { MistralGoogleCloud } from "@mistralai/mistralai-gcp";
1
+ import { MistralGCP } from "@mistralai/mistralai-gcp";
2
2
 
3
3
  const projectId = process.env["GOOGLE_PROJECT_ID"];
4
4
  if (!projectId) {
5
5
  throw new Error("missing GOOGLE_PROJECT_ID environment variable");
6
6
  }
7
7
 
8
- const sdk = new MistralGoogleCloud({
8
+ const sdk = new MistralGCP({
9
9
  region: "europe-west4",
10
10
  projectId: projectId,
11
11
  });
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@mistralai/mistralai",
5
- "version": "2.0.0-alpha.1",
5
+ "version": "2.1.0",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@mistralai/mistralai",
3
- "version": "2.0.0-alpha.1",
4
- "author": "Speakeasy",
3
+ "version": "2.1.0",
4
+ "author": "Mistral AI",
5
+ "description": "TypeScript client library for the Mistral AI API",
5
6
  "license": "Apache-2.0",
6
7
  "type": "module",
7
8
  "main": "./esm/index.js",
@@ -49,6 +50,10 @@
49
50
  }
50
51
  },
51
52
  "sideEffects": false,
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "https://github.com/mistralai/client-ts.git"
56
+ },
52
57
  "scripts": {
53
58
  "lint": "oxlint --max-warnings=0 --deny-warnings 'src/**/*.{ts,tsx}'",
54
59
  "build": "tsgo",
@@ -64,6 +69,6 @@
64
69
  "dependencies": {
65
70
  "ws": "^8.18.0",
66
71
  "zod": "^3.25.0 || ^4.0.0",
67
- "zod-to-json-schema": "^3.24.1"
72
+ "zod-to-json-schema": "^3.25.0"
68
73
  }
69
74
  }
@@ -12,14 +12,14 @@ dotenv.config();
12
12
  * npm run build && npx tsx chatComplete.example.ts
13
13
  */
14
14
 
15
- import { MistralGoogleCloud } from "@mistralai/mistralai-gcp";
15
+ import { MistralGCP } from "@mistralai/mistralai-gcp";
16
16
 
17
- const mistralGoogleCloud = new MistralGoogleCloud({
17
+ const mistralGCP = new MistralGCP({
18
18
  apiKey: "<YOUR_BEARER_TOKEN_HERE>",
19
19
  });
20
20
 
21
21
  async function main() {
22
- const result = await mistralGoogleCloud.chat.complete({
22
+ const result = await mistralGCP.chat.complete({
23
23
  model: "mistral-large-latest",
24
24
  messages: [
25
25
  {
@@ -11,4 +11,4 @@ import { ClientSDK } from "./lib/sdks.js";
11
11
  * application and passed around through some dependency injection mechanism to
12
12
  * parts of an application that need to make SDK calls.
13
13
  */
14
- export class MistralGoogleCloudCore extends ClientSDK {}
14
+ export class MistralGCPCore extends ClientSDK {}
@@ -3,7 +3,7 @@
3
3
  * @generated-id: 28f4bdac1bad
4
4
  */
5
5
 
6
- import { MistralGoogleCloudCore } from "../core.js";
6
+ import { MistralGCPCore } from "../core.js";
7
7
  import { encodeJSON } from "../lib/encodings.js";
8
8
  import * as M from "../lib/matchers.js";
9
9
  import { compactMap } from "../lib/primitives.js";
@@ -20,7 +20,7 @@ import {
20
20
  UnexpectedClientError,
21
21
  } from "../models/errors/httpclienterrors.js";
22
22
  import * as errors from "../models/errors/index.js";
23
- import { MistralGoogleCloudError } from "../models/errors/mistralgoogleclouderror.js";
23
+ import { MistralGCPError } from "../models/errors/mistralgoogleclouderror.js";
24
24
  import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
25
25
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
26
26
  import { APICall, APIPromise } from "../types/async.js";
@@ -30,14 +30,14 @@ import { Result } from "../types/fp.js";
30
30
  * Chat Completion
31
31
  */
32
32
  export function chatComplete(
33
- client: MistralGoogleCloudCore,
33
+ client: MistralGCPCore,
34
34
  request: components.ChatCompletionRequest,
35
35
  options?: RequestOptions,
36
36
  ): APIPromise<
37
37
  Result<
38
38
  components.ChatCompletionResponse,
39
39
  | errors.HTTPValidationError
40
- | MistralGoogleCloudError
40
+ | MistralGCPError
41
41
  | ResponseValidationError
42
42
  | ConnectionError
43
43
  | RequestAbortedError
@@ -55,7 +55,7 @@ export function chatComplete(
55
55
  }
56
56
 
57
57
  async function $do(
58
- client: MistralGoogleCloudCore,
58
+ client: MistralGCPCore,
59
59
  request: components.ChatCompletionRequest,
60
60
  options?: RequestOptions,
61
61
  ): Promise<
@@ -63,7 +63,7 @@ async function $do(
63
63
  Result<
64
64
  components.ChatCompletionResponse,
65
65
  | errors.HTTPValidationError
66
- | MistralGoogleCloudError
66
+ | MistralGCPError
67
67
  | ResponseValidationError
68
68
  | ConnectionError
69
69
  | RequestAbortedError
@@ -145,7 +145,7 @@ async function $do(
145
145
  const [result] = await M.match<
146
146
  components.ChatCompletionResponse,
147
147
  | errors.HTTPValidationError
148
- | MistralGoogleCloudError
148
+ | MistralGCPError
149
149
  | ResponseValidationError
150
150
  | ConnectionError
151
151
  | RequestAbortedError
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import * as z from "zod/v4";
7
- import { MistralGoogleCloudCore } from "../core.js";
7
+ import { MistralGCPCore } from "../core.js";
8
8
  import { encodeJSON } from "../lib/encodings.js";
9
9
  import { EventStream } from "../lib/event-streams.js";
10
10
  import * as M from "../lib/matchers.js";
@@ -22,7 +22,7 @@ import {
22
22
  UnexpectedClientError,
23
23
  } from "../models/errors/httpclienterrors.js";
24
24
  import * as errors from "../models/errors/index.js";
25
- import { MistralGoogleCloudError } from "../models/errors/mistralgoogleclouderror.js";
25
+ import { MistralGCPError } from "../models/errors/mistralgoogleclouderror.js";
26
26
  import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
27
27
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
28
28
  import { APICall, APIPromise } from "../types/async.js";
@@ -35,14 +35,14 @@ import { Result } from "../types/fp.js";
35
35
  * Mistral AI provides the ability to stream responses back to a client in order to allow partial results for certain requests. Tokens will be sent as data-only server-sent 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.
36
36
  */
37
37
  export function chatStream(
38
- client: MistralGoogleCloudCore,
38
+ client: MistralGCPCore,
39
39
  request: components.ChatCompletionStreamRequest,
40
40
  options?: RequestOptions,
41
41
  ): APIPromise<
42
42
  Result<
43
43
  EventStream<components.CompletionEvent>,
44
44
  | errors.HTTPValidationError
45
- | MistralGoogleCloudError
45
+ | MistralGCPError
46
46
  | ResponseValidationError
47
47
  | ConnectionError
48
48
  | RequestAbortedError
@@ -60,7 +60,7 @@ export function chatStream(
60
60
  }
61
61
 
62
62
  async function $do(
63
- client: MistralGoogleCloudCore,
63
+ client: MistralGCPCore,
64
64
  request: components.ChatCompletionStreamRequest,
65
65
  options?: RequestOptions,
66
66
  ): Promise<
@@ -68,7 +68,7 @@ async function $do(
68
68
  Result<
69
69
  EventStream<components.CompletionEvent>,
70
70
  | errors.HTTPValidationError
71
- | MistralGoogleCloudError
71
+ | MistralGCPError
72
72
  | ResponseValidationError
73
73
  | ConnectionError
74
74
  | RequestAbortedError
@@ -151,7 +151,7 @@ async function $do(
151
151
  const [result] = await M.match<
152
152
  EventStream<components.CompletionEvent>,
153
153
  | errors.HTTPValidationError
154
- | MistralGoogleCloudError
154
+ | MistralGCPError
155
155
  | ResponseValidationError
156
156
  | ConnectionError
157
157
  | RequestAbortedError
@@ -3,7 +3,7 @@
3
3
  * @generated-id: d9b14c7344f1
4
4
  */
5
5
 
6
- import { MistralGoogleCloudCore } from "../core.js";
6
+ import { MistralGCPCore } from "../core.js";
7
7
  import { encodeJSON } from "../lib/encodings.js";
8
8
  import * as M from "../lib/matchers.js";
9
9
  import { compactMap } from "../lib/primitives.js";
@@ -20,7 +20,7 @@ import {
20
20
  UnexpectedClientError,
21
21
  } from "../models/errors/httpclienterrors.js";
22
22
  import * as errors from "../models/errors/index.js";
23
- import { MistralGoogleCloudError } from "../models/errors/mistralgoogleclouderror.js";
23
+ import { MistralGCPError } from "../models/errors/mistralgoogleclouderror.js";
24
24
  import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
25
25
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
26
26
  import { APICall, APIPromise } from "../types/async.js";
@@ -33,14 +33,14 @@ import { Result } from "../types/fp.js";
33
33
  * FIM completion.
34
34
  */
35
35
  export function fimComplete(
36
- client: MistralGoogleCloudCore,
36
+ client: MistralGCPCore,
37
37
  request: components.FIMCompletionRequest,
38
38
  options?: RequestOptions,
39
39
  ): APIPromise<
40
40
  Result<
41
41
  components.FIMCompletionResponse,
42
42
  | errors.HTTPValidationError
43
- | MistralGoogleCloudError
43
+ | MistralGCPError
44
44
  | ResponseValidationError
45
45
  | ConnectionError
46
46
  | RequestAbortedError
@@ -58,7 +58,7 @@ export function fimComplete(
58
58
  }
59
59
 
60
60
  async function $do(
61
- client: MistralGoogleCloudCore,
61
+ client: MistralGCPCore,
62
62
  request: components.FIMCompletionRequest,
63
63
  options?: RequestOptions,
64
64
  ): Promise<
@@ -66,7 +66,7 @@ async function $do(
66
66
  Result<
67
67
  components.FIMCompletionResponse,
68
68
  | errors.HTTPValidationError
69
- | MistralGoogleCloudError
69
+ | MistralGCPError
70
70
  | ResponseValidationError
71
71
  | ConnectionError
72
72
  | RequestAbortedError
@@ -148,7 +148,7 @@ async function $do(
148
148
  const [result] = await M.match<
149
149
  components.FIMCompletionResponse,
150
150
  | errors.HTTPValidationError
151
- | MistralGoogleCloudError
151
+ | MistralGCPError
152
152
  | ResponseValidationError
153
153
  | ConnectionError
154
154
  | RequestAbortedError
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import * as z from "zod/v4";
7
- import { MistralGoogleCloudCore } from "../core.js";
7
+ import { MistralGCPCore } from "../core.js";
8
8
  import { encodeJSON } from "../lib/encodings.js";
9
9
  import { EventStream } from "../lib/event-streams.js";
10
10
  import * as M from "../lib/matchers.js";
@@ -22,7 +22,7 @@ import {
22
22
  UnexpectedClientError,
23
23
  } from "../models/errors/httpclienterrors.js";
24
24
  import * as errors from "../models/errors/index.js";
25
- import { MistralGoogleCloudError } from "../models/errors/mistralgoogleclouderror.js";
25
+ import { MistralGCPError } from "../models/errors/mistralgoogleclouderror.js";
26
26
  import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
27
27
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
28
28
  import { APICall, APIPromise } from "../types/async.js";
@@ -35,14 +35,14 @@ import { Result } from "../types/fp.js";
35
35
  * Mistral AI provides the ability to stream responses back to a client in order to allow partial results for certain requests. Tokens will be sent as data-only server-sent 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.
36
36
  */
37
37
  export function fimStream(
38
- client: MistralGoogleCloudCore,
38
+ client: MistralGCPCore,
39
39
  request: components.FIMCompletionStreamRequest,
40
40
  options?: RequestOptions,
41
41
  ): APIPromise<
42
42
  Result<
43
43
  EventStream<components.CompletionEvent>,
44
44
  | errors.HTTPValidationError
45
- | MistralGoogleCloudError
45
+ | MistralGCPError
46
46
  | ResponseValidationError
47
47
  | ConnectionError
48
48
  | RequestAbortedError
@@ -60,7 +60,7 @@ export function fimStream(
60
60
  }
61
61
 
62
62
  async function $do(
63
- client: MistralGoogleCloudCore,
63
+ client: MistralGCPCore,
64
64
  request: components.FIMCompletionStreamRequest,
65
65
  options?: RequestOptions,
66
66
  ): Promise<
@@ -68,7 +68,7 @@ async function $do(
68
68
  Result<
69
69
  EventStream<components.CompletionEvent>,
70
70
  | errors.HTTPValidationError
71
- | MistralGoogleCloudError
71
+ | MistralGCPError
72
72
  | ResponseValidationError
73
73
  | ConnectionError
74
74
  | RequestAbortedError
@@ -151,7 +151,7 @@ async function $do(
151
151
  const [result] = await M.match<
152
152
  EventStream<components.CompletionEvent>,
153
153
  | errors.HTTPValidationError
154
- | MistralGoogleCloudError
154
+ | MistralGCPError
155
155
  | ResponseValidationError
156
156
  | ConnectionError
157
157
  | RequestAbortedError
@@ -5,13 +5,13 @@
5
5
 
6
6
  import * as z from "zod/v4";
7
7
  import * as components from "../components/index.js";
8
- import { MistralGoogleCloudError } from "./mistralgoogleclouderror.js";
8
+ import { MistralGCPError } from "./mistralgoogleclouderror.js";
9
9
 
10
10
  export type HTTPValidationErrorData = {
11
11
  detail?: Array<components.ValidationError> | undefined;
12
12
  };
13
13
 
14
- export class HTTPValidationError extends MistralGoogleCloudError {
14
+ export class HTTPValidationError extends MistralGCPError {
15
15
  detail?: Array<components.ValidationError> | undefined;
16
16
 
17
17
  /** The original data that was passed to this error instance. */
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  /** The base class for all HTTP error responses */
7
- export class MistralGoogleCloudError extends Error {
7
+ export class MistralGCPError extends Error {
8
8
  /** HTTP status code */
9
9
  public readonly statusCode: number;
10
10
  /** HTTP body */
@@ -31,6 +31,6 @@ export class MistralGoogleCloudError extends Error {
31
31
  this.contentType = httpMeta.response.headers.get("content-type") || "";
32
32
  this.rawResponse = httpMeta.response;
33
33
 
34
- this.name = "MistralGoogleCloudError";
34
+ this.name = "MistralGCPError";
35
35
  }
36
36
  }
@@ -4,10 +4,10 @@
4
4
  */
5
5
 
6
6
  import * as z from "zod/v4/core";
7
- import { MistralGoogleCloudError } from "./mistralgoogleclouderror.js";
7
+ import { MistralGCPError } from "./mistralgoogleclouderror.js";
8
8
  import { formatZodError } from "./sdkvalidationerror.js";
9
9
 
10
- export class ResponseValidationError extends MistralGoogleCloudError {
10
+ export class ResponseValidationError extends MistralGCPError {
11
11
  /**
12
12
  * The raw value that failed validation.
13
13
  */
@@ -3,10 +3,10 @@
3
3
  * @generated-id: 8e644875c472
4
4
  */
5
5
 
6
- import { MistralGoogleCloudError } from "./mistralgoogleclouderror.js";
6
+ import { MistralGCPError } from "./mistralgoogleclouderror.js";
7
7
 
8
8
  /** The fallback error class if no more specific error class is matched */
9
- export class SDKError extends MistralGoogleCloudError {
9
+ export class SDKError extends MistralGCPError {
10
10
  constructor(
11
11
  message: string,
12
12
  httpMeta: {
@@ -31,7 +31,7 @@ function getModelInfo(model: string): [string, string] {
31
31
  return [model, modelId];
32
32
  }
33
33
 
34
- export class MistralGoogleCloud extends ClientSDK {
34
+ export class MistralGCP extends ClientSDK {
35
35
  constructor(options: SDKOptions & GoogleCloudOptions = {}) {
36
36
  let projectId = options.projectId ?? "";
37
37
  options.region = options.region ?? "europe-west4";
@@ -47,18 +47,19 @@ export class MistralGoogleCloud extends ClientSDK {
47
47
  options.apiKey = async () => {
48
48
  const authClient = await auth.getClient();
49
49
  const authHeaders = await authClient.getRequestHeaders();
50
- const token = authHeaders["Authorization"];
50
+ const token = authHeaders.get("Authorization");
51
51
  if (!token) {
52
52
  throw new Error("failed to get Google Cloud API key from the default authorization provider, check you are authenticated");
53
53
  }
54
54
 
55
55
  if (!options.projectId) {
56
- if (!authHeaders["x-goog-user-project"]) {
56
+ const userProject = authHeaders.get("x-goog-user-project");
57
+ if (!userProject) {
57
58
  throw new Error(
58
- "no project id available in default google credentials. Please provide a project id in the input arguments to MistralGoogleCloud."
59
+ "no project id available in default google credentials. Please provide a project id in the input arguments to MistralGCP."
59
60
  );
60
61
  }
61
- projectId = authHeaders["x-goog-user-project"];
62
+ projectId = userProject;
62
63
  }
63
64
  return token;
64
65
  }
@@ -1,13 +1,79 @@
1
1
  import { z } from 'zod';
2
+ import { z as zv4 } from 'zod/v4';
2
3
  import { zodToJsonSchema } from "zod-to-json-schema";
3
4
  import { ResponseFormat } from "../models/components/responseformat.js";
4
5
  import * as components from "../models/components/index.js";
5
6
 
7
+ /**
8
+ * Recursively makes a JSON schema strict-mode compatible:
9
+ * - Sets additionalProperties: false on all objects
10
+ * - Makes optional properties required with nullable type
11
+ * Mirrors Python SDK's rec_strict_json_schema + optional handling.
12
+ */
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- operating on raw JSON schema objects
14
+ function makeStrictJsonSchema(node: any): any {
15
+ if (typeof node !== 'object' || node === null) return node;
16
+ const result = { ...node };
17
+
18
+ if (result.type === 'object' && result.properties && typeof result.properties === 'object') {
19
+ const required = new Set<string>(Array.isArray(result.required) ? result.required : []);
20
+ const props: Record<string, any> = {};
21
+
22
+ for (const [key, value] of Object.entries(result.properties)) {
23
+ const processed = makeStrictJsonSchema(value);
24
+ if (!required.has(key)) {
25
+ required.add(key);
26
+ if (Array.isArray(processed.type)) {
27
+ if (!processed.type.includes('null')) props[key] = { ...processed, type: [...processed.type, 'null'] };
28
+ else props[key] = processed;
29
+ } else if (Array.isArray(processed.anyOf)) {
30
+ if (!processed.anyOf.some((s: any) => s.type === 'null'))
31
+ props[key] = { ...processed, anyOf: [...processed.anyOf, { type: 'null' }] };
32
+ else props[key] = processed;
33
+ } else if (processed.type) {
34
+ props[key] = { ...processed, type: [processed.type, 'null'] };
35
+ } else {
36
+ props[key] = processed;
37
+ }
38
+ } else {
39
+ props[key] = processed;
40
+ }
41
+ }
42
+
43
+ result.properties = props;
44
+ result.required = [...required];
45
+ result.additionalProperties = false;
46
+ }
47
+
48
+ if (result.items) result.items = makeStrictJsonSchema(result.items);
49
+ for (const key of ['anyOf', 'oneOf', 'allOf']) {
50
+ if (Array.isArray(result[key]))
51
+ result[key] = result[key].map(makeStrictJsonSchema);
52
+ }
53
+ for (const key of ['$defs', 'definitions']) {
54
+ if (result[key] && typeof result[key] === 'object') {
55
+ const defs: Record<string, any> = {};
56
+ for (const [k, v] of Object.entries(result[key]))
57
+ defs[k] = makeStrictJsonSchema(v);
58
+ result[key] = defs;
59
+ }
60
+ }
61
+
62
+ return result;
63
+ }
64
+
6
65
  function toJsonSchema(schema: z.ZodTypeAny): Record<string, unknown> {
7
- if ('toJSONSchema' in z && typeof z.toJSONSchema === 'function') {
8
- return z.toJSONSchema(schema) as Record<string, unknown>;
66
+ let jsonSchema: Record<string, unknown>;
67
+
68
+ // Detect Zod v4 schemas by checking for _zod property (v3 schemas have _def only)
69
+ if ('_zod' in schema) {
70
+ jsonSchema = zv4.toJSONSchema(schema as any) as Record<string, unknown>;
71
+ } else {
72
+ jsonSchema = zodToJsonSchema(schema, { target: "openAi" }) as Record<string, unknown>;
9
73
  }
10
- return zodToJsonSchema(schema) as Record<string, unknown>;
74
+
75
+ delete jsonSchema['$schema'];
76
+ return makeStrictJsonSchema(jsonSchema);
11
77
  }
12
78
 
13
79
  export function transformToChatCompletionRequest<T extends z.ZodTypeAny>(
@@ -20,8 +86,8 @@ export function transformToChatCompletionRequest<T extends z.ZodTypeAny>(
20
86
 
21
87
  return {
22
88
  ...rest,
23
- responseFormat: transformedResponseFormat,
24
- };
89
+ ...(transformedResponseFormat ? { responseFormat: transformedResponseFormat } : {}),
90
+ } as components.ChatCompletionRequest;
25
91
  }
26
92
 
27
93
  export type ParsedChatCompletionRequest<T extends z.ZodTypeAny> = Omit<components.ChatCompletionRequest, 'responseFormat'> & {