@ai-sdk/groq 4.0.0-beta.3 → 4.0.0-beta.30
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 +221 -4
- package/README.md +2 -0
- package/dist/index.d.ts +8 -7
- package/dist/index.js +237 -282
- package/dist/index.js.map +1 -1
- package/docs/09-groq.mdx +3 -2
- package/package.json +7 -9
- package/src/convert-groq-usage.ts +2 -2
- package/src/convert-to-groq-chat-messages.ts +9 -3
- package/src/groq-chat-language-model.ts +76 -165
- package/src/groq-chat-options.ts +2 -1
- package/src/groq-config.ts +1 -1
- package/src/groq-prepare-tools.ts +6 -6
- package/src/groq-provider.ts +8 -8
- package/src/groq-transcription-model.ts +25 -8
- package/src/map-groq-finish-reason.ts +2 -2
- package/dist/index.d.mts +0 -112
- package/dist/index.mjs +0 -1049
- package/dist/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,222 @@
|
|
|
1
1
|
# @ai-sdk/groq
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.30
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [2e98477]
|
|
8
|
+
- @ai-sdk/provider-utils@5.0.0-beta.26
|
|
9
|
+
|
|
10
|
+
## 4.0.0-beta.29
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [eea8d98]
|
|
15
|
+
- @ai-sdk/provider-utils@5.0.0-beta.25
|
|
16
|
+
|
|
17
|
+
## 4.0.0-beta.28
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- f807e45: Extract shared `StreamingToolCallTracker` class into `@ai-sdk/provider-utils` to deduplicate streaming tool call handling across OpenAI-compatible providers. Also adds missing `generateId()` fallback for `toolCallId` in Alibaba's `doGenerate` path and ensures all providers finalize unfinished tool calls during stream flush.
|
|
22
|
+
- Updated dependencies [f807e45]
|
|
23
|
+
- @ai-sdk/provider-utils@5.0.0-beta.24
|
|
24
|
+
|
|
25
|
+
## 4.0.0-beta.27
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [350ea38]
|
|
30
|
+
- @ai-sdk/provider-utils@5.0.0-beta.23
|
|
31
|
+
|
|
32
|
+
## 4.0.0-beta.26
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [083947b]
|
|
37
|
+
- @ai-sdk/provider-utils@5.0.0-beta.22
|
|
38
|
+
|
|
39
|
+
## 4.0.0-beta.25
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [add1126]
|
|
44
|
+
- @ai-sdk/provider-utils@5.0.0-beta.21
|
|
45
|
+
|
|
46
|
+
## 4.0.0-beta.24
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- b3976a2: Add workflow serialization support to all provider models.
|
|
51
|
+
|
|
52
|
+
**`@ai-sdk/provider-utils`:** New `serializeModel()` helper that extracts only serializable properties from a model instance, filtering out functions and objects containing functions. Third-party provider authors can use this to add workflow support to their own models.
|
|
53
|
+
|
|
54
|
+
**All providers:** `headers` is now optional in provider config types. This is non-breaking — existing code that passes `headers` continues to work. Custom provider implementations that construct model configs manually can now omit `headers`, which is useful when models are deserialized from a workflow step boundary where auth is provided separately.
|
|
55
|
+
|
|
56
|
+
All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [b3976a2]
|
|
59
|
+
- Updated dependencies [ff5eba1]
|
|
60
|
+
- @ai-sdk/provider-utils@5.0.0-beta.20
|
|
61
|
+
- @ai-sdk/provider@4.0.0-beta.12
|
|
62
|
+
|
|
63
|
+
## 4.0.0-beta.23
|
|
64
|
+
|
|
65
|
+
### Major Changes
|
|
66
|
+
|
|
67
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- Updated dependencies [ef992f8]
|
|
72
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
73
|
+
- @ai-sdk/provider-utils@5.0.0-beta.19
|
|
74
|
+
|
|
75
|
+
## 4.0.0-beta.22
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
|
|
80
|
+
- Updated dependencies [90e2d8a]
|
|
81
|
+
- @ai-sdk/provider-utils@5.0.0-beta.18
|
|
82
|
+
|
|
83
|
+
## 4.0.0-beta.21
|
|
84
|
+
|
|
85
|
+
### Patch Changes
|
|
86
|
+
|
|
87
|
+
- Updated dependencies [3ae1786]
|
|
88
|
+
- @ai-sdk/provider-utils@5.0.0-beta.17
|
|
89
|
+
|
|
90
|
+
## 4.0.0-beta.20
|
|
91
|
+
|
|
92
|
+
### Patch Changes
|
|
93
|
+
|
|
94
|
+
- Updated dependencies [176466a]
|
|
95
|
+
- @ai-sdk/provider@4.0.0-beta.10
|
|
96
|
+
- @ai-sdk/provider-utils@5.0.0-beta.16
|
|
97
|
+
|
|
98
|
+
## 4.0.0-beta.19
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- Updated dependencies [e311194]
|
|
103
|
+
- @ai-sdk/provider@4.0.0-beta.9
|
|
104
|
+
- @ai-sdk/provider-utils@5.0.0-beta.15
|
|
105
|
+
|
|
106
|
+
## 4.0.0-beta.18
|
|
107
|
+
|
|
108
|
+
### Patch Changes
|
|
109
|
+
|
|
110
|
+
- Updated dependencies [34bd95d]
|
|
111
|
+
- Updated dependencies [008271d]
|
|
112
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
113
|
+
- @ai-sdk/provider-utils@5.0.0-beta.14
|
|
114
|
+
|
|
115
|
+
## 4.0.0-beta.17
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- Updated dependencies [b0c2869]
|
|
120
|
+
- Updated dependencies [7e26e81]
|
|
121
|
+
- @ai-sdk/provider-utils@5.0.0-beta.13
|
|
122
|
+
|
|
123
|
+
## 4.0.0-beta.16
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- Updated dependencies [46d1149]
|
|
128
|
+
- @ai-sdk/provider-utils@5.0.0-beta.12
|
|
129
|
+
|
|
130
|
+
## 4.0.0-beta.15
|
|
131
|
+
|
|
132
|
+
### Patch Changes
|
|
133
|
+
|
|
134
|
+
- 6fd51c0: fix(provider): preserve error type prefix in getErrorMessage
|
|
135
|
+
- Updated dependencies [6fd51c0]
|
|
136
|
+
- @ai-sdk/provider-utils@5.0.0-beta.11
|
|
137
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
138
|
+
|
|
139
|
+
## 4.0.0-beta.14
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
|
|
144
|
+
- Updated dependencies [c29a26f]
|
|
145
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
146
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
147
|
+
|
|
148
|
+
## 4.0.0-beta.13
|
|
149
|
+
|
|
150
|
+
### Patch Changes
|
|
151
|
+
|
|
152
|
+
- 38fc777: Add AI Gateway hint to provider READMEs
|
|
153
|
+
|
|
154
|
+
## 4.0.0-beta.12
|
|
155
|
+
|
|
156
|
+
### Patch Changes
|
|
157
|
+
|
|
158
|
+
- Updated dependencies [2e17091]
|
|
159
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
160
|
+
|
|
161
|
+
## 4.0.0-beta.11
|
|
162
|
+
|
|
163
|
+
### Patch Changes
|
|
164
|
+
|
|
165
|
+
- Updated dependencies [986c6fd]
|
|
166
|
+
- Updated dependencies [493295c]
|
|
167
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
168
|
+
|
|
169
|
+
## 4.0.0-beta.10
|
|
170
|
+
|
|
171
|
+
### Patch Changes
|
|
172
|
+
|
|
173
|
+
- 7bf717f: feat: Groq support for performance service tier
|
|
174
|
+
|
|
175
|
+
## 4.0.0-beta.9
|
|
176
|
+
|
|
177
|
+
### Patch Changes
|
|
178
|
+
|
|
179
|
+
- Updated dependencies [1f509d4]
|
|
180
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
181
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
182
|
+
|
|
183
|
+
## 4.0.0-beta.8
|
|
184
|
+
|
|
185
|
+
### Patch Changes
|
|
186
|
+
|
|
187
|
+
- 74d520f: feat: migrate providers to support new top-level `reasoning` parameter
|
|
188
|
+
|
|
189
|
+
## 4.0.0-beta.7
|
|
190
|
+
|
|
191
|
+
### Patch Changes
|
|
192
|
+
|
|
193
|
+
- Updated dependencies [3887c70]
|
|
194
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
195
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
196
|
+
|
|
197
|
+
## 4.0.0-beta.6
|
|
198
|
+
|
|
199
|
+
### Patch Changes
|
|
200
|
+
|
|
201
|
+
- Updated dependencies [776b617]
|
|
202
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
203
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
204
|
+
|
|
205
|
+
## 4.0.0-beta.5
|
|
206
|
+
|
|
207
|
+
### Patch Changes
|
|
208
|
+
|
|
209
|
+
- Updated dependencies [61753c3]
|
|
210
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
211
|
+
|
|
212
|
+
## 4.0.0-beta.4
|
|
213
|
+
|
|
214
|
+
### Patch Changes
|
|
215
|
+
|
|
216
|
+
- Updated dependencies [f7d4f01]
|
|
217
|
+
- @ai-sdk/provider-utils@5.0.0-beta.3
|
|
218
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
219
|
+
|
|
3
220
|
## 4.0.0-beta.3
|
|
4
221
|
|
|
5
222
|
### Patch Changes
|
|
@@ -260,13 +477,13 @@
|
|
|
260
477
|
Before
|
|
261
478
|
|
|
262
479
|
```ts
|
|
263
|
-
model.textEmbeddingModel(
|
|
480
|
+
model.textEmbeddingModel("my-model-id");
|
|
264
481
|
```
|
|
265
482
|
|
|
266
483
|
After
|
|
267
484
|
|
|
268
485
|
```ts
|
|
269
|
-
model.embeddingModel(
|
|
486
|
+
model.embeddingModel("my-model-id");
|
|
270
487
|
```
|
|
271
488
|
|
|
272
489
|
- 2625a04: feat(openai); update spec for mcp approval
|
|
@@ -487,13 +704,13 @@
|
|
|
487
704
|
Before
|
|
488
705
|
|
|
489
706
|
```ts
|
|
490
|
-
model.textEmbeddingModel(
|
|
707
|
+
model.textEmbeddingModel("my-model-id");
|
|
491
708
|
```
|
|
492
709
|
|
|
493
710
|
After
|
|
494
711
|
|
|
495
712
|
```ts
|
|
496
|
-
model.embeddingModel(
|
|
713
|
+
model.embeddingModel("my-model-id");
|
|
497
714
|
```
|
|
498
715
|
|
|
499
716
|
- 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.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
47
|
+
interface GroqProvider extends ProviderV4 {
|
|
47
48
|
/**
|
|
48
49
|
* Creates a model for text generation.
|
|
49
50
|
*/
|
|
50
|
-
(modelId: GroqChatModelId):
|
|
51
|
+
(modelId: GroqChatModelId): LanguageModelV4;
|
|
51
52
|
/**
|
|
52
53
|
* Creates an Groq chat model for text generation.
|
|
53
54
|
*/
|
|
54
|
-
languageModel(modelId: GroqChatModelId):
|
|
55
|
+
languageModel(modelId: GroqChatModelId): LanguageModelV4;
|
|
55
56
|
/**
|
|
56
57
|
* Creates a model for transcription.
|
|
57
58
|
*/
|
|
58
|
-
transcription(modelId: GroqTranscriptionModelId):
|
|
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
|
|