@ai-sdk/groq 4.0.0-beta.22 → 4.0.0-beta.23

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ai-sdk/groq
2
2
 
3
+ ## 4.0.0-beta.23
4
+
5
+ ### Major Changes
6
+
7
+ - ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [ef992f8]
12
+ - @ai-sdk/provider@4.0.0-beta.11
13
+ - @ai-sdk/provider-utils@5.0.0-beta.19
14
+
3
15
  ## 4.0.0-beta.22
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,40 +1,29 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- VERSION: () => VERSION,
24
- browserSearch: () => browserSearch,
25
- createGroq: () => createGroq,
26
- groq: () => groq
27
- });
28
- module.exports = __toCommonJS(index_exports);
29
-
30
1
  // src/groq-provider.ts
31
- var import_provider4 = require("@ai-sdk/provider");
32
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
2
+ import {
3
+ NoSuchModelError
4
+ } from "@ai-sdk/provider";
5
+ import {
6
+ loadApiKey,
7
+ withoutTrailingSlash,
8
+ withUserAgentSuffix
9
+ } from "@ai-sdk/provider-utils";
33
10
 
34
11
  // src/groq-chat-language-model.ts
35
- var import_provider3 = require("@ai-sdk/provider");
36
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
37
- var import_v43 = require("zod/v4");
12
+ import {
13
+ InvalidResponseDataError
14
+ } from "@ai-sdk/provider";
15
+ import {
16
+ combineHeaders,
17
+ createEventSourceResponseHandler,
18
+ createJsonResponseHandler,
19
+ generateId,
20
+ isCustomReasoning,
21
+ isParsableJson,
22
+ mapReasoningToProviderEffort,
23
+ parseProviderOptions,
24
+ postJsonToApi
25
+ } from "@ai-sdk/provider-utils";
26
+ import { z as z3 } from "zod/v4";
38
27
 
39
28
  // src/convert-groq-usage.ts
