@mastra/server 0.0.0-vector-sources-20250516175436 → 0.0.0-vector-extension-schema-20250922130418

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 (333) hide show
  1. package/CHANGELOG.md +3745 -0
  2. package/LICENSE.md +11 -42
  3. package/README.md +0 -5
  4. package/dist/{chunk-H5PTF3Y4.js → chunk-4QCXUEAT.js} +11 -2
  5. package/dist/chunk-4QCXUEAT.js.map +1 -0
  6. package/dist/chunk-4RRMWXQ2.js +3522 -0
  7. package/dist/chunk-4RRMWXQ2.js.map +1 -0
  8. package/dist/chunk-57HWW2TY.cjs +587 -0
  9. package/dist/chunk-57HWW2TY.cjs.map +1 -0
  10. package/dist/chunk-5DP5XZH6.cjs +928 -0
  11. package/dist/chunk-5DP5XZH6.cjs.map +1 -0
  12. package/dist/chunk-66YYHFGF.js +761 -0
  13. package/dist/chunk-66YYHFGF.js.map +1 -0
  14. package/dist/chunk-6GMFZ5LK.js +2774 -0
  15. package/dist/chunk-6GMFZ5LK.js.map +1 -0
  16. package/dist/chunk-743UIDHI.cjs +2013 -0
  17. package/dist/chunk-743UIDHI.cjs.map +1 -0
  18. package/dist/chunk-7JYXPDM4.js +15712 -0
  19. package/dist/chunk-7JYXPDM4.js.map +1 -0
  20. package/dist/{chunk-OCWPVYNI.cjs → chunk-7NADHFD2.cjs} +3 -0
  21. package/dist/chunk-7NADHFD2.cjs.map +1 -0
  22. package/dist/chunk-7QEJ5QG5.js +151 -0
  23. package/dist/chunk-7QEJ5QG5.js.map +1 -0
  24. package/dist/chunk-A3AL7EWJ.js +83 -0
  25. package/dist/chunk-A3AL7EWJ.js.map +1 -0
  26. package/dist/chunk-AK2FXLLB.cjs +849 -0
  27. package/dist/chunk-AK2FXLLB.cjs.map +1 -0
  28. package/dist/{chunk-5SN4U5AC.cjs → chunk-AVEPEUN4.cjs} +115 -138
  29. package/dist/chunk-AVEPEUN4.cjs.map +1 -0
  30. package/dist/chunk-CNU4A2XU.js +129 -0
  31. package/dist/chunk-CNU4A2XU.js.map +1 -0
  32. package/dist/chunk-CY4TP3FK.js +16 -0
  33. package/dist/chunk-CY4TP3FK.js.map +1 -0
  34. package/dist/chunk-EMMSS5I5.cjs +37 -0
  35. package/dist/chunk-EMMSS5I5.cjs.map +1 -0
  36. package/dist/chunk-EMNGA4R4.js +845 -0
  37. package/dist/chunk-EMNGA4R4.js.map +1 -0
  38. package/dist/chunk-FALVL2VV.cjs +3525 -0
  39. package/dist/chunk-FALVL2VV.cjs.map +1 -0
  40. package/dist/chunk-FQNT7PI4.js +937 -0
  41. package/dist/chunk-FQNT7PI4.js.map +1 -0
  42. package/dist/chunk-G3PMV62Z.js +33 -0
  43. package/dist/chunk-G3PMV62Z.js.map +1 -0
  44. package/dist/chunk-G4PUALCE.cjs +28 -0
  45. package/dist/chunk-G4PUALCE.cjs.map +1 -0
  46. package/dist/chunk-G662L2YZ.js +568 -0
  47. package/dist/chunk-G662L2YZ.js.map +1 -0
  48. package/dist/chunk-GDWMF6SB.cjs +133 -0
  49. package/dist/chunk-GDWMF6SB.cjs.map +1 -0
  50. package/dist/chunk-GU4EWMZB.cjs +769 -0
  51. package/dist/chunk-GU4EWMZB.cjs.map +1 -0
  52. package/dist/chunk-GUI3CROV.cjs +159 -0
  53. package/dist/chunk-GUI3CROV.cjs.map +1 -0
  54. package/dist/chunk-HJQKWRKQ.cjs +764 -0
  55. package/dist/chunk-HJQKWRKQ.cjs.map +1 -0
  56. package/dist/{chunk-YWLUOY3D.cjs → chunk-HVBBFCDH.cjs} +1110 -793
  57. package/dist/chunk-HVBBFCDH.cjs.map +1 -0
  58. package/dist/chunk-HZJRQ5L3.cjs +1411 -0
  59. package/dist/chunk-HZJRQ5L3.cjs.map +1 -0
  60. package/dist/chunk-IGFMAZZ5.cjs +1150 -0
  61. package/dist/chunk-IGFMAZZ5.cjs.map +1 -0
  62. package/dist/chunk-ILESGJ6N.js +524 -0
  63. package/dist/chunk-ILESGJ6N.js.map +1 -0
  64. package/dist/chunk-IOQGI4ML.js +931 -0
  65. package/dist/chunk-IOQGI4ML.js.map +1 -0
  66. package/dist/chunk-J7BPKKOG.cjs +163 -0
  67. package/dist/chunk-J7BPKKOG.cjs.map +1 -0
  68. package/dist/{chunk-HFWCEP5S.js → chunk-JRDEOHAJ.js} +47 -14
  69. package/dist/chunk-JRDEOHAJ.js.map +1 -0
  70. package/dist/chunk-KNGXRN26.cjs +335 -0
  71. package/dist/chunk-KNGXRN26.cjs.map +1 -0
  72. package/dist/{chunk-OR3CIE2H.js → chunk-KV6VHX4V.js} +29 -7
  73. package/dist/chunk-KV6VHX4V.js.map +1 -0
  74. package/dist/chunk-L265APUD.cjs +69 -0
  75. package/dist/chunk-L265APUD.cjs.map +1 -0
  76. package/dist/chunk-LF2ZLOFP.js +767 -0
  77. package/dist/chunk-LF2ZLOFP.js.map +1 -0
  78. package/dist/chunk-LYPU75T6.js +1147 -0
  79. package/dist/chunk-LYPU75T6.js.map +1 -0
  80. package/dist/{chunk-NYN7KFXL.js → chunk-MMROOK5J.js} +3 -0
  81. package/dist/chunk-MMROOK5J.js.map +1 -0
  82. package/dist/chunk-N35YCWQ5.cjs +540 -0
  83. package/dist/chunk-N35YCWQ5.cjs.map +1 -0
  84. package/dist/{chunk-LIVAK2DM.js → chunk-N7F33WAD.js} +1083 -794
  85. package/dist/chunk-N7F33WAD.js.map +1 -0
  86. package/dist/chunk-NG5IVLEZ.js +1012 -0
  87. package/dist/chunk-NG5IVLEZ.js.map +1 -0
  88. package/dist/chunk-NLWACBE7.cjs +128 -0
  89. package/dist/chunk-NLWACBE7.cjs.map +1 -0
  90. package/dist/chunk-OGW6HHVI.js +1408 -0
  91. package/dist/chunk-OGW6HHVI.js.map +1 -0
  92. package/dist/chunk-OJQOYXHU.cjs +15748 -0
  93. package/dist/chunk-OJQOYXHU.cjs.map +1 -0
  94. package/dist/chunk-OZLRIVC4.cjs +588 -0
  95. package/dist/chunk-OZLRIVC4.cjs.map +1 -0
  96. package/dist/chunk-P7CIEIJ3.js +925 -0
  97. package/dist/chunk-P7CIEIJ3.js.map +1 -0
  98. package/dist/chunk-P7RBMCBE.cjs +934 -0
  99. package/dist/chunk-P7RBMCBE.cjs.map +1 -0
  100. package/dist/chunk-PPYGWINI.cjs +2777 -0
  101. package/dist/chunk-PPYGWINI.cjs.map +1 -0
  102. package/dist/{chunk-P6SCPDYW.js → chunk-PUYSH3IL.js} +114 -137
  103. package/dist/chunk-PUYSH3IL.js.map +1 -0
  104. package/dist/{chunk-MHKNLNAN.cjs → chunk-PWTXZZTR.cjs} +33 -10
  105. package/dist/chunk-PWTXZZTR.cjs.map +1 -0
  106. package/dist/chunk-R7NOGUZG.js +65 -0
  107. package/dist/chunk-R7NOGUZG.js.map +1 -0
  108. package/dist/chunk-RCHEPTZZ.js +2006 -0
  109. package/dist/chunk-RCHEPTZZ.js.map +1 -0
  110. package/dist/chunk-RE4RPXT2.cjs +18 -0
  111. package/dist/chunk-RE4RPXT2.cjs.map +1 -0
  112. package/dist/chunk-SIGXR3JT.cjs +1043 -0
  113. package/dist/chunk-SIGXR3JT.cjs.map +1 -0
  114. package/dist/chunk-SPLSYTYW.cjs +88 -0
  115. package/dist/chunk-SPLSYTYW.cjs.map +1 -0
  116. package/dist/chunk-SQY4T6EJ.js +571 -0
  117. package/dist/chunk-SQY4T6EJ.js.map +1 -0
  118. package/dist/{chunk-TJKLBTFB.js → chunk-SYRRSBGL.js} +51 -27
  119. package/dist/chunk-SYRRSBGL.js.map +1 -0
  120. package/dist/{chunk-BNEY4P4P.cjs → chunk-T3TIA3O6.cjs} +20 -18
  121. package/dist/chunk-T3TIA3O6.cjs.map +1 -0
  122. package/dist/{chunk-EJO45KYT.js → chunk-TTHEEIZ3.js} +53 -50
  123. package/dist/chunk-TTHEEIZ3.js.map +1 -0
  124. package/dist/chunk-TVSIG4JE.cjs +940 -0
  125. package/dist/chunk-TVSIG4JE.cjs.map +1 -0
  126. package/dist/{chunk-55DOQLP6.js → chunk-WHN4VX55.js} +5 -3
  127. package/dist/chunk-WHN4VX55.js.map +1 -0
  128. package/dist/dist-26HWEQY6.js +3 -0
  129. package/dist/dist-26HWEQY6.js.map +1 -0
  130. package/dist/dist-3A5DXB37.cjs +20 -0
  131. package/dist/dist-3A5DXB37.cjs.map +1 -0
  132. package/dist/dist-3SJKQJGY.cjs +16 -0
  133. package/dist/dist-3SJKQJGY.cjs.map +1 -0
  134. package/dist/dist-4ZQSPE5K.js +3 -0
  135. package/dist/dist-4ZQSPE5K.js.map +1 -0
  136. package/dist/dist-5W5QNRTD.js +3 -0
  137. package/dist/dist-5W5QNRTD.js.map +1 -0
  138. package/dist/dist-653SRMPL.js +3 -0
  139. package/dist/dist-653SRMPL.js.map +1 -0
  140. package/dist/dist-6U6EFC5C.cjs +16 -0
  141. package/dist/dist-6U6EFC5C.cjs.map +1 -0
  142. package/dist/dist-7IHNNYMF.cjs +16 -0
  143. package/dist/dist-7IHNNYMF.cjs.map +1 -0
  144. package/dist/dist-B5IPRF6W.js +3 -0
  145. package/dist/dist-B5IPRF6W.js.map +1 -0
  146. package/dist/dist-EOMYFT4Y.cjs +16 -0
  147. package/dist/dist-EOMYFT4Y.cjs.map +1 -0
  148. package/dist/dist-EZZMMMNT.cjs +16 -0
  149. package/dist/dist-EZZMMMNT.cjs.map +1 -0
  150. package/dist/dist-F2ET4MNO.cjs +16 -0
  151. package/dist/dist-F2ET4MNO.cjs.map +1 -0
  152. package/dist/dist-H64VX6DE.js +3 -0
  153. package/dist/dist-H64VX6DE.js.map +1 -0
  154. package/dist/dist-HY7RMLJQ.cjs +16 -0
  155. package/dist/dist-HY7RMLJQ.cjs.map +1 -0
  156. package/dist/dist-M6S4P3FJ.js +3 -0
  157. package/dist/dist-M6S4P3FJ.js.map +1 -0
  158. package/dist/dist-NR7QSCQT.js +3 -0
  159. package/dist/dist-NR7QSCQT.js.map +1 -0
  160. package/dist/dist-QLFMCMCX.js +3 -0
  161. package/dist/dist-QLFMCMCX.js.map +1 -0
  162. package/dist/dist-UY46BFRP.js +3 -0
  163. package/dist/dist-UY46BFRP.js.map +1 -0
  164. package/dist/dist-WCQDRTIV.cjs +16 -0
  165. package/dist/dist-WCQDRTIV.cjs.map +1 -0
  166. package/dist/dist-WKYB3LTJ.cjs +16 -0
  167. package/dist/dist-WKYB3LTJ.cjs.map +1 -0
  168. package/dist/index.cjs +6 -0
  169. package/dist/index.cjs.map +1 -0
  170. package/dist/index.d.ts +1 -0
  171. package/dist/index.d.ts.map +1 -0
  172. package/dist/index.js +5 -0
  173. package/dist/index.js.map +1 -0
  174. package/dist/server/a2a/protocol.d.ts +8 -0
  175. package/dist/server/a2a/protocol.d.ts.map +1 -0
  176. package/dist/server/a2a/store.cjs +25 -0
  177. package/dist/server/a2a/store.cjs.map +1 -0
  178. package/dist/server/a2a/store.d.ts +14 -0
  179. package/dist/server/a2a/store.d.ts.map +1 -0
  180. package/dist/server/a2a/store.js +23 -0
  181. package/dist/server/a2a/store.js.map +1 -0
  182. package/dist/server/a2a/tasks.d.ts +20 -0
  183. package/dist/server/a2a/tasks.d.ts.map +1 -0
  184. package/dist/server/handlers/a2a.cjs +13 -11
  185. package/dist/server/handlers/a2a.cjs.map +1 -0
  186. package/dist/server/handlers/a2a.d.ts +68 -6
  187. package/dist/server/handlers/a2a.d.ts.map +1 -0
  188. package/dist/server/handlers/a2a.js +3 -1
  189. package/dist/server/handlers/a2a.js.map +1 -0
  190. package/dist/server/handlers/agent-builder.cjs +68 -0
  191. package/dist/server/handlers/agent-builder.cjs.map +1 -0
  192. package/dist/server/handlers/agent-builder.d.ts +88 -0
  193. package/dist/server/handlers/agent-builder.d.ts.map +1 -0
  194. package/dist/server/handlers/agent-builder.js +3 -0
  195. package/dist/server/handlers/agent-builder.js.map +1 -0
  196. package/dist/server/handlers/agents.cjs +41 -7
  197. package/dist/server/handlers/agents.cjs.map +1 -0
  198. package/dist/server/handlers/agents.d.ts +139 -6
  199. package/dist/server/handlers/agents.d.ts.map +1 -0
  200. package/dist/server/handlers/agents.js +3 -1
  201. package/dist/server/handlers/agents.js.map +1 -0
  202. package/dist/server/handlers/error.cjs +4 -2
  203. package/dist/server/handlers/error.cjs.map +1 -0
  204. package/dist/server/handlers/error.d.ts +2 -1
  205. package/dist/server/handlers/error.d.ts.map +1 -0
  206. package/dist/server/handlers/error.js +3 -1
  207. package/dist/server/handlers/error.js.map +1 -0
  208. package/dist/server/handlers/legacyWorkflows.cjs +48 -0
  209. package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
  210. package/dist/server/handlers/legacyWorkflows.d.ts +59 -0
  211. package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
  212. package/dist/server/handlers/legacyWorkflows.js +3 -0
  213. package/dist/server/handlers/legacyWorkflows.js.map +1 -0
  214. package/dist/server/handlers/logs.cjs +6 -4
  215. package/dist/server/handlers/logs.cjs.map +1 -0
  216. package/dist/server/handlers/logs.d.ts +34 -3
  217. package/dist/server/handlers/logs.d.ts.map +1 -0
  218. package/dist/server/handlers/logs.js +3 -1
  219. package/dist/server/handlers/logs.js.map +1 -0
  220. package/dist/server/handlers/memory.cjs +39 -9
  221. package/dist/server/handlers/memory.cjs.map +1 -0
  222. package/dist/server/handlers/memory.d.ts +118 -8
  223. package/dist/server/handlers/memory.d.ts.map +1 -0
  224. package/dist/server/handlers/memory.js +3 -1
  225. package/dist/server/handlers/memory.js.map +1 -0
  226. package/dist/server/handlers/observability.cjs +16 -0
  227. package/dist/server/handlers/observability.cjs.map +1 -0
  228. package/dist/server/handlers/observability.d.ts +23 -0
  229. package/dist/server/handlers/observability.d.ts.map +1 -0
  230. package/dist/server/handlers/observability.js +3 -0
  231. package/dist/server/handlers/observability.js.map +1 -0
  232. package/dist/server/handlers/scores.cjs +32 -0
  233. package/dist/server/handlers/scores.cjs.map +1 -0
  234. package/dist/server/handlers/scores.d.ts +49 -0
  235. package/dist/server/handlers/scores.d.ts.map +1 -0
  236. package/dist/server/handlers/scores.js +3 -0
  237. package/dist/server/handlers/scores.js.map +1 -0
  238. package/dist/server/handlers/telemetry.cjs +9 -3
  239. package/dist/server/handlers/telemetry.cjs.map +1 -0
  240. package/dist/server/handlers/telemetry.d.ts +33 -2
  241. package/dist/server/handlers/telemetry.d.ts.map +1 -0
  242. package/dist/server/handlers/telemetry.js +3 -1
  243. package/dist/server/handlers/telemetry.js.map +1 -0
  244. package/dist/server/handlers/tools.cjs +11 -5
  245. package/dist/server/handlers/tools.cjs.map +1 -0
  246. package/dist/server/handlers/tools.d.ts +25 -4
  247. package/dist/server/handlers/tools.d.ts.map +1 -0
  248. package/dist/server/handlers/tools.js +3 -1
  249. package/dist/server/handlers/tools.js.map +1 -0
  250. package/dist/server/handlers/utils.cjs +8 -2
  251. package/dist/server/handlers/utils.cjs.map +1 -0
  252. package/dist/server/handlers/utils.d.ts +8 -1
  253. package/dist/server/handlers/utils.d.ts.map +1 -0
  254. package/dist/server/handlers/utils.js +3 -1
  255. package/dist/server/handlers/utils.js.map +1 -0
  256. package/dist/server/handlers/vNextNetwork.cjs +220 -0
  257. package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
  258. package/dist/server/handlers/vNextNetwork.d.ts +246 -0
  259. package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
  260. package/dist/server/handlers/vNextNetwork.js +213 -0
  261. package/dist/server/handlers/vNextNetwork.js.map +1 -0
  262. package/dist/server/handlers/vector.cjs +9 -7
  263. package/dist/server/handlers/vector.cjs.map +1 -0
  264. package/dist/server/handlers/vector.d.ts +51 -6
  265. package/dist/server/handlers/vector.d.ts.map +1 -0
  266. package/dist/server/handlers/vector.js +3 -1
  267. package/dist/server/handlers/vector.js.map +1 -0
  268. package/dist/server/handlers/voice.cjs +10 -4
  269. package/dist/server/handlers/voice.cjs.map +1 -0
  270. package/dist/server/handlers/voice.d.ts +41 -3
  271. package/dist/server/handlers/voice.d.ts.map +1 -0
  272. package/dist/server/handlers/voice.js +3 -1
  273. package/dist/server/handlers/voice.js.map +1 -0
  274. package/dist/server/handlers/workflows.cjs +43 -13
  275. package/dist/server/handlers/workflows.cjs.map +1 -0
  276. package/dist/server/handlers/workflows.d.ts +82 -10
  277. package/dist/server/handlers/workflows.d.ts.map +1 -0
  278. package/dist/server/handlers/workflows.js +3 -1
  279. package/dist/server/handlers/workflows.js.map +1 -0
  280. package/dist/server/handlers.cjs +44 -32
  281. package/dist/server/handlers.cjs.map +1 -0
  282. package/dist/server/handlers.d.ts +14 -11
  283. package/dist/server/handlers.d.ts.map +1 -0
  284. package/dist/server/handlers.js +15 -11
  285. package/dist/server/handlers.js.map +1 -0
  286. package/dist/server/http-exception.d.ts +87 -0
  287. package/dist/server/http-exception.d.ts.map +1 -0
  288. package/dist/server/types.d.ts +10 -0
  289. package/dist/server/types.d.ts.map +1 -0
  290. package/dist/server/utils.d.ts +44 -0
  291. package/dist/server/utils.d.ts.map +1 -0
  292. package/package.json +51 -21
  293. package/dist/_tsup-dts-rollup.d.cts +0 -816
  294. package/dist/_tsup-dts-rollup.d.ts +0 -816
  295. package/dist/chunk-57CJTIPW.cjs +0 -18
  296. package/dist/chunk-64U3UDTH.cjs +0 -13
  297. package/dist/chunk-75ZPJI57.cjs +0 -9
  298. package/dist/chunk-C7564HUT.js +0 -142
  299. package/dist/chunk-D4IRYCUI.cjs +0 -235
  300. package/dist/chunk-DJJIUEL2.js +0 -211
  301. package/dist/chunk-HWZVAG3H.js +0 -49
  302. package/dist/chunk-I2B73Y4I.cjs +0 -332
  303. package/dist/chunk-M5ABIP7D.js +0 -11
  304. package/dist/chunk-MIQYDLLM.js +0 -329
  305. package/dist/chunk-MLKGABMK.js +0 -7
  306. package/dist/chunk-OGCNNUHF.cjs +0 -54
  307. package/dist/chunk-UCTEMO2Q.cjs +0 -341
  308. package/dist/chunk-VPNDC2DI.cjs +0 -148
  309. package/dist/chunk-WUC6LSTW.js +0 -227
  310. package/dist/chunk-Y7UWRW5X.cjs +0 -221
  311. package/dist/chunk-YBVOQN4M.cjs +0 -94
  312. package/dist/chunk-ZE5AAC4I.cjs +0 -138
  313. package/dist/index.d.cts +0 -1
  314. package/dist/server/handlers/a2a.d.cts +0 -6
  315. package/dist/server/handlers/agents.d.cts +0 -6
  316. package/dist/server/handlers/error.d.cts +0 -1
  317. package/dist/server/handlers/logs.d.cts +0 -3
  318. package/dist/server/handlers/memory.d.cts +0 -8
  319. package/dist/server/handlers/network.cjs +0 -22
  320. package/dist/server/handlers/network.d.cts +0 -4
  321. package/dist/server/handlers/network.d.ts +0 -4
  322. package/dist/server/handlers/network.js +0 -1
  323. package/dist/server/handlers/telemetry.d.cts +0 -2
  324. package/dist/server/handlers/tools.d.cts +0 -4
  325. package/dist/server/handlers/utils.d.cts +0 -1
  326. package/dist/server/handlers/vNextWorkflows.cjs +0 -46
  327. package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
  328. package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
  329. package/dist/server/handlers/vNextWorkflows.js +0 -1
  330. package/dist/server/handlers/vector.d.cts +0 -6
  331. package/dist/server/handlers/voice.d.cts +0 -3
  332. package/dist/server/handlers/workflows.d.cts +0 -10
  333. package/dist/server/handlers.d.cts +0 -11
