@ai-sdk/groq 4.0.0-beta.3 → 4.0.0-beta.31
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 +234 -4
- package/README.md +2 -0
- package/dist/index.d.ts +8 -7
- package/dist/index.js +241 -283
- package/dist/index.js.map +1 -1
- package/docs/09-groq.mdx +3 -2
- package/package.json +9 -10
- package/src/convert-groq-usage.ts +2 -2
- package/src/convert-to-groq-chat-messages.ts +10 -4
- package/src/groq-chat-language-model.ts +74 -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/src/tool/browser-search.ts +11 -3
- 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,235 @@
|
|
|
1
1
|
# @ai-sdk/groq
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.31
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 58a2ad7: fix: more precise default message for tool execution denial
|
|
8
|
+
- Updated dependencies [785fe16]
|
|
9
|
+
- Updated dependencies [67df0a0]
|
|
10
|
+
- Updated dependencies [befb78c]
|
|
11
|
+
- Updated dependencies [0458559]
|
|
12
|
+
- Updated dependencies [5852c0a]
|
|
13
|
+
- Updated dependencies [fc92055]
|
|
14
|
+
- @ai-sdk/provider-utils@5.0.0-beta.27
|
|
15
|
+
|
|
16
|
+
## 4.0.0-beta.30
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [2e98477]
|
|
21
|
+
- @ai-sdk/provider-utils@5.0.0-beta.26
|
|
22
|
+
|
|
23
|
+
## 4.0.0-beta.29
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [eea8d98]
|
|
28
|
+
- @ai-sdk/provider-utils@5.0.0-beta.25
|
|
29
|
+
|
|
30
|
+
## 4.0.0-beta.28
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- 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.
|
|
35
|
+
- Updated dependencies [f807e45]
|
|
36
|
+
- @ai-sdk/provider-utils@5.0.0-beta.24
|
|
37
|
+
|
|
38
|
+
## 4.0.0-beta.27
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [350ea38]
|
|
43
|
+
- @ai-sdk/provider-utils@5.0.0-beta.23
|
|
44
|
+
|
|
45
|
+
## 4.0.0-beta.26
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [083947b]
|
|
50
|
+
- @ai-sdk/provider-utils@5.0.0-beta.22
|
|
51
|
+
|
|
52
|
+
## 4.0.0-beta.25
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- Updated dependencies [add1126]
|
|
57
|
+
- @ai-sdk/provider-utils@5.0.0-beta.21
|
|
58
|
+
|
|
59
|
+
## 4.0.0-beta.24
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- b3976a2: Add workflow serialization support to all provider models.
|
|
64
|
+
|
|
65
|
+
**`@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.
|
|
66
|
+
|
|
67
|
+
**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.
|
|
68
|
+
|
|
69
|
+
All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
|
|
70
|
+
|
|
71
|
+
- Updated dependencies [b3976a2]
|
|
72
|
+
- Updated dependencies [ff5eba1]
|
|
73
|
+
- @ai-sdk/provider-utils@5.0.0-beta.20
|
|
74
|
+
- @ai-sdk/provider@4.0.0-beta.12
|
|
75
|
+
|
|
76
|
+
## 4.0.0-beta.23
|
|
77
|
+
|
|
78
|
+
### Major Changes
|
|
79
|
+
|
|
80
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [ef992f8]
|
|
85
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
86
|
+
- @ai-sdk/provider-utils@5.0.0-beta.19
|
|
87
|
+
|
|
88
|
+
## 4.0.0-beta.22
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
|
|
93
|
+
- Updated dependencies [90e2d8a]
|
|
94
|
+
- @ai-sdk/provider-utils@5.0.0-beta.18
|
|
95
|
+
|
|
96
|
+
## 4.0.0-beta.21
|
|
97
|
+
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- Updated dependencies [3ae1786]
|
|
101
|
+
- @ai-sdk/provider-utils@5.0.0-beta.17
|
|
102
|
+
|
|
103
|
+
## 4.0.0-beta.20
|
|
104
|
+
|
|
105
|
+
### Patch Changes
|
|
106
|
+
|
|
107
|
+
- Updated dependencies [176466a]
|
|
108
|
+
- @ai-sdk/provider@4.0.0-beta.10
|
|
109
|
+
- @ai-sdk/provider-utils@5.0.0-beta.16
|
|
110
|
+
|
|
111
|
+
## 4.0.0-beta.19
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- Updated dependencies [e311194]
|
|
116
|
+
- @ai-sdk/provider@4.0.0-beta.9
|
|
117
|
+
- @ai-sdk/provider-utils@5.0.0-beta.15
|
|
118
|
+
|
|
119
|
+
## 4.0.0-beta.18
|
|
120
|
+
|
|
121
|
+
### Patch Changes
|
|
122
|
+
|
|
123
|
+
- Updated dependencies [34bd95d]
|
|
124
|
+
- Updated dependencies [008271d]
|
|
125
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
126
|
+
- @ai-sdk/provider-utils@5.0.0-beta.14
|
|
127
|
+
|
|
128
|
+
## 4.0.0-beta.17
|
|
129
|
+
|
|
130
|
+
### Patch Changes
|
|
131
|
+
|
|
132
|
+
- Updated dependencies [b0c2869]
|
|
133
|
+
- Updated dependencies [7e26e81]
|
|
134
|
+
- @ai-sdk/provider-utils@5.0.0-beta.13
|
|
135
|
+
|
|
136
|
+
## 4.0.0-beta.16
|
|
137
|
+
|
|
138
|
+
### Patch Changes
|
|
139
|
+
|
|
140
|
+
- Updated dependencies [46d1149]
|
|
141
|
+
- @ai-sdk/provider-utils@5.0.0-beta.12
|
|
142
|
+
|
|
143
|
+
## 4.0.0-beta.15
|
|
144
|
+
|
|
145
|
+
### Patch Changes
|
|
146
|
+
|
|
147
|
+
- 6fd51c0: fix(provider): preserve error type prefix in getErrorMessage
|
|
148
|
+
- Updated dependencies [6fd51c0]
|
|
149
|
+
- @ai-sdk/provider-utils@5.0.0-beta.11
|
|
150
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
151
|
+
|
|
152
|
+
## 4.0.0-beta.14
|
|
153
|
+
|
|
154
|
+
### Patch Changes
|
|
155
|
+
|
|
156
|
+
- c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
|
|
157
|
+
- Updated dependencies [c29a26f]
|
|
158
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
159
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
160
|
+
|
|
161
|
+
## 4.0.0-beta.13
|
|
162
|
+
|
|
163
|
+
### Patch Changes
|
|
164
|
+
|
|
165
|
+
- 38fc777: Add AI Gateway hint to provider READMEs
|
|
166
|
+
|
|
167
|
+
## 4.0.0-beta.12
|
|
168
|
+
|
|
169
|
+
### Patch Changes
|
|
170
|
+
|
|
171
|
+
- Updated dependencies [2e17091]
|
|
172
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
173
|
+
|
|
174
|
+
## 4.0.0-beta.11
|
|
175
|
+
|
|
176
|
+
### Patch Changes
|
|
177
|
+
|
|
178
|
+
- Updated dependencies [986c6fd]
|
|
179
|
+
- Updated dependencies [493295c]
|
|
180
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
181
|
+
|
|
182
|
+
## 4.0.0-beta.10
|
|
183
|
+
|
|
184
|
+
### Patch Changes
|
|
185
|
+
|
|
186
|
+
- 7bf717f: feat: Groq support for performance service tier
|
|
187
|
+
|
|
188
|
+
## 4.0.0-beta.9
|
|
189
|
+
|
|
190
|
+
### Patch Changes
|
|
191
|
+
|
|
192
|
+
- Updated dependencies [1f509d4]
|
|
193
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
194
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
195
|
+
|
|
196
|
+
## 4.0.0-beta.8
|
|
197
|
+
|
|
198
|
+
### Patch Changes
|
|
199
|
+
|
|
200
|
+
- 74d520f: feat: migrate providers to support new top-level `reasoning` parameter
|
|
201
|
+
|
|
202
|
+
## 4.0.0-beta.7
|
|
203
|
+
|
|
204
|
+
### Patch Changes
|
|
205
|
+
|
|
206
|
+
- Updated dependencies [3887c70]
|
|
207
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
208
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
209
|
+
|
|
210
|
+
## 4.0.0-beta.6
|
|
211
|
+
|
|
212
|
+
### Patch Changes
|
|
213
|
+
|
|
214
|
+
- Updated dependencies [776b617]
|
|
215
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
216
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
217
|
+
|
|
218
|
+
## 4.0.0-beta.5
|
|
219
|
+
|
|
220
|
+
### Patch Changes
|
|
221
|
+
|
|
222
|
+
- Updated dependencies [61753c3]
|
|
223
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
224
|
+
|
|
225
|
+
## 4.0.0-beta.4
|
|
226
|
+
|
|
227
|
+
### Patch Changes
|
|
228
|
+
|
|
229
|
+
- Updated dependencies [f7d4f01]
|
|
230
|
+
- @ai-sdk/provider-utils@5.0.0-beta.3
|
|
231
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
232
|
+
|
|
3
233
|
## 4.0.0-beta.3
|
|
4
234
|
|
|
5
235
|
### Patch Changes
|
|
@@ -260,13 +490,13 @@
|
|
|
260
490
|
Before
|
|
261
491
|
|
|
262
492
|
```ts
|
|
263
|
-
model.textEmbeddingModel(
|
|
493
|
+
model.textEmbeddingModel("my-model-id");
|
|
264
494
|
```
|
|
265
495
|
|
|
266
496
|
After
|
|
267
497
|
|
|
268
498
|
```ts
|
|
269
|
-
model.embeddingModel(
|
|
499
|
+
model.embeddingModel("my-model-id");
|
|
270
500
|
```
|
|
271
501
|
|
|
272
502
|
- 2625a04: feat(openai); update spec for mcp approval
|
|
@@ -487,13 +717,13 @@
|
|
|
487
717
|
Before
|
|
488
718
|
|
|
489
719
|
```ts
|
|
490
|
-
model.textEmbeddingModel(
|
|
720
|
+
model.textEmbeddingModel("my-model-id");
|
|
491
721
|
```
|
|
492
722
|
|
|
493
723
|
After
|
|
494
724
|
|
|
495
725
|
```ts
|
|
496
|
-
model.embeddingModel(
|
|
726
|
+
model.embeddingModel("my-model-id");
|
|
497
727
|
```
|
|
498
728
|
|
|
499
729
|
- 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.
|
|
44
|
+
browserSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {}, {}>;
|
|
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.
|
|
109
|
+
declare const browserSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {}, {}>;
|
|
109
110
|
|
|
110
111
|
declare const VERSION: string;
|
|
111
112
|
|