@ai-sdk/groq 4.0.0-beta.1 → 4.0.0-beta.11
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 +81 -4
- package/dist/index.d.mts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +22 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -7
- package/dist/index.mjs.map +1 -1
- package/docs/09-groq.mdx +3 -2
- package/package.json +5 -7
- package/src/convert-groq-usage.ts +2 -2
- package/src/convert-to-groq-chat-messages.ts +2 -2
- package/src/groq-chat-language-model.ts +39 -22
- package/src/groq-chat-options.ts +2 -1
- package/src/groq-prepare-tools.ts +6 -6
- package/src/groq-provider.ts +8 -8
- package/src/groq-transcription-model.ts +7 -7
- package/src/map-groq-finish-reason.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,82 @@
|
|
|
1
1
|
# @ai-sdk/groq
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [986c6fd]
|
|
8
|
+
- Updated dependencies [493295c]
|
|
9
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
10
|
+
|
|
11
|
+
## 4.0.0-beta.10
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 7bf717f: feat: Groq support for performance service tier
|
|
16
|
+
|
|
17
|
+
## 4.0.0-beta.9
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [1f509d4]
|
|
22
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
23
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
24
|
+
|
|
25
|
+
## 4.0.0-beta.8
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- 74d520f: feat: migrate providers to support new top-level `reasoning` parameter
|
|
30
|
+
|
|
31
|
+
## 4.0.0-beta.7
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [3887c70]
|
|
36
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
37
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
38
|
+
|
|
39
|
+
## 4.0.0-beta.6
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [776b617]
|
|
44
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
45
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
46
|
+
|
|
47
|
+
## 4.0.0-beta.5
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- Updated dependencies [61753c3]
|
|
52
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
53
|
+
|
|
54
|
+
## 4.0.0-beta.4
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [f7d4f01]
|
|
59
|
+
- @ai-sdk/provider-utils@5.0.0-beta.3
|
|
60
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
61
|
+
|
|
62
|
+
## 4.0.0-beta.3
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [5c2a5a2]
|
|
67
|
+
- @ai-sdk/provider@4.0.0-beta.1
|
|
68
|
+
- @ai-sdk/provider-utils@5.0.0-beta.2
|
|
69
|
+
|
|
70
|
+
## 4.0.0-beta.2
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- 45b3d76: fix(security): prevent streaming tool calls from finalizing on parsable partial JSON
|
|
75
|
+
|
|
76
|
+
Streaming tool call arguments were finalized using `isParsableJson()` as a heuristic for completion. If partial accumulated JSON happened to be valid JSON before all chunks arrived, the tool call would be executed with incomplete arguments. Tool call finalization now only occurs in `flush()` after the stream is fully consumed.
|
|
77
|
+
|
|
78
|
+
- f7295cb: revert incorrect fix https://github.com/vercel/ai/pull/13172
|
|
79
|
+
|
|
3
80
|
## 4.0.0-beta.1
|
|
4
81
|
|
|
5
82
|
### Patch Changes
|
|
@@ -242,13 +319,13 @@
|
|
|
242
319
|
Before
|
|
243
320
|
|
|
244
321
|
```ts
|
|
245
|
-
model.textEmbeddingModel(
|
|
322
|
+
model.textEmbeddingModel("my-model-id");
|
|
246
323
|
```
|
|
247
324
|
|
|
248
325
|
After
|
|
249
326
|
|
|
250
327
|
```ts
|
|
251
|
-
model.embeddingModel(
|
|
328
|
+
model.embeddingModel("my-model-id");
|
|
252
329
|
```
|
|
253
330
|
|
|
254
331
|
- 2625a04: feat(openai); update spec for mcp approval
|
|
@@ -469,13 +546,13 @@
|
|
|
469
546
|
Before
|
|
470
547
|
|
|
471
548
|
```ts
|
|
472
|
-
model.textEmbeddingModel(
|
|
549
|
+
model.textEmbeddingModel("my-model-id");
|
|
473
550
|
```
|
|
474
551
|
|
|
475
552
|
After
|
|
476
553
|
|
|
477
554
|
```ts
|
|
478
|
-
model.embeddingModel(
|
|
555
|
+
model.embeddingModel("my-model-id");
|
|
479
556
|
```
|
|
480
557
|
|
|
481
558
|
- Updated dependencies [8d9e8ad]
|
package/dist/index.d.mts
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
|
|
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
|
|
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
|
|
22
|
-
__export(
|
|
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(
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
29
29
|
|
|
30
30
|
// src/groq-provider.ts
|
|
31
31
|
var import_provider4 = require("@ai-sdk/provider");
|
|
@@ -241,12 +241,13 @@ var groqLanguageModelOptions = import_v4.z.object({
|
|
|
241
241
|
/**
|
|
242
242
|
* Service tier for the request.
|
|
243
243
|
* - 'on_demand': Default tier with consistent performance and fairness
|
|
244
|
+
* - 'performance': Prioritized tier for latency-sensitive workloads
|
|
244
245
|
* - 'flex': Higher throughput tier optimized for workloads that can handle occasional request failures
|
|
245
246
|
* - 'auto': Uses on_demand rate limits, then falls back to flex tier if exceeded
|
|
246
247
|
*
|
|
247
248
|
* @default 'on_demand'
|
|
248
249
|
*/
|
|
249
|
-
serviceTier: import_v4.z.enum(["on_demand", "flex", "auto"]).optional()
|
|
250
|
+
serviceTier: import_v4.z.enum(["on_demand", "performance", "flex", "auto"]).optional()
|
|
250
251
|
});
|
|
251
252
|
|
|
252
253
|
// src/groq-error.ts
|
|
@@ -371,7 +372,7 @@ function mapGroqFinishReason(finishReason) {
|
|
|
371
372
|
// src/groq-chat-language-model.ts
|
|
372
373
|
var GroqChatLanguageModel = class {
|
|
373
374
|
constructor(modelId, config) {
|
|
374
|
-
this.specificationVersion = "
|
|
375
|
+
this.specificationVersion = "v4";
|
|
375
376
|
this.supportedUrls = {
|
|
376
377
|
"image/*": [/^https?:\/\/.*$/]
|
|
377
378
|
};
|
|
@@ -392,12 +393,13 @@ var GroqChatLanguageModel = class {
|
|
|
392
393
|
stopSequences,
|
|
393
394
|
responseFormat,
|
|
394
395
|
seed,
|
|
396
|
+
reasoning,
|
|
395
397
|
stream,
|
|
396
398
|
tools,
|
|
397
399
|
toolChoice,
|
|
398
400
|
providerOptions
|
|
399
401
|
}) {
|
|
400
|
-
var _a, _b, _c;
|
|
402
|
+
var _a, _b, _c, _d;
|
|
401
403
|
const warnings = [];
|
|
402
404
|
const groqOptions = await (0, import_provider_utils3.parseProviderOptions)({
|
|
403
405
|
provider: "groq",
|
|
@@ -448,7 +450,17 @@ var GroqChatLanguageModel = class {
|
|
|
448
450
|
} : { type: "json_object" } : void 0,
|
|
449
451
|
// provider options:
|
|
450
452
|
reasoning_format: groqOptions == null ? void 0 : groqOptions.reasoningFormat,
|
|
451
|
-
reasoning_effort: groqOptions == null ? void 0 : groqOptions.reasoningEffort,
|
|
453
|
+
reasoning_effort: (_d = groqOptions == null ? void 0 : groqOptions.reasoningEffort) != null ? _d : (0, import_provider_utils3.isCustomReasoning)(reasoning) && reasoning !== "none" ? (0, import_provider_utils3.mapReasoningToProviderEffort)({
|
|
454
|
+
reasoning,
|
|
455
|
+
effortMap: {
|
|
456
|
+
minimal: "low",
|
|
457
|
+
low: "low",
|
|
458
|
+
medium: "medium",
|
|
459
|
+
high: "high",
|
|
460
|
+
xhigh: "high"
|
|
461
|
+
},
|
|
462
|
+
warnings
|
|
463
|
+
}) : void 0,
|
|
452
464
|
service_tier: groqOptions == null ? void 0 : groqOptions.serviceTier,
|
|
453
465
|
// messages:
|
|
454
466
|
messages: convertToGroqChatMessages(prompt),
|
|
@@ -852,7 +864,7 @@ var GroqTranscriptionModel = class {
|
|
|
852
864
|
constructor(modelId, config) {
|
|
853
865
|
this.modelId = modelId;
|
|
854
866
|
this.config = config;
|
|
855
|
-
this.specificationVersion = "
|
|
867
|
+
this.specificationVersion = "v4";
|
|
856
868
|
}
|
|
857
869
|
get provider() {
|
|
858
870
|
return this.config.provider;
|
|
@@ -984,7 +996,7 @@ var groqTools = {
|
|
|
984
996
|
};
|
|
985
997
|
|
|
986
998
|
// src/version.ts
|
|
987
|
-
var VERSION = true ? "4.0.0-beta.
|
|
999
|
+
var VERSION = true ? "4.0.0-beta.11" : "0.0.0-test";
|
|
988
1000
|
|
|
989
1001
|
// src/groq-provider.ts
|
|
990
1002
|
function createGroq(options = {}) {
|
|
@@ -1026,7 +1038,7 @@ function createGroq(options = {}) {
|
|
|
1026
1038
|
const provider = function(modelId) {
|
|
1027
1039
|
return createLanguageModel(modelId);
|
|
1028
1040
|
};
|
|
1029
|
-
provider.specificationVersion = "
|
|
1041
|
+
provider.specificationVersion = "v4";
|
|
1030
1042
|
provider.languageModel = createLanguageModel;
|
|
1031
1043
|
provider.chat = createChatModel;
|
|
1032
1044
|
provider.embeddingModel = (modelId) => {
|