@mastra/server 0.0.0-inject-middleware-20250528222017 → 0.0.0-interpolate-reporter-url-20250910180021

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