@mastra/server 0.0.0-fix-message-list-args-missing-20250807205055 → 0.0.0-fix-bundle-cleanup-20250911062914

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