@ai-sdk/groq 4.0.0-beta.2 → 4.0.0-beta.21

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,150 @@
1
1
  # @ai-sdk/groq
2
2
 
3
+ ## 4.0.0-beta.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [3ae1786]
8
+ - @ai-sdk/provider-utils@5.0.0-beta.17
9
+
10
+ ## 4.0.0-beta.20
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [176466a]
15
+ - @ai-sdk/provider@4.0.0-beta.10
16
+ - @ai-sdk/provider-utils@5.0.0-beta.16
17
+
18
+ ## 4.0.0-beta.19
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [e311194]
23
+ - @ai-sdk/provider@4.0.0-beta.9
24
+ - @ai-sdk/provider-utils@5.0.0-beta.15
25
+
26
+ ## 4.0.0-beta.18
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [34bd95d]
31
+ - Updated dependencies [008271d]
32
+ - @ai-sdk/provider@4.0.0-beta.8
33
+ - @ai-sdk/provider-utils@5.0.0-beta.14
34
+
35
+ ## 4.0.0-beta.17
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [b0c2869]
40
+ - Updated dependencies [7e26e81]
41
+ - @ai-sdk/provider-utils@5.0.0-beta.13
42
+
43
+ ## 4.0.0-beta.16
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies [46d1149]
48
+ - @ai-sdk/provider-utils@5.0.0-beta.12
49
+
50
+ ## 4.0.0-beta.15
51
+
52
+ ### Patch Changes
53
+
54
+ - 6fd51c0: fix(provider): preserve error type prefix in getErrorMessage
55
+ - Updated dependencies [6fd51c0]
56
+ - @ai-sdk/provider-utils@5.0.0-beta.11
57
+ - @ai-sdk/provider@4.0.0-beta.7
58
+
59
+ ## 4.0.0-beta.14
60
+
61
+ ### Patch Changes
62
+
63
+ - c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
64
+ - Updated dependencies [c29a26f]
65
+ - @ai-sdk/provider-utils@5.0.0-beta.10
66
+ - @ai-sdk/provider@4.0.0-beta.6
67
+
68
+ ## 4.0.0-beta.13
69
+
70
+ ### Patch Changes
71
+
72
+ - 38fc777: Add AI Gateway hint to provider READMEs
73
+
74
+ ## 4.0.0-beta.12
75
+
76
+ ### Patch Changes
77
+
78
+ - Updated dependencies [2e17091]
79
+ - @ai-sdk/provider-utils@5.0.0-beta.9
80
+
81
+ ## 4.0.0-beta.11
82
+
83
+ ### Patch Changes
84
+
85
+ - Updated dependencies [986c6fd]
86
+ - Updated dependencies [493295c]
87
+ - @ai-sdk/provider-utils@5.0.0-beta.8
88
+
89
+ ## 4.0.0-beta.10
90
+
91
+ ### Patch Changes
92
+
93
+ - 7bf717f: feat: Groq support for performance service tier
94
+
95
+ ## 4.0.0-beta.9
96
+
97
+ ### Patch Changes
98
+
99
+ - Updated dependencies [1f509d4]
100
+ - @ai-sdk/provider-utils@5.0.0-beta.7
101
+ - @ai-sdk/provider@4.0.0-beta.5
102
+
103
+ ## 4.0.0-beta.8
104
+
105
+ ### Patch Changes
106
+
107
+ - 74d520f: feat: migrate providers to support new top-level `reasoning` parameter
108
+
109
+ ## 4.0.0-beta.7
110
+
111
+ ### Patch Changes
112
+
113
+ - Updated dependencies [3887c70]
114
+ - @ai-sdk/provider-utils@5.0.0-beta.6
115
+ - @ai-sdk/provider@4.0.0-beta.4
116
+
117
+ ## 4.0.0-beta.6
118
+
119
+ ### Patch Changes
120
+
121
+ - Updated dependencies [776b617]
122
+ - @ai-sdk/provider-utils@5.0.0-beta.5
123
+ - @ai-sdk/provider@4.0.0-beta.3
124
+
125
+ ## 4.0.0-beta.5
126
+
127
+ ### Patch Changes
128
+
129
+ - Updated dependencies [61753c3]
130
+ - @ai-sdk/provider-utils@5.0.0-beta.4
131
+
132
+ ## 4.0.0-beta.4
133
+
134
+ ### Patch Changes
135
+
136
+ - Updated dependencies [f7d4f01]
137
+ - @ai-sdk/provider-utils@5.0.0-beta.3
138
+ - @ai-sdk/provider@4.0.0-beta.2
139
+
140
+ ## 4.0.0-beta.3
141
+
142
+ ### Patch Changes
143
+
144
+ - Updated dependencies [5c2a5a2]
145
+ - @ai-sdk/provider@4.0.0-beta.1
146
+ - @ai-sdk/provider-utils@5.0.0-beta.2
147
+
3
148
  ## 4.0.0-beta.2