40
29
  function convertGroqUsage(usage) {
@@ -76,8 +65,10 @@ function convertGroqUsage(usage) {
76
65
  }
77
66
 
78
67
  // src/convert-to-groq-chat-messages.ts
79
- var import_provider = require("@ai-sdk/provider");
80
- var import_provider_utils = require("@ai-sdk/provider-utils");
68
+ import {
69
+ UnsupportedFunctionalityError
70
+ } from "@ai-sdk/provider";
71
+ import { convertToBase64, isProviderReference } from "@ai-sdk/provider-utils";
81
72
  function convertToGroqChatMessages(prompt) {
82
73
  var _a;
83
74
  const messages = [];
@@ -100,13 +91,13 @@ function convertToGroqChatMessages(prompt) {
100
91
  return { type: "text", text: part.text };
101
92
  }
102
93
  case "file": {
103
- if ((0, import_provider_utils.isProviderReference)(part.data)) {
104
- throw new import_provider.UnsupportedFunctionalityError({
94
+ if (isProviderReference(part.data)) {
95
+ throw new UnsupportedFunctionalityError({
105
96
  functionality: "file parts with provider references"
106
97
  });
107
98
  }
108
99
  if (!part.mediaType.startsWith("image/")) {
109
- throw new import_provider.UnsupportedFunctionalityError({
100
+ throw new UnsupportedFunctionalityError({
110
101
  functionality: "Non-image file content parts"
111
102
  });
112
103
  }
@@ -114,7 +105,7 @@ function convertToGroqChatMessages(prompt) {
114
105
  return {
115
106
  type: "image_url",
116
107
  image_url: {
117
- url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${(0, import_provider_utils.convertToBase64)(part.data)}`
108
+ url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${convertToBase64(part.data)}`
118
109
  }
119
110
  };
120
111
  }
@@ -212,29 +203,29 @@ function getResponseMetadata({
212
203
  }
213
204
 
214
205
  // src/groq-chat-options.ts
215
- var import_v4 = require("zod/v4");
216
- var groqLanguageModelOptions = import_v4.z.object({
217
- reasoningFormat: import_v4.z.enum(["parsed", "raw", "hidden"]).optional(),
206
+ import { z } from "zod/v4";
207
+ var groqLanguageModelOptions = z.object({
208
+ reasoningFormat: z.enum(["parsed", "raw", "hidden"]).optional(),
218
209
  /**
219
210
  * Specifies the reasoning effort level for model inference.
220
211
  * @see https://console.groq.com/docs/reasoning#reasoning-effort
221
212
  */
222
- reasoningEffort: import_v4.z.enum(["none", "default", "low", "medium", "high"]).optional(),
213
+ reasoningEffort: z.enum(["none", "default", "low", "medium", "high"]).optional(),
223
214
  /**
224
215
  * Whether to enable parallel function calling during tool use. Default to true.
225
216
  */
226
- parallelToolCalls: import_v4.z.boolean().optional(),
217
+ parallelToolCalls: z.boolean().optional(),
227
218
  /**
228
219
  * A unique identifier representing your end-user, which can help OpenAI to
229
220
  * monitor and detect abuse. Learn more.
230
221
  */
231
- user: import_v4.z.string().optional(),
222
+ user: z.string().optional(),
232
223
  /**
233
224
  * Whether to use structured outputs.
234
225
  *
235
226
  * @default true
236
227
  */
237
- structuredOutputs: import_v4.z.boolean().optional(),
228
+ structuredOutputs: z.boolean().optional(),
238
229
  /**
239
230
  * Whether to use strict JSON schema validation.
240
231
  * When true, the model uses constrained decoding to guarantee schema compliance.
@@ -242,7 +233,7 @@ var groqLanguageModelOptions = import_v4.z.object({
242
233
  *
243
234
  * @default true
244
235
  */
245
- strictJsonSchema: import_v4.z.boolean().optional(),
236
+ strictJsonSchema: z.boolean().optional(),
246
237
  /**
247
238
  * Service tier for the request.
248
239
  * - 'on_demand': Default tier with consistent performance and fairness
@@ -252,25 +243,27 @@ var groqLanguageModelOptions = import_v4.z.object({
252
243
  *
253
244
  * @default 'on_demand'
254
245
  */
255
- serviceTier: import_v4.z.enum(["on_demand", "performance", "flex", "auto"]).optional()
246
+ serviceTier: z.enum(["on_demand", "performance", "flex", "auto"]).optional()
256
247
  });
257
248
 
258
249
  // src/groq-error.ts
259
- var import_v42 = require("zod/v4");
260
- var import_provider_utils2 = require("@ai-sdk/provider-utils");
261
- var groqErrorDataSchema = import_v42.z.object({
262
- error: import_v42.z.object({
263
- message: import_v42.z.string(),
264
- type: import_v42.z.string()
250
+ import { z as z2 } from "zod/v4";
251
+ import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
252
+ var groqErrorDataSchema = z2.object({
253
+ error: z2.object({
254
+ message: z2.string(),
255
+ type: z2.string()
265
256
  })
266
257
  });
267
- var groqFailedResponseHandler = (0, import_provider_utils2.createJsonErrorResponseHandler)({
258
+ var groqFailedResponseHandler = createJsonErrorResponseHandler({
268
259
  errorSchema: groqErrorDataSchema,
269
260
  errorToMessage: (data) => data.error.message
270
261
  });
271
262
 
272
263
  // src/groq-prepare-tools.ts
273
- var import_provider2 = require("@ai-sdk/provider");
264
+ import {
265
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError2
266
+ } from "@ai-sdk/provider";
274
267
 
275
268
  // src/groq-browser-search-models.ts
276
269
  var BROWSER_SEARCH_SUPPORTED_MODELS = [
@@ -350,7 +343,7 @@ function prepareTools({
350
343
  };
351
344
  default: {
352
345
  const _exhaustiveCheck = type;
353
- throw new import_provider2.UnsupportedFunctionalityError({
346
+ throw new UnsupportedFunctionalityError2({
354
347
  functionality: `tool choice type: ${_exhaustiveCheck}`
355
348
  });
356
349
  }
@@ -405,7 +398,7 @@ var GroqChatLanguageModel = class {
405
398
  }) {
406
399
  var _a, _b, _c, _d;
407
400
  const warnings = [];
408
- const groqOptions = await (0, import_provider_utils3.parseProviderOptions)({
401
+ const groqOptions = await parseProviderOptions({
409
402
  provider: "groq",
410
403
  providerOptions,
411
404
  schema: groqLanguageModelOptions
@@ -454,7 +447,7 @@ var GroqChatLanguageModel = class {
454
447
  } : { type: "json_object" } : void 0,
455
448
  // provider options:
456
449
  reasoning_format: groqOptions == null ? void 0 : groqOptions.reasoningFormat,
457
- reasoning_effort: (_d = groqOptions == null ? void 0 : groqOptions.reasoningEffort) != null ? _d : (0, import_provider_utils3.isCustomReasoning)(reasoning) && reasoning !== "none" ? (0, import_provider_utils3.mapReasoningToProviderEffort)({
450
+ reasoning_effort: (_d = groqOptions == null ? void 0 : groqOptions.reasoningEffort) != null ? _d : isCustomReasoning(reasoning) && reasoning !== "none" ? mapReasoningToProviderEffort({
458
451
  reasoning,
459
452
  effortMap: {
460
453
  minimal: "low",
@@ -483,15 +476,15 @@ var GroqChatLanguageModel = class {
483
476
  responseHeaders,
484
477
  value: response,
485
478
  rawValue: rawResponse
486
- } = await (0, import_provider_utils3.postJsonToApi)({
479
+ } = await postJsonToApi({
487
480
  url: this.config.url({
488
481
  path: "/chat/completions",
489
482
  modelId: this.modelId
490
483
  }),
491
- headers: (0, import_provider_utils3.combineHeaders)(this.config.headers(), options.headers),
484
+ headers: combineHeaders(this.config.headers(), options.headers),
492
485
  body: args,
493
486
  failedResponseHandler: groqFailedResponseHandler,
494
- successfulResponseHandler: (0, import_provider_utils3.createJsonResponseHandler)(
487
+ successfulResponseHandler: createJsonResponseHandler(
495
488
  groqChatResponseSchema
496
489
  ),
497
490
  abortSignal: options.abortSignal,
@@ -514,7 +507,7 @@ var GroqChatLanguageModel = class {
514
507
  for (const toolCall of choice.message.tool_calls) {
515
508
  content.push({
516
509
  type: "tool-call",
517
- toolCallId: (_a = toolCall.id) != null ? _a : (0, import_provider_utils3.generateId)(),
510
+ toolCallId: (_a = toolCall.id) != null ? _a : generateId(),
518
511
  toolName: toolCall.function.name,
519
512
  input: toolCall.function.arguments
520
513
  });
@@ -539,15 +532,15 @@ var GroqChatLanguageModel = class {
539
532
  async doStream(options) {
540
533
  const { args, warnings } = await this.getArgs(options);
541
534
  const body = { ...args, stream: true };
542
- const { responseHeaders, value: response } = await (0, import_provider_utils3.postJsonToApi)({
535
+ const { responseHeaders, value: response } = await postJsonToApi({
543
536
  url: this.config.url({
544
537
  path: "/chat/completions",
545
538
  modelId: this.modelId
546
539
  }),
547
- headers: (0, import_provider_utils3.combineHeaders)(this.config.headers(), options.headers),
540
+ headers: combineHeaders(this.config.headers(), options.headers),
548
541
  body,
549
542
  failedResponseHandler: groqFailedResponseHandler,
550
- successfulResponseHandler: (0, import_provider_utils3.createEventSourceResponseHandler)(groqChatChunkSchema),
543
+ successfulResponseHandler: createEventSourceResponseHandler(groqChatChunkSchema),
551
544
  abortSignal: options.abortSignal,
552
545
  fetch: this.config.fetch
553
546
  });
@@ -654,19 +647,19 @@ var GroqChatLanguageModel = class {
654
647
  const index = toolCallDelta.index;
655
648
  if (toolCalls[index] == null) {
656
649
  if (toolCallDelta.type !== "function") {
657
- throw new import_provider3.InvalidResponseDataError({
650
+ throw new InvalidResponseDataError({
658
651
  data: toolCallDelta,
659
652
  message: `Expected 'function' type.`
660
653
  });
661
654
  }
662
655
  if (toolCallDelta.id == null) {
663
- throw new import_provider3.InvalidResponseDataError({
656
+ throw new InvalidResponseDataError({
664
657
  data: toolCallDelta,
665
658
  message: `Expected 'id' to be a string.`
666
659
  });
667
660
  }
668
661
  if (((_b = toolCallDelta.function) == null ? void 0 : _b.name) == null) {
669
- throw new import_provider3.InvalidResponseDataError({
662
+ throw new InvalidResponseDataError({
670
663
  data: toolCallDelta,
671
664
  message: `Expected 'function.name' to be a string.`
672
665
  });
@@ -694,14 +687,14 @@ var GroqChatLanguageModel = class {
694
687
  delta: toolCall2.function.arguments
695
688
  });
696
689
  }
697
- if ((0, import_provider_utils3.isParsableJson)(toolCall2.function.arguments)) {
690
+ if (isParsableJson(toolCall2.function.arguments)) {
698
691
  controller.enqueue({
699
692
  type: "tool-input-end",
700
693
  id: toolCall2.id
701
694
  });
702
695
  controller.enqueue({
703
696
  type: "tool-call",
704
- toolCallId: (_f = toolCall2.id) != null ? _f : (0, import_provider_utils3.generateId)(),
697
+ toolCallId: (_f = toolCall2.id) != null ? _f : generateId(),
705
698
  toolName: toolCall2.function.name,
706
699
  input: toolCall2.function.arguments
707
700
  });
@@ -722,14 +715,14 @@ var GroqChatLanguageModel = class {
722
715
  id: toolCall.id,
723
716
  delta: (_j = toolCallDelta.function.arguments) != null ? _j : ""
724
717
  });
725
- if (((_k = toolCall.function) == null ? void 0 : _k.name) != null && ((_l = toolCall.function) == null ? void 0 : _l.arguments) != null && (0, import_provider_utils3.isParsableJson)(toolCall.function.arguments)) {
718
+ if (((_k = toolCall.function) == null ? void 0 : _k.name) != null && ((_l = toolCall.function) == null ? void 0 : _l.arguments) != null && isParsableJson(toolCall.function.arguments)) {
726
719
  controller.enqueue({
727
720
  type: "tool-input-end",
728
721
  id: toolCall.id
729
722
  });
730
723
  controller.enqueue({
731
724
  type: "tool-call",
732
- toolCallId: (_m = toolCall.id) != null ? _m : (0, import_provider_utils3.generateId)(),
725
+ toolCallId: (_m = toolCall.id) != null ? _m : generateId(),
733
726
  toolName: toolCall.function.name,
734
727
  input: toolCall.function.arguments
735
728
  });
@@ -759,78 +752,78 @@ var GroqChatLanguageModel = class {
759
752
  };
760
753
  }
761
754
  };
762
- var groqChatResponseSchema = import_v43.z.object({
763
- id: import_v43.z.string().nullish(),
764
- created: import_v43.z.number().nullish(),
765
- model: import_v43.z.string().nullish(),
766
- choices: import_v43.z.array(
767
- import_v43.z.object({
768
- message: import_v43.z.object({
769
- content: import_v43.z.string().nullish(),
770
- reasoning: import_v43.z.string().nullish(),
771
- tool_calls: import_v43.z.array(
772
- import_v43.z.object({
773
- id: import_v43.z.string().nullish(),
774
- type: import_v43.z.literal("function"),
775
- function: import_v43.z.object({
776
- name: import_v43.z.string(),
777
- arguments: import_v43.z.string()
755
+ var groqChatResponseSchema = z3.object({
756
+ id: z3.string().nullish(),
757
+ created: z3.number().nullish(),
758
+ model: z3.string().nullish(),
759
+ choices: z3.array(
760
+ z3.object({
761
+ message: z3.object({
762
+ content: z3.string().nullish(),
763
+ reasoning: z3.string().nullish(),
764
+ tool_calls: z3.array(
765
+ z3.object({
766
+ id: z3.string().nullish(),
767
+ type: z3.literal("function"),
768
+ function: z3.object({
769
+ name: z3.string(),
770
+ arguments: z3.string()
778
771
  })
779
772
  })
780
773
  ).nullish()
781
774
  }),
782
- index: import_v43.z.number(),
783
- finish_reason: import_v43.z.string().nullish()
775
+ index: z3.number(),
776
+ finish_reason: z3.string().nullish()
784
777
  })
785
778
  ),
786
- usage: import_v43.z.object({
787
- prompt_tokens: import_v43.z.number().nullish(),
788
- completion_tokens: import_v43.z.number().nullish(),
789
- total_tokens: import_v43.z.number().nullish(),
790
- prompt_tokens_details: import_v43.z.object({
791
- cached_tokens: import_v43.z.number().nullish()
779
+ usage: z3.object({
780
+ prompt_tokens: z3.number().nullish(),
781
+ completion_tokens: z3.number().nullish(),
782
+ total_tokens: z3.number().nullish(),
783
+ prompt_tokens_details: z3.object({
784
+ cached_tokens: z3.number().nullish()
792
785
  }).nullish(),
793
- completion_tokens_details: import_v43.z.object({
794
- reasoning_tokens: import_v43.z.number().nullish()
786
+ completion_tokens_details: z3.object({
787
+ reasoning_tokens: z3.number().nullish()
795
788
  }).nullish()
796
789
  }).nullish()
797
790
  });
798
- var groqChatChunkSchema = import_v43.z.union([
799
- import_v43.z.object({
800
- id: import_v43.z.string().nullish(),
801
- created: import_v43.z.number().nullish(),
802
- model: import_v43.z.string().nullish(),
803
- choices: import_v43.z.array(
804
- import_v43.z.object({
805
- delta: import_v43.z.object({
806
- content: import_v43.z.string().nullish(),
807
- reasoning: import_v43.z.string().nullish(),
808
- tool_calls: import_v43.z.array(
809
- import_v43.z.object({
810
- index: import_v43.z.number(),
811
- id: import_v43.z.string().nullish(),
812
- type: import_v43.z.literal("function").optional(),
813
- function: import_v43.z.object({
814
- name: import_v43.z.string().nullish(),
815
- arguments: import_v43.z.string().nullish()
791
+ var groqChatChunkSchema = z3.union([
792
+ z3.object({
793
+ id: z3.string().nullish(),
794
+ created: z3.number().nullish(),
795
+ model: z3.string().nullish(),
796
+ choices: z3.array(
797
+ z3.object({
798
+ delta: z3.object({
799
+ content: z3.string().nullish(),
800
+ reasoning: z3.string().nullish(),
801
+ tool_calls: z3.array(
802
+ z3.object({
803
+ index: z3.number(),
804
+ id: z3.string().nullish(),
805
+ type: z3.literal("function").optional(),
806
+ function: z3.object({
807
+ name: z3.string().nullish(),
808
+ arguments: z3.string().nullish()
816
809
  })
817
810
  })
818
811
  ).nullish()
819
812
  }).nullish(),
820
- finish_reason: import_v43.z.string().nullable().optional(),
821
- index: import_v43.z.number()
813
+ finish_reason: z3.string().nullable().optional(),
814
+ index: z3.number()
822
815
  })
823
816
  ),
824
- x_groq: import_v43.z.object({
825
- usage: import_v43.z.object({
826
- prompt_tokens: import_v43.z.number().nullish(),
827
- completion_tokens: import_v43.z.number().nullish(),
828
- total_tokens: import_v43.z.number().nullish(),
829
- prompt_tokens_details: import_v43.z.object({
830
- cached_tokens: import_v43.z.number().nullish()
817
+ x_groq: z3.object({
818
+ usage: z3.object({
819
+ prompt_tokens: z3.number().nullish(),
820
+ completion_tokens: z3.number().nullish(),
821
+ total_tokens: z3.number().nullish(),
822
+ prompt_tokens_details: z3.object({
823
+ cached_tokens: z3.number().nullish()
831
824
  }).nullish(),
832
- completion_tokens_details: import_v43.z.object({
833
- reasoning_tokens: import_v43.z.number().nullish()
825
+ completion_tokens_details: z3.object({
826
+ reasoning_tokens: z3.number().nullish()
834
827
  }).nullish()
835
828
  }).nullish()
836
829
  }).nullish()
@@ -839,20 +832,27 @@ var groqChatChunkSchema = import_v43.z.union([
839
832
  ]);
840
833
 
841
834
  // src/groq-transcription-model.ts
842
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
843
- var import_v45 = require("zod/v4");
835
+ import {
836
+ combineHeaders as combineHeaders2,
837
+ convertBase64ToUint8Array,
838
+ createJsonResponseHandler as createJsonResponseHandler2,
839
+ mediaTypeToExtension,
840
+ parseProviderOptions as parseProviderOptions2,
841
+ postFormDataToApi
842
+ } from "@ai-sdk/provider-utils";
843
+ import { z as z5 } from "zod/v4";
844
844
 
845
845
  // src/groq-transcription-options.ts
846
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
847
- var import_v44 = require("zod/v4");
848
- var groqTranscriptionModelOptions = (0, import_provider_utils4.lazySchema)(
849
- () => (0, import_provider_utils4.zodSchema)(
850
- import_v44.z.object({
851
- language: import_v44.z.string().nullish(),
852
- prompt: import_v44.z.string().nullish(),
853
- responseFormat: import_v44.z.string().nullish(),
854
- temperature: import_v44.z.number().min(0).max(1).nullish(),
855
- timestampGranularities: import_v44.z.array(import_v44.z.string()).nullish()
846
+ import { lazySchema, zodSchema } from "@ai-sdk/provider-utils";
847
+ import { z as z4 } from "zod/v4";
848
+ var groqTranscriptionModelOptions = lazySchema(
849
+ () => zodSchema(
850
+ z4.object({
851
+ language: z4.string().nullish(),
852
+ prompt: z4.string().nullish(),
853
+ responseFormat: z4.string().nullish(),
854
+ temperature: z4.number().min(0).max(1).nullish(),
855
+ timestampGranularities: z4.array(z4.string()).nullish()
856
856
  })
857
857
  )
858
858
  );
@@ -874,15 +874,15 @@ var GroqTranscriptionModel = class {
874
874
  }) {
875
875
  var _a, _b, _c, _d, _e;
876
876
  const warnings = [];
877
- const groqOptions = await (0, import_provider_utils5.parseProviderOptions)({
877
+ const groqOptions = await parseProviderOptions2({
878
878
  provider: "groq",
879
879
  providerOptions,
880
880
  schema: groqTranscriptionModelOptions
881
881
  });
882
882
  const formData = new FormData();
883
- const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils5.convertBase64ToUint8Array)(audio)]);
883
+ const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([convertBase64ToUint8Array(audio)]);
884
884
  formData.append("model", this.modelId);
885
- const fileExtension = (0, import_provider_utils5.mediaTypeToExtension)(mediaType);
885
+ const fileExtension = mediaTypeToExtension(mediaType);
886
886
  formData.append(
887
887
  "file",
888
888
  new File([blob], "audio", { type: mediaType }),
@@ -922,15 +922,15 @@ var GroqTranscriptionModel = class {
922
922
  value: response,
923
923
  responseHeaders,
924
924
  rawValue: rawResponse
925
- } = await (0, import_provider_utils5.postFormDataToApi)({
925
+ } = await postFormDataToApi({
926
926
  url: this.config.url({
927
927
  path: "/audio/transcriptions",
928
928
  modelId: this.modelId
929
929
  }),
930
- headers: (0, import_provider_utils5.combineHeaders)(this.config.headers(), options.headers),
930
+ headers: combineHeaders2(this.config.headers(), options.headers),
931
931
  formData,
932
932
  failedResponseHandler: groqFailedResponseHandler,
933
- successfulResponseHandler: (0, import_provider_utils5.createJsonResponseHandler)(
933
+ successfulResponseHandler: createJsonResponseHandler2(
934
934
  groqTranscriptionResponseSchema
935
935
  ),
936
936
  abortSignal: options.abortSignal,
@@ -955,37 +955,37 @@ var GroqTranscriptionModel = class {
955
955
  };
956
956
  }
957
957
  };
958
- var groqTranscriptionResponseSchema = import_v45.z.object({
959
- text: import_v45.z.string(),
960
- x_groq: import_v45.z.object({
961
- id: import_v45.z.string()
958
+ var groqTranscriptionResponseSchema = z5.object({
959
+ text: z5.string(),
960
+ x_groq: z5.object({
961
+ id: z5.string()
962
962
  }),
963
963
  // additional properties are returned when `response_format: 'verbose_json'` is
964
- task: import_v45.z.string().nullish(),
965
- language: import_v45.z.string().nullish(),
966
- duration: import_v45.z.number().nullish(),
967
- segments: import_v45.z.array(
968
- import_v45.z.object({
969
- id: import_v45.z.number(),
970
- seek: import_v45.z.number(),
971
- start: import_v45.z.number(),
972
- end: import_v45.z.number(),
973
- text: import_v45.z.string(),
974
- tokens: import_v45.z.array(import_v45.z.number()),
975
- temperature: import_v45.z.number(),
976
- avg_logprob: import_v45.z.number(),
977
- compression_ratio: import_v45.z.number(),
978
- no_speech_prob: import_v45.z.number()
964
+ task: z5.string().nullish(),
965
+ language: z5.string().nullish(),
966
+ duration: z5.number().nullish(),
967
+ segments: z5.array(
968
+ z5.object({
969
+ id: z5.number(),
970
+ seek: z5.number(),
971
+ start: z5.number(),
972
+ end: z5.number(),
973
+ text: z5.string(),
974
+ tokens: z5.array(z5.number()),
975
+ temperature: z5.number(),
976
+ avg_logprob: z5.number(),
977
+ compression_ratio: z5.number(),
978
+ no_speech_prob: z5.number()
979
979
  })
980
980
  ).nullish()
981
981
  });
982
982
 
983
983
  // src/tool/browser-search.ts
984
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
985
- var import_v46 = require("zod/v4");
986
- var browserSearch = (0, import_provider_utils6.createProviderToolFactory)({
984
+ import { createProviderToolFactory } from "@ai-sdk/provider-utils";
985
+ import { z as z6 } from "zod/v4";
986
+ var browserSearch = createProviderToolFactory({
987
987
  id: "groq.browser_search",
988
- inputSchema: import_v46.z.object({})
988
+ inputSchema: z6.object({})
989
989
  });
990
990
 
991
991
  // src/groq-tools.ts
@@ -994,15 +994,15 @@ var groqTools = {
994
994
  };
995
995
 
996
996
  // src/version.ts
997
- var VERSION = true ? "4.0.0-beta.22" : "0.0.0-test";
997
+ var VERSION = true ? "4.0.0-beta.23" : "0.0.0-test";
998
998
 
999
999
  // src/groq-provider.ts
1000
1000
  function createGroq(options = {}) {
1001
1001
  var _a;
1002
- const baseURL = (_a = (0, import_provider_utils7.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.groq.com/openai/v1";
1003
- const getHeaders = () => (0, import_provider_utils7.withUserAgentSuffix)(
1002
+ const baseURL = (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : "https://api.groq.com/openai/v1";
1003
+ const getHeaders = () => withUserAgentSuffix(
1004
1004
  {
1005
- Authorization: `Bearer ${(0, import_provider_utils7.loadApiKey)({
1005
+ Authorization: `Bearer ${loadApiKey({
1006
1006
  apiKey: options.apiKey,
1007
1007
  environmentVariableName: "GROQ_API_KEY",
1008
1008
  description: "Groq"
@@ -1040,11 +1040,11 @@ function createGroq(options = {}) {
1040
1040
  provider.languageModel = createLanguageModel;
1041
1041
  provider.chat = createChatModel;
1042
1042
  provider.embeddingModel = (modelId) => {
1043
- throw new import_provider4.NoSuchModelError({ modelId, modelType: "embeddingModel" });
1043
+ throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
1044
1044
  };
1045
1045
  provider.textEmbeddingModel = provider.embeddingModel;
1046
1046
  provider.imageModel = (modelId) => {
1047
- throw new import_provider4.NoSuchModelError({ modelId, modelType: "imageModel" });
1047
+ throw new NoSuchModelError({ modelId, modelType: "imageModel" });
1048
1048
  };
1049
1049
  provider.transcription = createTranscriptionModel;
1050
1050
  provider.transcriptionModel = createTranscriptionModel;
@@ -1052,11 +1052,10 @@ function createGroq(options = {}) {
1052
1052
  return provider;
1053
1053
  }
1054
1054
  var groq = createGroq();
1055
- // Annotate the CommonJS export names for ESM import in node:
1056
- 0 && (module.exports = {
1055
+ export {
1057
1056
  VERSION,
1058
1057
  browserSearch,
1059
1058
  createGroq,
1060
1059
  groq
1061
- });
1060
+ };
1062
1061
  //# sourceMappingURL=index.js.map