@@ -0,0 +1,764 @@
1
+ 'use strict';
2
+
3
+ var chunkSIGXR3JT_cjs = require('./chunk-SIGXR3JT.cjs');
4
+ var zod = require('zod');
5
+
6
+ function convertToGroqChatMessages(prompt) {
7
+ const messages = [];
8
+ for (const { role, content } of prompt) {
9
+ switch (role) {
10
+ case "system": {
11
+ messages.push({ role: "system", content });
12
+ break;
13
+ }
14
+ case "user": {
15
+ if (content.length === 1 && content[0].type === "text") {
16
+ messages.push({ role: "user", content: content[0].text });
17
+ break;
18
+ }
19
+ messages.push({
20
+ role: "user",
21
+ content: content.map((part) => {
22
+ var _a;
23
+ switch (part.type) {
24
+ case "text": {
25
+ return { type: "text", text: part.text };
26
+ }
27
+ case "image": {
28
+ return {
29
+ type: "image_url",
30
+ image_url: {
31
+ url: part.image instanceof URL ? part.image.toString() : `data:${(_a = part.mimeType) != null ? _a : "image/jpeg"};base64,${chunkSIGXR3JT_cjs.convertUint8ArrayToBase64(part.image)}`
32
+ }
33
+ };
34
+ }
35
+ case "file": {
36
+ throw new chunkSIGXR3JT_cjs.UnsupportedFunctionalityError({
37
+ functionality: "File content parts in user messages"
38
+ });
39
+ }
40
+ }
41
+ })
42
+ });
43
+ break;
44
+ }
45
+ case "assistant": {
46
+ let text = "";
47
+ const toolCalls = [];
48
+ for (const part of content) {
49
+ switch (part.type) {
50
+ case "text": {
51
+ text += part.text;
52
+ break;
53
+ }
54
+ case "tool-call": {
55
+ toolCalls.push({
56
+ id: part.toolCallId,
57
+ type: "function",
58
+ function: {
59
+ name: part.toolName,
60
+ arguments: JSON.stringify(part.args)
61
+ }
62
+ });
63
+ break;
64
+ }
65
+ }
66
+ }
67
+ messages.push({
68
+ role: "assistant",
69
+ content: text,
70
+ tool_calls: toolCalls.length > 0 ? toolCalls : void 0
71
+ });
72
+ break;
73
+ }
74
+ case "tool": {
75
+ for (const toolResponse of content) {
76
+ messages.push({
77
+ role: "tool",
78
+ tool_call_id: toolResponse.toolCallId,
79
+ content: JSON.stringify(toolResponse.result)
80
+ });
81
+ }
82
+ break;
83
+ }
84
+ default: {
85
+ const _exhaustiveCheck = role;
86
+ throw new Error(`Unsupported role: ${_exhaustiveCheck}`);
87
+ }
88
+ }
89
+ }
90
+ return messages;
91
+ }
92
+ function getResponseMetadata({
93
+ id,
94
+ model,
95
+ created
96
+ }) {
97
+ return {
98
+ id: id != null ? id : void 0,
99
+ modelId: model != null ? model : void 0,
100
+ timestamp: created != null ? new Date(created * 1e3) : void 0
101
+ };
102
+ }
103
+ var groqErrorDataSchema = zod.z.object({
104
+ error: zod.z.object({
105
+ message: zod.z.string(),
106
+ type: zod.z.string()
107
+ })
108
+ });
109
+ var groqFailedResponseHandler = chunkSIGXR3JT_cjs.createJsonErrorResponseHandler({
110
+ errorSchema: groqErrorDataSchema,
111
+ errorToMessage: (data) => data.error.message
112
+ });
113
+ function prepareTools({
114
+ mode
115
+ }) {
116
+ var _a;
117
+ const tools = ((_a = mode.tools) == null ? void 0 : _a.length) ? mode.tools : void 0;
118
+ const toolWarnings = [];
119
+ if (tools == null) {
120
+ return { tools: void 0, tool_choice: void 0, toolWarnings };
121
+ }
122
+ const toolChoice = mode.toolChoice;
123
+ const groqTools = [];
124
+ for (const tool of tools) {
125
+ if (tool.type === "provider-defined") {
126
+ toolWarnings.push({ type: "unsupported-tool", tool });
127
+ } else {
128
+ groqTools.push({
129
+ type: "function",
130
+ function: {
131
+ name: tool.name,
132
+ description: tool.description,
133
+ parameters: tool.parameters
134
+ }
135
+ });
136
+ }
137
+ }
138
+ if (toolChoice == null) {
139
+ return { tools: groqTools, tool_choice: void 0, toolWarnings };
140
+ }
141
+ const type = toolChoice.type;
142
+ switch (type) {
143
+ case "auto":
144
+ case "none":
145
+ case "required":
146
+ return { tools: groqTools, tool_choice: type, toolWarnings };
147
+ case "tool":
148
+ return {
149
+ tools: groqTools,
150
+ tool_choice: {
151
+ type: "function",
152
+ function: {
153
+ name: toolChoice.toolName
154
+ }
155
+ },
156
+ toolWarnings
157
+ };
158
+ default: {
159
+ const _exhaustiveCheck = type;
160
+ throw new chunkSIGXR3JT_cjs.UnsupportedFunctionalityError({
161
+ functionality: `Unsupported tool choice type: ${_exhaustiveCheck}`
162
+ });
163
+ }
164
+ }
165
+ }
166
+ function mapGroqFinishReason(finishReason) {
167
+ switch (finishReason) {
168
+ case "stop":
169
+ return "stop";
170
+ case "length":
171
+ return "length";
172
+ case "content_filter":
173
+ return "content-filter";
174
+ case "function_call":
175
+ case "tool_calls":
176
+ return "tool-calls";
177
+ default:
178
+ return "unknown";
179
+ }
180
+ }
181
+ var GroqChatLanguageModel = class {
182
+ constructor(modelId, settings, config) {
183
+ this.specificationVersion = "v1";
184
+ this.supportsStructuredOutputs = false;
185
+ this.defaultObjectGenerationMode = "json";
186
+ this.modelId = modelId;
187
+ this.settings = settings;
188
+ this.config = config;
189
+ }
190
+ get provider() {
191
+ return this.config.provider;
192
+ }
193
+ get supportsImageUrls() {
194
+ return !this.settings.downloadImages;
195
+ }
196
+ getArgs({
197
+ mode,
198
+ prompt,
199
+ maxTokens,
200
+ temperature,
201
+ topP,
202
+ topK,
203
+ frequencyPenalty,
204
+ presencePenalty,
205
+ stopSequences,
206
+ responseFormat,
207
+ seed,
208
+ stream,
209
+ providerMetadata
210
+ }) {
211
+ const type = mode.type;
212
+ const warnings = [];
213
+ if (topK != null) {
214
+ warnings.push({
215
+ type: "unsupported-setting",
216
+ setting: "topK"
217
+ });
218
+ }
219
+ if (responseFormat != null && responseFormat.type === "json" && responseFormat.schema != null) {
220
+ warnings.push({
221
+ type: "unsupported-setting",
222
+ setting: "responseFormat",
223
+ details: "JSON response format schema is not supported"
224
+ });
225
+ }
226
+ const groqOptions = chunkSIGXR3JT_cjs.parseProviderOptions({
227
+ provider: "groq",
228
+ providerOptions: providerMetadata,
229
+ schema: zod.z.object({
230
+ reasoningFormat: zod.z.enum(["parsed", "raw", "hidden"]).nullish()
231
+ })
232
+ });
233
+ const baseArgs = {
234
+ // model id:
235
+ model: this.modelId,
236
+ // model specific settings:
237
+ user: this.settings.user,
238
+ parallel_tool_calls: this.settings.parallelToolCalls,
239
+ // standardized settings:
240
+ max_tokens: maxTokens,
241
+ temperature,
242
+ top_p: topP,
243
+ frequency_penalty: frequencyPenalty,
244
+ presence_penalty: presencePenalty,
245
+ stop: stopSequences,
246
+ seed,
247
+ // response format:
248
+ response_format: (
249
+ // json object response format is not supported for streaming:
250
+ stream === false && (responseFormat == null ? void 0 : responseFormat.type) === "json" ? { type: "json_object" } : void 0
251
+ ),
252
+ // provider options:
253
+ reasoning_format: groqOptions == null ? void 0 : groqOptions.reasoningFormat,
254
+ // messages:
255
+ messages: convertToGroqChatMessages(prompt)
256
+ };
257
+ switch (type) {
258
+ case "regular": {
259
+ const { tools, tool_choice, toolWarnings } = prepareTools({ mode });
260
+ return {
261
+ args: {
262
+ ...baseArgs,
263
+ tools,
264
+ tool_choice
265
+ },
266
+ warnings: [...warnings, ...toolWarnings]
267
+ };
268
+ }
269
+ case "object-json": {
270
+ return {
271
+ args: {
272
+ ...baseArgs,
273
+ response_format: (
274
+ // json object response format is not supported for streaming:
275
+ stream === false ? { type: "json_object" } : void 0
276
+ )
277
+ },
278
+ warnings
279
+ };
280
+ }
281
+ case "object-tool": {
282
+ return {
283
+ args: {
284
+ ...baseArgs,
285
+ tool_choice: {
286
+ type: "function",
287
+ function: { name: mode.tool.name }
288
+ },
289
+ tools: [
290
+ {
291
+ type: "function",
292
+ function: {
293
+ name: mode.tool.name,
294
+ description: mode.tool.description,
295
+ parameters: mode.tool.parameters
296
+ }
297
+ }
298
+ ]
299
+ },
300
+ warnings
301
+ };
302
+ }
303
+ default: {
304
+ const _exhaustiveCheck = type;
305
+ throw new Error(`Unsupported type: ${_exhaustiveCheck}`);
306
+ }
307
+ }
308
+ }
309
+ async doGenerate(options) {
310
+ var _a, _b, _c, _d, _e, _f, _g;
311
+ const { args, warnings } = this.getArgs({ ...options, stream: false });
312
+ const body = JSON.stringify(args);
313
+ const {
314
+ responseHeaders,
315
+ value: response,
316
+ rawValue: rawResponse
317
+ } = await chunkSIGXR3JT_cjs.postJsonToApi({
318
+ url: this.config.url({
319
+ path: "/chat/completions",
320
+ modelId: this.modelId
321
+ }),
322
+ headers: chunkSIGXR3JT_cjs.combineHeaders(this.config.headers(), options.headers),
323
+ body: args,
324
+ failedResponseHandler: groqFailedResponseHandler,
325
+ successfulResponseHandler: chunkSIGXR3JT_cjs.createJsonResponseHandler(
326
+ groqChatResponseSchema
327
+ ),
328
+ abortSignal: options.abortSignal,
329
+ fetch: this.config.fetch
330
+ });
331
+ const { messages: rawPrompt, ...rawSettings } = args;
332
+ const choice = response.choices[0];
333
+ return {
334
+ text: (_a = choice.message.content) != null ? _a : void 0,
335
+ reasoning: (_b = choice.message.reasoning) != null ? _b : void 0,
336
+ toolCalls: (_c = choice.message.tool_calls) == null ? void 0 : _c.map((toolCall) => {
337
+ var _a2;
338
+ return {
339
+ toolCallType: "function",
340
+ toolCallId: (_a2 = toolCall.id) != null ? _a2 : chunkSIGXR3JT_cjs.generateId(),
341
+ toolName: toolCall.function.name,
342
+ args: toolCall.function.arguments
343
+ };
344
+ }),
345
+ finishReason: mapGroqFinishReason(choice.finish_reason),
346
+ usage: {
347
+ promptTokens: (_e = (_d = response.usage) == null ? void 0 : _d.prompt_tokens) != null ? _e : NaN,
348
+ completionTokens: (_g = (_f = response.usage) == null ? void 0 : _f.completion_tokens) != null ? _g : NaN
349
+ },
350
+ rawCall: { rawPrompt, rawSettings },
351
+ rawResponse: { headers: responseHeaders, body: rawResponse },
352
+ response: getResponseMetadata(response),
353
+ warnings,
354
+ request: { body }
355
+ };
356
+ }
357
+ async doStream(options) {
358
+ const { args, warnings } = this.getArgs({ ...options, stream: true });
359
+ const body = JSON.stringify({ ...args, stream: true });
360
+ const { responseHeaders, value: response } = await chunkSIGXR3JT_cjs.postJsonToApi({
361
+ url: this.config.url({
362
+ path: "/chat/completions",
363
+ modelId: this.modelId
364
+ }),
365
+ headers: chunkSIGXR3JT_cjs.combineHeaders(this.config.headers(), options.headers),
366
+ body: {
367
+ ...args,
368
+ stream: true
369
+ },
370
+ failedResponseHandler: groqFailedResponseHandler,
371
+ successfulResponseHandler: chunkSIGXR3JT_cjs.createEventSourceResponseHandler(groqChatChunkSchema),
372
+ abortSignal: options.abortSignal,
373
+ fetch: this.config.fetch
374
+ });
375
+ const { messages: rawPrompt, ...rawSettings } = args;
376
+ const toolCalls = [];
377
+ let finishReason = "unknown";
378
+ let usage = {
379
+ promptTokens: void 0,
380
+ completionTokens: void 0
381
+ };
382
+ let isFirstChunk = true;
383
+ return {
384
+ stream: response.pipeThrough(
385
+ new TransformStream({
386
+ transform(chunk, controller) {
387
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
388
+ if (!chunk.success) {
389
+ finishReason = "error";
390
+ controller.enqueue({ type: "error", error: chunk.error });
391
+ return;
392
+ }
393
+ const value = chunk.value;
394
+ if ("error" in value) {
395
+ finishReason = "error";
396
+ controller.enqueue({ type: "error", error: value.error });
397
+ return;
398
+ }
399
+ if (isFirstChunk) {
400
+ isFirstChunk = false;
401
+ controller.enqueue({
402
+ type: "response-metadata",
403
+ ...getResponseMetadata(value)
404
+ });
405
+ }
406
+ if (((_a = value.x_groq) == null ? void 0 : _a.usage) != null) {
407
+ usage = {
408
+ promptTokens: (_b = value.x_groq.usage.prompt_tokens) != null ? _b : void 0,
409
+ completionTokens: (_c = value.x_groq.usage.completion_tokens) != null ? _c : void 0
410
+ };
411
+ }
412
+ const choice = value.choices[0];
413
+ if ((choice == null ? void 0 : choice.finish_reason) != null) {
414
+ finishReason = mapGroqFinishReason(choice.finish_reason);
415
+ }
416
+ if ((choice == null ? void 0 : choice.delta) == null) {
417
+ return;
418
+ }
419
+ const delta = choice.delta;
420
+ if (delta.reasoning != null && delta.reasoning.length > 0) {
421
+ controller.enqueue({
422
+ type: "reasoning",
423
+ textDelta: delta.reasoning
424
+ });
425
+ }
426
+ if (delta.content != null && delta.content.length > 0) {
427
+ controller.enqueue({
428
+ type: "text-delta",
429
+ textDelta: delta.content
430
+ });
431
+ }
432
+ if (delta.tool_calls != null) {
433
+ for (const toolCallDelta of delta.tool_calls) {
434
+ const index = toolCallDelta.index;
435
+ if (toolCalls[index] == null) {
436
+ if (toolCallDelta.type !== "function") {
437
+ throw new chunkSIGXR3JT_cjs.InvalidResponseDataError({
438
+ data: toolCallDelta,
439
+ message: `Expected 'function' type.`
440
+ });
441
+ }
442
+ if (toolCallDelta.id == null) {
443
+ throw new chunkSIGXR3JT_cjs.InvalidResponseDataError({
444
+ data: toolCallDelta,
445
+ message: `Expected 'id' to be a string.`
446
+ });
447
+ }
448
+ if (((_d = toolCallDelta.function) == null ? void 0 : _d.name) == null) {
449
+ throw new chunkSIGXR3JT_cjs.InvalidResponseDataError({
450
+ data: toolCallDelta,
451
+ message: `Expected 'function.name' to be a string.`
452
+ });
453
+ }
454
+ toolCalls[index] = {
455
+ id: toolCallDelta.id,
456
+ type: "function",
457
+ function: {
458
+ name: toolCallDelta.function.name,
459
+ arguments: (_e = toolCallDelta.function.arguments) != null ? _e : ""
460
+ },
461
+ hasFinished: false
462
+ };
463
+ const toolCall2 = toolCalls[index];
464
+ if (((_f = toolCall2.function) == null ? void 0 : _f.name) != null && ((_g = toolCall2.function) == null ? void 0 : _g.arguments) != null) {
465
+ if (toolCall2.function.arguments.length > 0) {
466
+ controller.enqueue({
467
+ type: "tool-call-delta",
468
+ toolCallType: "function",
469
+ toolCallId: toolCall2.id,
470
+ toolName: toolCall2.function.name,
471
+ argsTextDelta: toolCall2.function.arguments
472
+ });
473
+ }
474
+ if (chunkSIGXR3JT_cjs.isParsableJson(toolCall2.function.arguments)) {
475
+ controller.enqueue({
476
+ type: "tool-call",
477
+ toolCallType: "function",
478
+ toolCallId: (_h = toolCall2.id) != null ? _h : chunkSIGXR3JT_cjs.generateId(),
479
+ toolName: toolCall2.function.name,
480
+ args: toolCall2.function.arguments
481
+ });
482
+ toolCall2.hasFinished = true;
483
+ }
484
+ }
485
+ continue;
486
+ }
487
+ const toolCall = toolCalls[index];
488
+ if (toolCall.hasFinished) {
489
+ continue;
490
+ }
491
+ if (((_i = toolCallDelta.function) == null ? void 0 : _i.arguments) != null) {
492
+ toolCall.function.arguments += (_k = (_j = toolCallDelta.function) == null ? void 0 : _j.arguments) != null ? _k : "";
493
+ }
494
+ controller.enqueue({
495
+ type: "tool-call-delta",
496
+ toolCallType: "function",
497
+ toolCallId: toolCall.id,
498
+ toolName: toolCall.function.name,
499
+ argsTextDelta: (_l = toolCallDelta.function.arguments) != null ? _l : ""
500
+ });
501
+ if (((_m = toolCall.function) == null ? void 0 : _m.name) != null && ((_n = toolCall.function) == null ? void 0 : _n.arguments) != null && chunkSIGXR3JT_cjs.isParsableJson(toolCall.function.arguments)) {
502
+ controller.enqueue({
503
+ type: "tool-call",
504
+ toolCallType: "function",
505
+ toolCallId: (_o = toolCall.id) != null ? _o : chunkSIGXR3JT_cjs.generateId(),
506
+ toolName: toolCall.function.name,
507
+ args: toolCall.function.arguments
508
+ });
509
+ toolCall.hasFinished = true;
510
+ }
511
+ }
512
+ }
513
+ },
514
+ flush(controller) {
515
+ var _a, _b;
516
+ controller.enqueue({
517
+ type: "finish",
518
+ finishReason,
519
+ usage: {
520
+ promptTokens: (_a = usage.promptTokens) != null ? _a : NaN,
521
+ completionTokens: (_b = usage.completionTokens) != null ? _b : NaN
522
+ },
523
+ ...{}
524
+ });
525
+ }
526
+ })
527
+ ),
528
+ rawCall: { rawPrompt, rawSettings },
529
+ rawResponse: { headers: responseHeaders },
530
+ warnings,
531
+ request: { body }
532
+ };
533
+ }
534
+ };
535
+ var groqChatResponseSchema = zod.z.object({
536
+ id: zod.z.string().nullish(),
537
+ created: zod.z.number().nullish(),
538
+ model: zod.z.string().nullish(),
539
+ choices: zod.z.array(
540
+ zod.z.object({
541
+ message: zod.z.object({
542
+ content: zod.z.string().nullish(),
543
+ reasoning: zod.z.string().nullish(),
544
+ tool_calls: zod.z.array(
545
+ zod.z.object({
546
+ id: zod.z.string().nullish(),
547
+ type: zod.z.literal("function"),
548
+ function: zod.z.object({
549
+ name: zod.z.string(),
550
+ arguments: zod.z.string()
551
+ })
552
+ })
553
+ ).nullish()
554
+ }),
555
+ index: zod.z.number(),
556
+ finish_reason: zod.z.string().nullish()
557
+ })
558
+ ),
559
+ usage: zod.z.object({
560
+ prompt_tokens: zod.z.number().nullish(),
561
+ completion_tokens: zod.z.number().nullish()
562
+ }).nullish()
563
+ });
564
+ var groqChatChunkSchema = zod.z.union([
565
+ zod.z.object({
566
+ id: zod.z.string().nullish(),
567
+ created: zod.z.number().nullish(),
568
+ model: zod.z.string().nullish(),
569
+ choices: zod.z.array(
570
+ zod.z.object({
571
+ delta: zod.z.object({
572
+ content: zod.z.string().nullish(),
573
+ reasoning: zod.z.string().nullish(),
574
+ tool_calls: zod.z.array(
575
+ zod.z.object({
576
+ index: zod.z.number(),
577
+ id: zod.z.string().nullish(),
578
+ type: zod.z.literal("function").optional(),
579
+ function: zod.z.object({
580
+ name: zod.z.string().nullish(),
581
+ arguments: zod.z.string().nullish()
582
+ })
583
+ })
584
+ ).nullish()
585
+ }).nullish(),
586
+ finish_reason: zod.z.string().nullable().optional(),
587
+ index: zod.z.number()
588
+ })
589
+ ),
590
+ x_groq: zod.z.object({
591
+ usage: zod.z.object({
592
+ prompt_tokens: zod.z.number().nullish(),
593
+ completion_tokens: zod.z.number().nullish()
594
+ }).nullish()
595
+ }).nullish()
596
+ }),
597
+ groqErrorDataSchema
598
+ ]);
599
+ var groqProviderOptionsSchema = zod.z.object({
600
+ language: zod.z.string().nullish(),
601
+ prompt: zod.z.string().nullish(),
602
+ responseFormat: zod.z.string().nullish(),
603
+ temperature: zod.z.number().min(0).max(1).nullish(),
604
+ timestampGranularities: zod.z.array(zod.z.string()).nullish()
605
+ });
606
+ var GroqTranscriptionModel = class {
607
+ constructor(modelId, config) {
608
+ this.modelId = modelId;
609
+ this.config = config;
610
+ this.specificationVersion = "v1";
611
+ }
612
+ get provider() {
613
+ return this.config.provider;
614
+ }
615
+ getArgs({
616
+ audio,
617
+ mediaType,
618
+ providerOptions
619
+ }) {
620
+ var _a, _b, _c, _d, _e;
621
+ const warnings = [];
622
+ const groqOptions = chunkSIGXR3JT_cjs.parseProviderOptions({
623
+ provider: "groq",
624
+ providerOptions,
625
+ schema: groqProviderOptionsSchema
626
+ });
627
+ const formData = new FormData();
628
+ const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([chunkSIGXR3JT_cjs.convertBase64ToUint8Array(audio)]);
629
+ formData.append("model", this.modelId);
630
+ formData.append("file", new File([blob], "audio", { type: mediaType }));
631
+ if (groqOptions) {
632
+ const transcriptionModelOptions = {
633
+ language: (_a = groqOptions.language) != null ? _a : void 0,
634
+ prompt: (_b = groqOptions.prompt) != null ? _b : void 0,
635
+ response_format: (_c = groqOptions.responseFormat) != null ? _c : void 0,
636
+ temperature: (_d = groqOptions.temperature) != null ? _d : void 0,
637
+ timestamp_granularities: (_e = groqOptions.timestampGranularities) != null ? _e : void 0
638
+ };
639
+ for (const key in transcriptionModelOptions) {
640
+ const value = transcriptionModelOptions[key];
641
+ if (value !== void 0) {
642
+ formData.append(key, String(value));
643
+ }
644
+ }
645
+ }
646
+ return {
647
+ formData,
648
+ warnings
649
+ };
650
+ }
651
+ async doGenerate(options) {
652
+ var _a, _b, _c, _d, _e;
653
+ const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
654
+ const { formData, warnings } = this.getArgs(options);
655
+ const {
656
+ value: response,
657
+ responseHeaders,
658
+ rawValue: rawResponse
659
+ } = await chunkSIGXR3JT_cjs.postFormDataToApi({
660
+ url: this.config.url({
661
+ path: "/audio/transcriptions",
662
+ modelId: this.modelId
663
+ }),
664
+ headers: chunkSIGXR3JT_cjs.combineHeaders(this.config.headers(), options.headers),
665
+ formData,
666
+ failedResponseHandler: groqFailedResponseHandler,
667
+ successfulResponseHandler: chunkSIGXR3JT_cjs.createJsonResponseHandler(
668
+ groqTranscriptionResponseSchema
669
+ ),
670
+ abortSignal: options.abortSignal,
671
+ fetch: this.config.fetch
672
+ });
673
+ return {
674
+ text: response.text,
675
+ segments: (_e = (_d = response.segments) == null ? void 0 : _d.map((segment) => ({
676
+ text: segment.text,
677
+ startSecond: segment.start,
678
+ endSecond: segment.end
679
+ }))) != null ? _e : [],
680
+ language: response.language,
681
+ durationInSeconds: response.duration,
682
+ warnings,
683
+ response: {
684
+ timestamp: currentDate,
685
+ modelId: this.modelId,
686
+ headers: responseHeaders,
687
+ body: rawResponse
688
+ }
689
+ };
690
+ }
691
+ };
692
+ var groqTranscriptionResponseSchema = zod.z.object({
693
+ task: zod.z.string(),
694
+ language: zod.z.string(),
695
+ duration: zod.z.number(),
696
+ text: zod.z.string(),
697
+ segments: zod.z.array(
698
+ zod.z.object({
699
+ id: zod.z.number(),
700
+ seek: zod.z.number(),
701
+ start: zod.z.number(),
702
+ end: zod.z.number(),
703
+ text: zod.z.string(),
704
+ tokens: zod.z.array(zod.z.number()),
705
+ temperature: zod.z.number(),
706
+ avg_logprob: zod.z.number(),
707
+ compression_ratio: zod.z.number(),
708
+ no_speech_prob: zod.z.number()
709
+ })
710
+ ),
711
+ x_groq: zod.z.object({
712
+ id: zod.z.string()
713
+ })
714
+ });
715
+ function createGroq(options = {}) {
716
+ var _a;
717
+ const baseURL = (_a = chunkSIGXR3JT_cjs.withoutTrailingSlash(options.baseURL)) != null ? _a : "https://api.groq.com/openai/v1";
718
+ const getHeaders = () => ({
719
+ Authorization: `Bearer ${chunkSIGXR3JT_cjs.loadApiKey({
720
+ apiKey: options.apiKey,
721
+ environmentVariableName: "GROQ_API_KEY",
722
+ description: "Groq"
723
+ })}`,
724
+ ...options.headers
725
+ });
726
+ const createChatModel = (modelId, settings = {}) => new GroqChatLanguageModel(modelId, settings, {
727
+ provider: "groq.chat",
728
+ url: ({ path }) => `${baseURL}${path}`,
729
+ headers: getHeaders,
730
+ fetch: options.fetch
731
+ });
732
+ const createLanguageModel = (modelId, settings) => {
733
+ if (new.target) {
734
+ throw new Error(
735
+ "The Groq model function cannot be called with the new keyword."
736
+ );
737
+ }
738
+ return createChatModel(modelId, settings);
739
+ };
740
+ const createTranscriptionModel = (modelId) => {
741
+ return new GroqTranscriptionModel(modelId, {
742
+ provider: "groq.transcription",
743
+ url: ({ path }) => `${baseURL}${path}`,
744
+ headers: getHeaders,
745
+ fetch: options.fetch
746
+ });
747
+ };
748
+ const provider = function(modelId, settings) {
749
+ return createLanguageModel(modelId, settings);
750
+ };
751
+ provider.languageModel = createLanguageModel;
752
+ provider.chat = createChatModel;
753
+ provider.textEmbeddingModel = (modelId) => {
754
+ throw new chunkSIGXR3JT_cjs.NoSuchModelError({ modelId, modelType: "textEmbeddingModel" });
755
+ };
756
+ provider.transcription = createTranscriptionModel;
757
+ return provider;
758
+ }
759
+ var groq = createGroq();
760
+
761
+ exports.createGroq = createGroq;
762
+ exports.groq = groq;
763
+ //# sourceMappingURL=chunk-HJQKWRKQ.cjs.map
764
+ //# sourceMappingURL=chunk-HJQKWRKQ.cjs.map