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

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,143 @@
1
1
  # @ai-sdk/groq
2
2
 
3
+ ## 4.0.0-beta.20
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [176466a]
8
+ - @ai-sdk/provider@4.0.0-beta.10
9
+ - @ai-sdk/provider-utils@5.0.0-beta.16
10
+
11
+ ## 4.0.0-beta.19
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [e311194]
16
+ - @ai-sdk/provider@4.0.0-beta.9
17
+ - @ai-sdk/provider-utils@5.0.0-beta.15
18
+
19
+ ## 4.0.0-beta.18
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [34bd95d]
24
+ - Updated dependencies [008271d]
25
+ - @ai-sdk/provider@4.0.0-beta.8
26
+ - @ai-sdk/provider-utils@5.0.0-beta.14
27
+
28
+ ## 4.0.0-beta.17
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [b0c2869]
33
+ - Updated dependencies [7e26e81]
34
+ - @ai-sdk/provider-utils@5.0.0-beta.13
35
+
36
+ ## 4.0.0-beta.16
37
+
38
+ ### Patch Changes
39
+
40
+ - Updated dependencies [46d1149]
41
+ - @ai-sdk/provider-utils@5.0.0-beta.12
42
+
43
+ ## 4.0.0-beta.15
44
+
45
+ ### Patch Changes
46
+
47
+ - 6fd51c0: fix(provider): preserve error type prefix in getErrorMessage
48
+ - Updated dependencies [6fd51c0]
49
+ - @ai-sdk/provider-utils@5.0.0-beta.11
50
+ - @ai-sdk/provider@4.0.0-beta.7
51
+
52
+ ## 4.0.0-beta.14
53
+
54
+ ### Patch Changes
55
+
56
+ - c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
57
+ - Updated dependencies [c29a26f]
58
+ - @ai-sdk/provider-utils@5.0.0-beta.10
59
+ - @ai-sdk/provider@4.0.0-beta.6
60
+
61
+ ## 4.0.0-beta.13
62
+
63
+ ### Patch Changes
64
+
65
+ - 38fc777: Add AI Gateway hint to provider READMEs
66
+
67
+ ## 4.0.0-beta.12
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies [2e17091]
72
+ - @ai-sdk/provider-utils@5.0.0-beta.9
73
+
74
+ ## 4.0.0-beta.11
75
+
76
+ ### Patch Changes
77
+
78
+ - Updated dependencies [986c6fd]
79
+ - Updated dependencies [493295c]
80
+ - @ai-sdk/provider-utils@5.0.0-beta.8
81
+
82
+ ## 4.0.0-beta.10
83
+
84
+ ### Patch Changes
85
+
86
+ - 7bf717f: feat: Groq support for performance service tier
87
+
88
+ ## 4.0.0-beta.9
89
+
90
+ ### Patch Changes
91
+
92
+ - Updated dependencies [1f509d4]
93
+ - @ai-sdk/provider-utils@5.0.0-beta.7
94
+ - @ai-sdk/provider@4.0.0-beta.5
95
+
96
+ ## 4.0.0-beta.8
97
+
98
+ ### Patch Changes
99
+
100
+ - 74d520f: feat: migrate providers to support new top-level `reasoning` parameter
101
+
102
+ ## 4.0.0-beta.7
103
+
104
+ ### Patch Changes
105
+
106
+ - Updated dependencies [3887c70]
107
+ - @ai-sdk/provider-utils@5.0.0-beta.6
108
+ - @ai-sdk/provider@4.0.0-beta.4
109
+
110
+ ## 4.0.0-beta.6
111
+
112
+ ### Patch Changes
113
+
114
+ - Updated dependencies [776b617]
115
+ - @ai-sdk/provider-utils@5.0.0-beta.5
116
+ - @ai-sdk/provider@4.0.0-beta.3
117
+
118
+ ## 4.0.0-beta.5
119
+
120
+ ### Patch Changes
121
+
122
+ - Updated dependencies [61753c3]
123
+ - @ai-sdk/provider-utils@5.0.0-beta.4
124
+
125
+ ## 4.0.0-beta.4
126
+
127
+ ### Patch Changes
128
+
129
+ - Updated dependencies [f7d4f01]
130
+ - @ai-sdk/provider-utils@5.0.0-beta.3
131
+ - @ai-sdk/provider@4.0.0-beta.2
132
+
133
+ ## 4.0.0-beta.3
134
+
135
+ ### Patch Changes
136
+
137
+ - Updated dependencies [5c2a5a2]
138
+ - @ai-sdk/provider@4.0.0-beta.1
139
+ - @ai-sdk/provider-utils@5.0.0-beta.2
140
+
3
141
  ## 4.0.0-beta.2
4
142
 
5
143
  ### Patch Changes
@@ -252,13 +390,13 @@
252
390
  Before
253
391
 
254
392
  ```ts
255
- model.textEmbeddingModel('my-model-id');
393
+ model.textEmbeddingModel("my-model-id");
256
394
  ```
257
395
 
258
396
  After
259
397
 
260
398
  ```ts
261
- model.embeddingModel('my-model-id');
399
+ model.embeddingModel("my-model-id");
262
400
  ```
263
401
 
264
402
  - 2625a04: feat(openai); update spec for mcp approval
@@ -479,13 +617,13 @@
479
617
  Before
480
618
 
481
619
  ```ts
482
- model.textEmbeddingModel('my-model-id');
620
+ model.textEmbeddingModel("my-model-id");
483
621
  ```
484
622
 
485
623
  After
486
624
 
487
625
  ```ts
488
- model.embeddingModel('my-model-id');
626
+ model.embeddingModel("my-model-id");
489
627
  ```
490
628
 
491
629
  - 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.20" : "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) => {