@ai-sdk/google 4.0.26 → 4.0.28
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 +15 -0
- package/dist/index.js +35 -16
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +34 -14
- package/dist/internal/index.js.map +1 -1
- package/package.json +2 -2
- package/src/google-files.ts +0 -1
- package/src/interactions/google-interactions-language-model.ts +21 -0
- package/src/interactions/google-interactions-prompt.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 4.0.28
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [1659cd5]
|
|
8
|
+
- Updated dependencies [6a5bdff]
|
|
9
|
+
- @ai-sdk/provider-utils@5.0.15
|
|
10
|
+
|
|
11
|
+
## 4.0.27
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- d2d9324: Forward `topK` through Google Interactions requests and warn when unsupported frequency or presence penalties are provided.
|
|
16
|
+
- 8bedb2c: Allow fetch to derive the content length for Google file upload request bodies.
|
|
17
|
+
|
|
3
18
|
## 4.0.26
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "4.0.
|
|
10
|
+
var VERSION = true ? "4.0.28" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -3330,7 +3330,6 @@ var GoogleFiles = class {
|
|
|
3330
3330
|
const uploadResponse = await fetchFn(uploadUrl, {
|
|
3331
3331
|
method: "POST",
|
|
3332
3332
|
headers: {
|
|
3333
|
-
"Content-Length": String(fileBytes.length),
|
|
3334
3333
|
"X-Goog-Upload-Offset": "0",
|
|
3335
3334
|
"X-Goog-Upload-Command": "upload, finalize"
|
|
3336
3335
|
},
|
|
@@ -6488,7 +6487,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6488
6487
|
};
|
|
6489
6488
|
}
|
|
6490
6489
|
async getArgs(options) {
|
|
6491
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
6490
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
|
|
6492
6491
|
const warnings = [];
|
|
6493
6492
|
const googleOptions = await parseProviderOptions7({
|
|
6494
6493
|
provider: "google",
|
|
@@ -6496,6 +6495,20 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6496
6495
|
schema: googleInteractionsLanguageModelOptions
|
|
6497
6496
|
});
|
|
6498
6497
|
const isAgent = this.agent != null;
|
|
6498
|
+
if (!isAgent) {
|
|
6499
|
+
if (options.frequencyPenalty != null) {
|
|
6500
|
+
warnings.push({
|
|
6501
|
+
type: "unsupported",
|
|
6502
|
+
feature: "frequencyPenalty"
|
|
6503
|
+
});
|
|
6504
|
+
}
|
|
6505
|
+
if (options.presencePenalty != null) {
|
|
6506
|
+
warnings.push({
|
|
6507
|
+
type: "unsupported",
|
|
6508
|
+
feature: "presencePenalty"
|
|
6509
|
+
});
|
|
6510
|
+
}
|
|
6511
|
+
}
|
|
6499
6512
|
const hasTools = options.tools != null && options.tools.length > 0;
|
|
6500
6513
|
let toolsForBody;
|
|
6501
6514
|
let toolChoiceForBody;
|
|
@@ -6579,6 +6592,11 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6579
6592
|
const droppedFields = [];
|
|
6580
6593
|
if (options.temperature != null) droppedFields.push("temperature");
|
|
6581
6594
|
if (options.topP != null) droppedFields.push("topP");
|
|
6595
|
+
if (options.topK != null) droppedFields.push("topK");
|
|
6596
|
+
if (options.frequencyPenalty != null)
|
|
6597
|
+
droppedFields.push("frequencyPenalty");
|
|
6598
|
+
if (options.presencePenalty != null)
|
|
6599
|
+
droppedFields.push("presencePenalty");
|
|
6582
6600
|
if (options.seed != null) droppedFields.push("seed");
|
|
6583
6601
|
if (options.stopSequences != null && options.stopSequences.length > 0) {
|
|
6584
6602
|
droppedFields.push("stopSequences");
|
|
@@ -6602,11 +6620,12 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6602
6620
|
generationConfig = pruneUndefined({
|
|
6603
6621
|
temperature: (_l = options.temperature) != null ? _l : void 0,
|
|
6604
6622
|
top_p: (_m = options.topP) != null ? _m : void 0,
|
|
6605
|
-
|
|
6623
|
+
top_k: (_n = options.topK) != null ? _n : void 0,
|
|
6624
|
+
seed: (_o = options.seed) != null ? _o : void 0,
|
|
6606
6625
|
stop_sequences: options.stopSequences != null && options.stopSequences.length > 0 ? options.stopSequences : void 0,
|
|
6607
|
-
max_output_tokens: (
|
|
6608
|
-
thinking_level: (
|
|
6609
|
-
thinking_summaries: (
|
|
6626
|
+
max_output_tokens: (_p = options.maxOutputTokens) != null ? _p : void 0,
|
|
6627
|
+
thinking_level: (_q = googleOptions == null ? void 0 : googleOptions.thinkingLevel) != null ? _q : void 0,
|
|
6628
|
+
thinking_summaries: (_r = googleOptions == null ? void 0 : googleOptions.thinkingSummaries) != null ? _r : void 0,
|
|
6610
6629
|
tool_choice: toolChoiceForBody
|
|
6611
6630
|
});
|
|
6612
6631
|
if ((googleOptions == null ? void 0 : googleOptions.imageConfig) != null) {
|
|
@@ -6633,9 +6652,9 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6633
6652
|
if (agentConfigOptions.type === "deep-research") {
|
|
6634
6653
|
agentConfig = pruneUndefined({
|
|
6635
6654
|
type: "deep-research",
|
|
6636
|
-
thinking_summaries: (
|
|
6637
|
-
visualization: (
|
|
6638
|
-
collaborative_planning: (
|
|
6655
|
+
thinking_summaries: (_s = agentConfigOptions.thinkingSummaries) != null ? _s : void 0,
|
|
6656
|
+
visualization: (_t = agentConfigOptions.visualization) != null ? _t : void 0,
|
|
6657
|
+
collaborative_planning: (_u = agentConfigOptions.collaborativePlanning) != null ? _u : void 0
|
|
6639
6658
|
});
|
|
6640
6659
|
} else if (agentConfigOptions.type === "dynamic") {
|
|
6641
6660
|
agentConfig = { type: "dynamic" };
|
|
@@ -6652,7 +6671,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6652
6671
|
environment = googleOptions.environment;
|
|
6653
6672
|
} else {
|
|
6654
6673
|
const environmentOptions = googleOptions.environment;
|
|
6655
|
-
const sources = (
|
|
6674
|
+
const sources = (_v = environmentOptions.sources) == null ? void 0 : _v.map((source) => {
|
|
6656
6675
|
var _a2;
|
|
6657
6676
|
if (source.type === "inline") {
|
|
6658
6677
|
return {
|
|
@@ -6697,20 +6716,20 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6697
6716
|
tools: toolsForBody,
|
|
6698
6717
|
response_format: responseFormatEntries.length > 0 ? responseFormatEntries : void 0,
|
|
6699
6718
|
response_modalities: (googleOptions == null ? void 0 : googleOptions.responseModalities) != null ? googleOptions.responseModalities : void 0,
|
|
6700
|
-
previous_interaction_id: (
|
|
6701
|
-
service_tier: (
|
|
6702
|
-
store: (
|
|
6719
|
+
previous_interaction_id: (_w = googleOptions == null ? void 0 : googleOptions.previousInteractionId) != null ? _w : void 0,
|
|
6720
|
+
service_tier: (_x = googleOptions == null ? void 0 : googleOptions.serviceTier) != null ? _x : void 0,
|
|
6721
|
+
store: (_y = googleOptions == null ? void 0 : googleOptions.store) != null ? _y : void 0,
|
|
6703
6722
|
generation_config: generationConfig != null && Object.keys(generationConfig).length > 0 ? generationConfig : void 0,
|
|
6704
6723
|
agent_config: agentConfig,
|
|
6705
6724
|
environment,
|
|
6706
|
-
background: (
|
|
6725
|
+
background: (_z = googleOptions == null ? void 0 : googleOptions.background) != null ? _z : void 0
|
|
6707
6726
|
});
|
|
6708
6727
|
return {
|
|
6709
6728
|
args,
|
|
6710
6729
|
warnings,
|
|
6711
6730
|
isAgent,
|
|
6712
6731
|
isBackground: (googleOptions == null ? void 0 : googleOptions.background) === true,
|
|
6713
|
-
pollingTimeoutMs: (
|
|
6732
|
+
pollingTimeoutMs: (_A = googleOptions == null ? void 0 : googleOptions.pollingTimeoutMs) != null ? _A : void 0
|
|
6714
6733
|
};
|
|
6715
6734
|
}
|
|
6716
6735
|
async doGenerate(options) {
|