4
149
 
5
150
  ### Patch Changes
@@ -252,13 +397,13 @@
252
397
  Before
253
398
 
254
399
  ```ts
255
- model.textEmbeddingModel('my-model-id');
400
+ model.textEmbeddingModel("my-model-id");
256
401
  ```
257
402
 
258
403
  After
259
404
 
260
405
  ```ts
261
- model.embeddingModel('my-model-id');
406
+ model.embeddingModel("my-model-id");
262
407
  ```
263
408
 
264
409
  - 2625a04: feat(openai); update spec for mcp approval
@@ -479,13 +624,13 @@
479
624
  Before
480
625
 
481
626
  ```ts
482
- model.textEmbeddingModel('my-model-id');
627
+ model.textEmbeddingModel("my-model-id");
483
628
  ```
484
629
 
485
630
  After
486
631
 
487
632
  ```ts
488
- model.embeddingModel('my-model-id');
633
+ model.embeddingModel("my-model-id");
489
634
  ```
490
635
 
491
636
  - Updated dependencies [8d9e8ad]
package/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  The **[Groq provider](https://ai-sdk.dev/providers/ai-sdk-providers/groq)** for the [AI SDK](https://ai-sdk.dev/docs)
4
4
  contains language model support for the Groq chat and completion APIs, transcription support, and browser search tool.
5
5
 
6
+ > **Deploying to Vercel?** With Vercel's AI Gateway you can access Groq (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
7
+
6
8
  ## Setup
7
9
 
8
10
  The Groq provider is available in the `@ai-sdk/groq` module. You can install it with
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { ProviderV3, LanguageModelV3, TranscriptionModelV3 } from '@ai-sdk/provider';
1
+ import { ProviderV4, LanguageModelV4, TranscriptionModelV4 } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
4
4
  import { z } from 'zod/v4';
@@ -23,6 +23,7 @@ declare const groqLanguageModelOptions: z.ZodObject<{
23
23
  strictJsonSchema: z.ZodOptional<z.ZodBoolean>;
24
24
  serviceTier: z.ZodOptional<z.ZodEnum<{
25
25
  on_demand: "on_demand";
26
+ performance: "performance";
26
27
  flex: "flex";
27
28
  auto: "auto";
28
29
  }>>;
@@ -40,22 +41,22 @@ declare const groqTranscriptionModelOptions: _ai_sdk_provider_utils.LazySchema<{
40
41
  type GroqTranscriptionModelOptions = InferSchema<typeof groqTranscriptionModelOptions>;
41
42
 
42
43
  declare const groqTools: {
43
- browserSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
44
+ browserSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
44
45
  };
45
46
 
46
- interface GroqProvider extends ProviderV3 {
47
+ interface GroqProvider extends ProviderV4 {
47
48
  /**
48
49
  * Creates a model for text generation.
49
50
  */
50
- (modelId: GroqChatModelId): LanguageModelV3;
51
+ (modelId: GroqChatModelId): LanguageModelV4;
51
52
  /**
52
53
  * Creates an Groq chat model for text generation.
53
54
  */
54
- languageModel(modelId: GroqChatModelId): LanguageModelV3;
55
+ languageModel(modelId: GroqChatModelId): LanguageModelV4;
55
56
  /**
56
57
  * Creates a model for transcription.
57
58
  */
58
- transcription(modelId: GroqTranscriptionModelId): TranscriptionModelV3;
59
+ transcription(modelId: GroqTranscriptionModelId): TranscriptionModelV4;
59
60
  /**
60
61
  * Tools provided by Groq.
61
62
  */
@@ -105,7 +106,7 @@ declare const groq: GroqProvider;
105
106
  *
106
107
  * @see https://console.groq.com/docs/browser-search
107
108
  */
108
- declare const browserSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
109
+ declare const browserSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
109
110
 
110
111
  declare const VERSION: string;
111
112
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ProviderV3, LanguageModelV3, TranscriptionModelV3 } from '@ai-sdk/provider';
1
+ import { ProviderV4, LanguageModelV4, TranscriptionModelV4 } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
4
4
  import { z } from 'zod/v4';
@@ -23,6 +23,7 @@ declare const groqLanguageModelOptions: z.ZodObject<{
23
23
  strictJsonSchema: z.ZodOptional<z.ZodBoolean>;
24
24
  serviceTier: z.ZodOptional<z.ZodEnum<{
25
25
  on_demand: "on_demand";
26
+ performance: "performance";
26
27
  flex: "flex";
27
28
  auto: "auto";
28
29
  }>>;
@@ -40,22 +41,22 @@ declare const groqTranscriptionModelOptions: _ai_sdk_provider_utils.LazySchema<{
40
41
  type GroqTranscriptionModelOptions = InferSchema<typeof groqTranscriptionModelOptions>;
41
42
 
42
43
  declare const groqTools: {
43
- browserSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
44
+ browserSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
44
45
  };
45
46
 
46
- interface GroqProvider extends ProviderV3 {
47
+ interface GroqProvider extends ProviderV4 {
47
48
  /**
48
49
  * Creates a model for text generation.
49
50
  */
50
- (modelId: GroqChatModelId): LanguageModelV3;
51
+ (modelId: GroqChatModelId): LanguageModelV4;
51
52
  /**
52
53
  * Creates an Groq chat model for text generation.
53
54
  */
54
- languageModel(modelId: GroqChatModelId): LanguageModelV3;
55
+ languageModel(modelId: GroqChatModelId): LanguageModelV4;
55
56
  /**
56
57
  * Creates a model for transcription.
57
58
  */
58
- transcription(modelId: GroqTranscriptionModelId): TranscriptionModelV3;
59
+ transcription(modelId: GroqTranscriptionModelId): TranscriptionModelV4;
59
60
  /**
60
61
  * Tools provided by Groq.
61
62
  */
@@ -105,7 +106,7 @@ declare const groq: GroqProvider;
105
106
  *
106
107
  * @see https://console.groq.com/docs/browser-search
107
108
  */
108
- declare const browserSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
109
+ declare const browserSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
109
110
 
110
111
  declare const VERSION: string;
111
112
 
package/dist/index.js CHANGED
@@ -18,14 +18,14 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  VERSION: () => VERSION,
24
24
  browserSearch: () => browserSearch,
25
25
  createGroq: () => createGroq,
26
26
  groq: () => groq
27
27
  });
28
- module.exports = __toCommonJS(src_exports);
28
+ module.exports = __toCommonJS(index_exports);
29
29
 
30
30
  // src/groq-provider.ts
31
31
  var import_provider4 = require("@ai-sdk/provider");
@@ -100,6 +100,11 @@ function convertToGroqChatMessages(prompt) {
100
100
  return { type: "text", text: part.text };
101
101
  }
102
102
  case "file": {
103
+ if ((0, import_provider_utils.isProviderReference)(part.data)) {
104
+ throw new import_provider.UnsupportedFunctionalityError({
105
+ functionality: "file parts with provider references"
106
+ });
107
+ }
103
108
  if (!part.mediaType.startsWith("image/")) {
104
109
  throw new import_provider.UnsupportedFunctionalityError({
105
110
  functionality: "Non-image file content parts"
@@ -241,12 +246,13 @@ var groqLanguageModelOptions = import_v4.z.object({
241
246
  /**
242
247
  * Service tier for the request.
243
248
  * - 'on_demand': Default tier with consistent performance and fairness
249
+ * - 'performance': Prioritized tier for latency-sensitive workloads
244
250
  * - 'flex': Higher throughput tier optimized for workloads that can handle occasional request failures
245
251
  * - 'auto': Uses on_demand rate limits, then falls back to flex tier if exceeded
246
252
  *
247
253
  * @default 'on_demand'
248
254
  */
249
- serviceTier: import_v4.z.enum(["on_demand", "flex", "auto"]).optional()
255
+ serviceTier: import_v4.z.enum(["on_demand", "performance", "flex", "auto"]).optional()
250
256
  });
251
257
 
252
258
  // src/groq-error.ts
@@ -371,7 +377,7 @@ function mapGroqFinishReason(finishReason) {
371
377
  // src/groq-chat-language-model.ts
372
378
  var GroqChatLanguageModel = class {
373
379
  constructor(modelId, config) {
374
- this.specificationVersion = "v3";
380
+ this.specificationVersion = "v4";
375
381
  this.supportedUrls = {
376
382
  "image/*": [/^https?:\/\/.*$/]
377
383
  };
@@ -392,12 +398,13 @@ var GroqChatLanguageModel = class {
392
398
  stopSequences,
393
399
  responseFormat,
394
400
  seed,
401
+ reasoning,
395
402
  stream,
396
403
  tools,
397
404
  toolChoice,
398
405
  providerOptions
399
406
  }) {
400
- var _a, _b, _c;
407
+ var _a, _b, _c, _d;
401
408
  const warnings = [];
402
409
  const groqOptions = await (0, import_provider_utils3.parseProviderOptions)({
403
410
  provider: "groq",
@@ -448,7 +455,17 @@ var GroqChatLanguageModel = class {
448
455
  } : { type: "json_object" } : void 0,
449
456
  // provider options:
450
457
  reasoning_format: groqOptions == null ? void 0 : groqOptions.reasoningFormat,
451
- reasoning_effort: groqOptions == null ? void 0 : groqOptions.reasoningEffort,
458
+ reasoning_effort: (_d = groqOptions == null ? void 0 : groqOptions.reasoningEffort) != null ? _d : (0, import_provider_utils3.isCustomReasoning)(reasoning) && reasoning !== "none" ? (0, import_provider_utils3.mapReasoningToProviderEffort)({
459
+ reasoning,
460
+ effortMap: {
461
+ minimal: "low",
462
+ low: "low",
463
+ medium: "medium",
464
+ high: "high",
465
+ xhigh: "high"
466
+ },
467
+ warnings
468
+ }) : void 0,
452
469
  service_tier: groqOptions == null ? void 0 : groqOptions.serviceTier,
453
470
  // messages:
454
471
  messages: convertToGroqChatMessages(prompt),
@@ -852,7 +869,7 @@ var GroqTranscriptionModel = class {
852
869
  constructor(modelId, config) {
853
870
  this.modelId = modelId;
854
871
  this.config = config;
855
- this.specificationVersion = "v3";
872
+ this.specificationVersion = "v4";
856
873
  }
857
874
  get provider() {
858
875
  return this.config.provider;
@@ -984,7 +1001,7 @@ var groqTools = {
984
1001
  };
985
1002
 
986
1003
  // src/version.ts
987
- var VERSION = true ? "4.0.0-beta.2" : "0.0.0-test";
1004
+ var VERSION = true ? "4.0.0-beta.21" : "0.0.0-test";
988
1005
 
989
1006
  // src/groq-provider.ts
990
1007
  function createGroq(options = {}) {
@@ -1026,7 +1043,7 @@ function createGroq(options = {}) {
1026
1043
  const provider = function(modelId) {
1027
1044
  return createLanguageModel(modelId);
1028
1045
  };
1029
- provider.specificationVersion = "v3";
1046
+ provider.specificationVersion = "v4";
1030
1047
  provider.languageModel = createLanguageModel;
1031
1048
  provider.chat = createChatModel;
1032
1049
  provider.embeddingModel = (modelId) => {