@ai-sdk/google 4.0.0-beta.48 → 4.0.0-beta.49
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 +13 -0
- package/dist/index.d.ts +10 -10
- package/dist/index.js +186 -180
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +103 -110
- package/dist/internal/index.js.map +1 -1
- package/docs/15-google.mdx +4 -4
- package/package.json +2 -2
- package/src/convert-to-google-messages.ts +32 -14
- package/src/google-embedding-model.ts +1 -1
- package/src/google-image-model-options.ts +23 -0
- package/src/google-image-model.ts +2 -19
- package/src/google-language-model.ts +104 -110
- package/src/google-prepare-tools.ts +1 -1
- package/src/google-provider.ts +2 -2
- package/src/google-video-model-options.ts +43 -0
- package/src/google-video-model.ts +4 -43
- package/src/index.ts +4 -4
- package/src/internal/index.ts +1 -1
- /package/src/{google-embedding-options.ts → google-embedding-model-options.ts} +0 -0
- /package/src/{google-options.ts → google-language-model-options.ts} +0 -0
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.0-beta.
|
|
10
|
+
var VERSION = true ? "4.0.0-beta.49" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -50,7 +50,7 @@ var googleFailedResponseHandler = createJsonErrorResponseHandler({
|
|
|
50
50
|
errorToMessage: (data) => data.error.message
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
// src/google-embedding-options.ts
|
|
53
|
+
// src/google-embedding-model-options.ts
|
|
54
54
|
import {
|
|
55
55
|
lazySchema as lazySchema2,
|
|
56
56
|
zodSchema as zodSchema2
|
|
@@ -536,13 +536,25 @@ function appendLegacyToolResultParts(parts, toolName, outputValue) {
|
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
function convertToGoogleMessages(prompt, options) {
|
|
539
|
-
var _a, _b, _c, _d
|
|
539
|
+
var _a, _b, _c, _d;
|
|
540
540
|
const systemInstructionParts = [];
|
|
541
541
|
const contents = [];
|
|
542
542
|
let systemMessagesAllowed = true;
|
|
543
543
|
const isGemmaModel = (_a = options == null ? void 0 : options.isGemmaModel) != null ? _a : false;
|
|
544
|
-
const
|
|
544
|
+
const providerOptionsNames = (_b = options == null ? void 0 : options.providerOptionsNames) != null ? _b : ["google"];
|
|
545
|
+
const isVertexLike = !providerOptionsNames.includes("google");
|
|
545
546
|
const supportsFunctionResponseParts = (_c = options == null ? void 0 : options.supportsFunctionResponseParts) != null ? _c : true;
|
|
547
|
+
const readProviderOpts = (part) => {
|
|
548
|
+
var _a2, _b2, _c2, _d2, _e;
|
|
549
|
+
for (const name of providerOptionsNames) {
|
|
550
|
+
const v = (_a2 = part.providerOptions) == null ? void 0 : _a2[name];
|
|
551
|
+
if (v != null) return v;
|
|
552
|
+
}
|
|
553
|
+
if (isVertexLike) {
|
|
554
|
+
return (_b2 = part.providerOptions) == null ? void 0 : _b2.google;
|
|
555
|
+
}
|
|
556
|
+
return (_e = (_c2 = part.providerOptions) == null ? void 0 : _c2.googleVertex) != null ? _e : (_d2 = part.providerOptions) == null ? void 0 : _d2.vertex;
|
|
557
|
+
};
|
|
546
558
|
for (const { role, content } of prompt) {
|
|
547
559
|
switch (role) {
|
|
548
560
|
case "system": {
|
|
@@ -575,7 +587,7 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
575
587
|
break;
|
|
576
588
|
}
|
|
577
589
|
case "reference": {
|
|
578
|
-
if (
|
|
590
|
+
if (isVertexLike) {
|
|
579
591
|
throw new UnsupportedFunctionalityError({
|
|
580
592
|
functionality: "file parts with provider references"
|
|
581
593
|
});
|
|
@@ -624,8 +636,7 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
624
636
|
contents.push({
|
|
625
637
|
role: "model",
|
|
626
638
|
parts: content.map((part) => {
|
|
627
|
-
|
|
628
|
-
const providerOpts = (_d2 = (_a2 = part.providerOptions) == null ? void 0 : _a2[providerOptionsName]) != null ? _d2 : providerOptionsName !== "google" ? (_b2 = part.providerOptions) == null ? void 0 : _b2.google : (_c2 = part.providerOptions) == null ? void 0 : _c2.vertex;
|
|
639
|
+
const providerOpts = readProviderOpts(part);
|
|
629
640
|
const thoughtSignature = (providerOpts == null ? void 0 : providerOpts.thoughtSignature) != null ? String(providerOpts.thoughtSignature) : void 0;
|
|
630
641
|
switch (part.type) {
|
|
631
642
|
case "text": {
|
|
@@ -669,7 +680,7 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
669
680
|
});
|
|
670
681
|
}
|
|
671
682
|
case "reference": {
|
|
672
|
-
if (
|
|
683
|
+
if (isVertexLike) {
|
|
673
684
|
throw new UnsupportedFunctionalityError({
|
|
674
685
|
functionality: "file parts with provider references"
|
|
675
686
|
});
|
|
@@ -759,7 +770,7 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
759
770
|
if (part.type === "tool-approval-response") {
|
|
760
771
|
continue;
|
|
761
772
|
}
|
|
762
|
-
const partProviderOpts = (
|
|
773
|
+
const partProviderOpts = readProviderOpts(part);
|
|
763
774
|
const serverToolCallId = (partProviderOpts == null ? void 0 : partProviderOpts.serverToolCallId) != null ? String(partProviderOpts.serverToolCallId) : void 0;
|
|
764
775
|
const serverToolType = (partProviderOpts == null ? void 0 : partProviderOpts.serverToolType) != null ? String(partProviderOpts.serverToolType) : void 0;
|
|
765
776
|
if (serverToolCallId && serverToolType) {
|
|
@@ -792,7 +803,7 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
792
803
|
name: part.toolName,
|
|
793
804
|
response: {
|
|
794
805
|
name: part.toolName,
|
|
795
|
-
content: output.type === "execution-denied" ? (
|
|
806
|
+
content: output.type === "execution-denied" ? (_d = output.reason) != null ? _d : "Tool call execution denied." : output.value
|
|
796
807
|
}
|
|
797
808
|
}
|
|
798
809
|
});
|
|
@@ -821,7 +832,7 @@ function getModelPath(modelId) {
|
|
|
821
832
|
return modelId.includes("/") ? modelId : `models/${modelId}`;
|
|
822
833
|
}
|
|
823
834
|
|
|
824
|
-
// src/google-options.ts
|
|
835
|
+
// src/google-language-model-options.ts
|
|
825
836
|
import {
|
|
826
837
|
lazySchema as lazySchema4,
|
|
827
838
|
zodSchema as zodSchema4
|
|
@@ -1513,13 +1524,17 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1513
1524
|
}, { isStreaming = false } = {}) {
|
|
1514
1525
|
var _a, _b;
|
|
1515
1526
|
const warnings = [];
|
|
1516
|
-
const
|
|
1517
|
-
let googleOptions
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1527
|
+
const providerOptionsNames = this.config.provider.includes("vertex") ? ["googleVertex", "vertex"] : ["google"];
|
|
1528
|
+
let googleOptions;
|
|
1529
|
+
for (const name of providerOptionsNames) {
|
|
1530
|
+
googleOptions = await parseProviderOptions2({
|
|
1531
|
+
provider: name,
|
|
1532
|
+
providerOptions,
|
|
1533
|
+
schema: googleLanguageModelOptions
|
|
1534
|
+
});
|
|
1535
|
+
if (googleOptions != null) break;
|
|
1536
|
+
}
|
|
1537
|
+
if (googleOptions == null && !providerOptionsNames.includes("google")) {
|
|
1523
1538
|
googleOptions = await parseProviderOptions2({
|
|
1524
1539
|
provider: "google",
|
|
1525
1540
|
providerOptions,
|
|
@@ -1549,7 +1564,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1549
1564
|
const supportsFunctionResponseParts = this.modelId.startsWith("gemini-3");
|
|
1550
1565
|
const { contents, systemInstruction } = convertToGoogleMessages(prompt, {
|
|
1551
1566
|
isGemmaModel,
|
|
1552
|
-
|
|
1567
|
+
providerOptionsNames,
|
|
1553
1568
|
supportsFunctionResponseParts
|
|
1554
1569
|
});
|
|
1555
1570
|
const {
|
|
@@ -1622,12 +1637,15 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1622
1637
|
serviceTier: sanitizedServiceTier
|
|
1623
1638
|
},
|
|
1624
1639
|
warnings: [...warnings, ...toolWarnings],
|
|
1625
|
-
|
|
1640
|
+
providerOptionsNames
|
|
1626
1641
|
};
|
|
1627
1642
|
}
|
|
1628
1643
|
async doGenerate(options) {
|
|
1629
1644
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
1630
|
-
const { args, warnings,
|
|
1645
|
+
const { args, warnings, providerOptionsNames } = await this.getArgs(options);
|
|
1646
|
+
const wrapProviderMetadata = (payload) => Object.fromEntries(
|
|
1647
|
+
providerOptionsNames.map((name) => [name, payload])
|
|
1648
|
+
);
|
|
1631
1649
|
const mergedHeaders = combineHeaders2(
|
|
1632
1650
|
this.config.headers ? await resolve2(this.config.headers) : void 0,
|
|
1633
1651
|
options.headers
|
|
@@ -1677,11 +1695,9 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1677
1695
|
});
|
|
1678
1696
|
lastCodeExecutionToolCallId = void 0;
|
|
1679
1697
|
} else if ("text" in part && part.text != null) {
|
|
1680
|
-
const thoughtSignatureMetadata = part.thoughtSignature ? {
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
}
|
|
1684
|
-
} : void 0;
|
|
1698
|
+
const thoughtSignatureMetadata = part.thoughtSignature ? wrapProviderMetadata({
|
|
1699
|
+
thoughtSignature: part.thoughtSignature
|
|
1700
|
+
}) : void 0;
|
|
1685
1701
|
if (part.text.length === 0) {
|
|
1686
1702
|
if (thoughtSignatureMetadata != null && content.length > 0) {
|
|
1687
1703
|
const lastContent = content[content.length - 1];
|
|
@@ -1700,11 +1716,9 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1700
1716
|
toolCallId: this.config.generateId(),
|
|
1701
1717
|
toolName: part.functionCall.name,
|
|
1702
1718
|
input: JSON.stringify(part.functionCall.args),
|
|
1703
|
-
providerMetadata: part.thoughtSignature ? {
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
}
|
|
1707
|
-
} : void 0
|
|
1719
|
+
providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
|
|
1720
|
+
thoughtSignature: part.thoughtSignature
|
|
1721
|
+
}) : void 0
|
|
1708
1722
|
});
|
|
1709
1723
|
} else if ("inlineData" in part) {
|
|
1710
1724
|
const hasThought = part.thought === true;
|
|
@@ -1713,11 +1727,9 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1713
1727
|
type: hasThought ? "reasoning-file" : "file",
|
|
1714
1728
|
data: { type: "data", data: part.inlineData.data },
|
|
1715
1729
|
mediaType: part.inlineData.mimeType,
|
|
1716
|
-
providerMetadata: hasThoughtSignature ? {
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
}
|
|
1720
|
-
} : void 0
|
|
1730
|
+
providerMetadata: hasThoughtSignature ? wrapProviderMetadata({
|
|
1731
|
+
thoughtSignature: part.thoughtSignature
|
|
1732
|
+
}) : void 0
|
|
1721
1733
|
});
|
|
1722
1734
|
} else if ("toolCall" in part && part.toolCall) {
|
|
1723
1735
|
const toolCallId = (_e = part.toolCall.id) != null ? _e : this.config.generateId();
|
|
@@ -1729,18 +1741,14 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1729
1741
|
input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
|
|
1730
1742
|
providerExecuted: true,
|
|
1731
1743
|
dynamic: true,
|
|
1732
|
-
providerMetadata: part.thoughtSignature ? {
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
serverToolCallId: toolCallId,
|
|
1741
|
-
serverToolType: part.toolCall.toolType
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
+
providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
|
|
1745
|
+
thoughtSignature: part.thoughtSignature,
|
|
1746
|
+
serverToolCallId: toolCallId,
|
|
1747
|
+
serverToolType: part.toolCall.toolType
|
|
1748
|
+
}) : wrapProviderMetadata({
|
|
1749
|
+
serverToolCallId: toolCallId,
|
|
1750
|
+
serverToolType: part.toolCall.toolType
|
|
1751
|
+
})
|
|
1744
1752
|
});
|
|
1745
1753
|
} else if ("toolResponse" in part && part.toolResponse) {
|
|
1746
1754
|
const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : this.config.generateId();
|
|
@@ -1749,18 +1757,14 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1749
1757
|
toolCallId: responseToolCallId,
|
|
1750
1758
|
toolName: `server:${part.toolResponse.toolType}`,
|
|
1751
1759
|
result: (_h = part.toolResponse.response) != null ? _h : {},
|
|
1752
|
-
providerMetadata: part.thoughtSignature ? {
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
serverToolCallId: responseToolCallId,
|
|
1761
|
-
serverToolType: part.toolResponse.toolType
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1760
|
+
providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
|
|
1761
|
+
thoughtSignature: part.thoughtSignature,
|
|
1762
|
+
serverToolCallId: responseToolCallId,
|
|
1763
|
+
serverToolType: part.toolResponse.toolType
|
|
1764
|
+
}) : wrapProviderMetadata({
|
|
1765
|
+
serverToolCallId: responseToolCallId,
|
|
1766
|
+
serverToolType: part.toolResponse.toolType
|
|
1767
|
+
})
|
|
1764
1768
|
});
|
|
1765
1769
|
lastServerToolCallId = void 0;
|
|
1766
1770
|
}
|
|
@@ -1786,17 +1790,15 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1786
1790
|
},
|
|
1787
1791
|
usage: convertGoogleUsage(usageMetadata),
|
|
1788
1792
|
warnings,
|
|
1789
|
-
providerMetadata: {
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
}
|
|
1799
|
-
},
|
|
1793
|
+
providerMetadata: wrapProviderMetadata({
|
|
1794
|
+
promptFeedback: (_k = response.promptFeedback) != null ? _k : null,
|
|
1795
|
+
groundingMetadata: (_l = candidate.groundingMetadata) != null ? _l : null,
|
|
1796
|
+
urlContextMetadata: (_m = candidate.urlContextMetadata) != null ? _m : null,
|
|
1797
|
+
safetyRatings: (_n = candidate.safetyRatings) != null ? _n : null,
|
|
1798
|
+
usageMetadata: usageMetadata != null ? usageMetadata : null,
|
|
1799
|
+
finishMessage: (_o = candidate.finishMessage) != null ? _o : null,
|
|
1800
|
+
serviceTier: (_p = response.serviceTier) != null ? _p : null
|
|
1801
|
+
}),
|
|
1800
1802
|
request: { body: args },
|
|
1801
1803
|
response: {
|
|
1802
1804
|
// TODO timestamp, model id, id
|
|
@@ -1806,10 +1808,13 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1806
1808
|
};
|
|
1807
1809
|
}
|
|
1808
1810
|
async doStream(options) {
|
|
1809
|
-
const { args, warnings,
|
|
1811
|
+
const { args, warnings, providerOptionsNames } = await this.getArgs(
|
|
1810
1812
|
options,
|
|
1811
1813
|
{ isStreaming: true }
|
|
1812
1814
|
);
|
|
1815
|
+
const wrapProviderMetadata = (payload) => Object.fromEntries(
|
|
1816
|
+
providerOptionsNames.map((name) => [name, payload])
|
|
1817
|
+
);
|
|
1813
1818
|
const headers = combineHeaders2(
|
|
1814
1819
|
this.config.headers ? await resolve2(this.config.headers) : void 0,
|
|
1815
1820
|
options.headers
|
|
@@ -1917,11 +1922,9 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1917
1922
|
lastCodeExecutionToolCallId = void 0;
|
|
1918
1923
|
}
|
|
1919
1924
|
} else if ("text" in part && part.text != null) {
|
|
1920
|
-
const thoughtSignatureMetadata = part.thoughtSignature ? {
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
}
|
|
1924
|
-
} : void 0;
|
|
1925
|
+
const thoughtSignatureMetadata = part.thoughtSignature ? wrapProviderMetadata({
|
|
1926
|
+
thoughtSignature: part.thoughtSignature
|
|
1927
|
+
}) : void 0;
|
|
1925
1928
|
if (part.text.length === 0) {
|
|
1926
1929
|
if (thoughtSignatureMetadata != null && currentTextBlockId !== null) {
|
|
1927
1930
|
controller.enqueue({
|
|
@@ -1993,11 +1996,9 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1993
1996
|
}
|
|
1994
1997
|
const hasThought = part.thought === true;
|
|
1995
1998
|
const hasThoughtSignature = !!part.thoughtSignature;
|
|
1996
|
-
const fileMeta = hasThoughtSignature ? {
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
}
|
|
2000
|
-
} : void 0;
|
|
1999
|
+
const fileMeta = hasThoughtSignature ? wrapProviderMetadata({
|
|
2000
|
+
thoughtSignature: part.thoughtSignature
|
|
2001
|
+
}) : void 0;
|
|
2001
2002
|
controller.enqueue({
|
|
2002
2003
|
type: hasThought ? "reasoning-file" : "file",
|
|
2003
2004
|
mediaType: part.inlineData.mimeType,
|
|
@@ -2007,13 +2008,11 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
2007
2008
|
} else if ("toolCall" in part && part.toolCall) {
|
|
2008
2009
|
const toolCallId = (_e = part.toolCall.id) != null ? _e : generateId3();
|
|
2009
2010
|
lastServerToolCallId = toolCallId;
|
|
2010
|
-
const serverMeta = {
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
}
|
|
2016
|
-
};
|
|
2011
|
+
const serverMeta = wrapProviderMetadata({
|
|
2012
|
+
...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
|
|
2013
|
+
serverToolCallId: toolCallId,
|
|
2014
|
+
serverToolType: part.toolCall.toolType
|
|
2015
|
+
});
|
|
2017
2016
|
controller.enqueue({
|
|
2018
2017
|
type: "tool-call",
|
|
2019
2018
|
toolCallId,
|
|
@@ -2025,13 +2024,11 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
2025
2024
|
});
|
|
2026
2025
|
} else if ("toolResponse" in part && part.toolResponse) {
|
|
2027
2026
|
const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : generateId3();
|
|
2028
|
-
const serverMeta = {
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
}
|
|
2034
|
-
};
|
|
2027
|
+
const serverMeta = wrapProviderMetadata({
|
|
2028
|
+
...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
|
|
2029
|
+
serverToolCallId: responseToolCallId,
|
|
2030
|
+
serverToolType: part.toolResponse.toolType
|
|
2031
|
+
});
|
|
2035
2032
|
controller.enqueue({
|
|
2036
2033
|
type: "tool-result",
|
|
2037
2034
|
toolCallId: responseToolCallId,
|
|
@@ -2044,11 +2041,9 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
2044
2041
|
}
|
|
2045
2042
|
for (const part of parts) {
|
|
2046
2043
|
if (!("functionCall" in part)) continue;
|
|
2047
|
-
const providerMeta = part.thoughtSignature ? {
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
}
|
|
2051
|
-
} : void 0;
|
|
2044
|
+
const providerMeta = part.thoughtSignature ? wrapProviderMetadata({
|
|
2045
|
+
thoughtSignature: part.thoughtSignature
|
|
2046
|
+
}) : void 0;
|
|
2052
2047
|
const isStreamingChunk = part.functionCall.partialArgs != null || part.functionCall.name != null && part.functionCall.willContinue === true;
|
|
2053
2048
|
const isTerminalChunk = part.functionCall.name == null && part.functionCall.args == null && part.functionCall.partialArgs == null && part.functionCall.willContinue == null;
|
|
2054
2049
|
const isCompleteCall = part.functionCall.name != null && part.functionCall.args != null && part.functionCall.partialArgs == null;
|
|
@@ -2159,17 +2154,15 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
2159
2154
|
}),
|
|
2160
2155
|
raw: candidate.finishReason
|
|
2161
2156
|
};
|
|
2162
|
-
providerMetadata = {
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
}
|
|
2172
|
-
};
|
|
2157
|
+
providerMetadata = wrapProviderMetadata({
|
|
2158
|
+
promptFeedback: (_j = value.promptFeedback) != null ? _j : null,
|
|
2159
|
+
groundingMetadata: lastGroundingMetadata,
|
|
2160
|
+
urlContextMetadata: lastUrlContextMetadata,
|
|
2161
|
+
safetyRatings: (_k = candidate.safetyRatings) != null ? _k : null,
|
|
2162
|
+
usageMetadata: usageMetadata != null ? usageMetadata : null,
|
|
2163
|
+
finishMessage: (_l = candidate.finishMessage) != null ? _l : null,
|
|
2164
|
+
serviceTier
|
|
2165
|
+
});
|
|
2173
2166
|
}
|
|
2174
2167
|
},
|
|
2175
2168
|
flush(controller) {
|
|
@@ -2736,16 +2729,33 @@ import {
|
|
|
2736
2729
|
convertToBase64 as convertToBase642,
|
|
2737
2730
|
createJsonResponseHandler as createJsonResponseHandler3,
|
|
2738
2731
|
generateId as defaultGenerateId,
|
|
2739
|
-
lazySchema as
|
|
2732
|
+
lazySchema as lazySchema13,
|
|
2740
2733
|
parseProviderOptions as parseProviderOptions3,
|
|
2741
2734
|
postJsonToApi as postJsonToApi3,
|
|
2742
2735
|
resolve as resolve3,
|
|
2743
2736
|
serializeModelOptions as serializeModelOptions3,
|
|
2744
2737
|
WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE3,
|
|
2745
2738
|
WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE3,
|
|
2739
|
+
zodSchema as zodSchema13
|
|
2740
|
+
} from "@ai-sdk/provider-utils";
|
|
2741
|
+
import { z as z14 } from "zod/v4";
|
|
2742
|
+
|
|
2743
|
+
// src/google-image-model-options.ts
|
|
2744
|
+
import {
|
|
2745
|
+
lazySchema as lazySchema12,
|
|
2746
2746
|
zodSchema as zodSchema12
|
|
2747
2747
|
} from "@ai-sdk/provider-utils";
|
|
2748
2748
|
import { z as z13 } from "zod/v4";
|
|
2749
|
+
var googleImageModelOptionsSchema = lazySchema12(
|
|
2750
|
+
() => zodSchema12(
|
|
2751
|
+
z13.object({
|
|
2752
|
+
personGeneration: z13.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
|
2753
|
+
aspectRatio: z13.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish()
|
|
2754
|
+
})
|
|
2755
|
+
)
|
|
2756
|
+
);
|
|
2757
|
+
|
|
2758
|
+
// src/google-image-model.ts
|
|
2749
2759
|
var GoogleImageModel = class _GoogleImageModel {
|
|
2750
2760
|
constructor(modelId, settings, config) {
|
|
2751
2761
|
this.modelId = modelId;
|
|
@@ -2983,18 +2993,10 @@ var GoogleImageModel = class _GoogleImageModel {
|
|
|
2983
2993
|
function isGeminiModel(modelId) {
|
|
2984
2994
|
return modelId.startsWith("gemini-");
|
|
2985
2995
|
}
|
|
2986
|
-
var googleImageResponseSchema =
|
|
2987
|
-
() =>
|
|
2988
|
-
|
|
2989
|
-
predictions:
|
|
2990
|
-
})
|
|
2991
|
-
)
|
|
2992
|
-
);
|
|
2993
|
-
var googleImageModelOptionsSchema = lazySchema12(
|
|
2994
|
-
() => zodSchema12(
|
|
2995
|
-
z13.object({
|
|
2996
|
-
personGeneration: z13.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
|
2997
|
-
aspectRatio: z13.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish()
|
|
2996
|
+
var googleImageResponseSchema = lazySchema13(
|
|
2997
|
+
() => zodSchema13(
|
|
2998
|
+
z14.object({
|
|
2999
|
+
predictions: z14.array(z14.object({ bytesBase64Encoded: z14.string() })).default([])
|
|
2998
3000
|
})
|
|
2999
3001
|
)
|
|
3000
3002
|
);
|
|
@@ -3008,12 +3010,12 @@ import {
|
|
|
3008
3010
|
convertInlineFileDataToUint8Array,
|
|
3009
3011
|
createJsonResponseHandler as createJsonResponseHandler4,
|
|
3010
3012
|
delay,
|
|
3011
|
-
lazySchema as
|
|
3013
|
+
lazySchema as lazySchema14,
|
|
3012
3014
|
parseProviderOptions as parseProviderOptions4,
|
|
3013
|
-
zodSchema as
|
|
3015
|
+
zodSchema as zodSchema14,
|
|
3014
3016
|
getFromApi
|
|
3015
3017
|
} from "@ai-sdk/provider-utils";
|
|
3016
|
-
import { z as
|
|
3018
|
+
import { z as z15 } from "zod/v4";
|
|
3017
3019
|
var GoogleFiles = class {
|
|
3018
3020
|
constructor(config) {
|
|
3019
3021
|
this.config = config;
|
|
@@ -3136,28 +3138,28 @@ var GoogleFiles = class {
|
|
|
3136
3138
|
};
|
|
3137
3139
|
}
|
|
3138
3140
|
};
|
|
3139
|
-
var googleFileResponseSchema =
|
|
3140
|
-
() =>
|
|
3141
|
-
|
|
3142
|
-
name:
|
|
3143
|
-
displayName:
|
|
3144
|
-
mimeType:
|
|
3145
|
-
sizeBytes:
|
|
3146
|
-
createTime:
|
|
3147
|
-
updateTime:
|
|
3148
|
-
expirationTime:
|
|
3149
|
-
sha256Hash:
|
|
3150
|
-
uri:
|
|
3151
|
-
state:
|
|
3141
|
+
var googleFileResponseSchema = lazySchema14(
|
|
3142
|
+
() => zodSchema14(
|
|
3143
|
+
z15.object({
|
|
3144
|
+
name: z15.string(),
|
|
3145
|
+
displayName: z15.string().nullish(),
|
|
3146
|
+
mimeType: z15.string(),
|
|
3147
|
+
sizeBytes: z15.string().nullish(),
|
|
3148
|
+
createTime: z15.string().nullish(),
|
|
3149
|
+
updateTime: z15.string().nullish(),
|
|
3150
|
+
expirationTime: z15.string().nullish(),
|
|
3151
|
+
sha256Hash: z15.string().nullish(),
|
|
3152
|
+
uri: z15.string(),
|
|
3153
|
+
state: z15.string()
|
|
3152
3154
|
})
|
|
3153
3155
|
)
|
|
3154
3156
|
);
|
|
3155
|
-
var googleFilesUploadOptionsSchema =
|
|
3156
|
-
() =>
|
|
3157
|
-
|
|
3158
|
-
displayName:
|
|
3159
|
-
pollIntervalMs:
|
|
3160
|
-
pollTimeoutMs:
|
|
3157
|
+
var googleFilesUploadOptionsSchema = lazySchema14(
|
|
3158
|
+
() => zodSchema14(
|
|
3159
|
+
z15.object({
|
|
3160
|
+
displayName: z15.string().nullish(),
|
|
3161
|
+
pollIntervalMs: z15.number().positive().nullish(),
|
|
3162
|
+
pollTimeoutMs: z15.number().positive().nullish()
|
|
3161
3163
|
}).passthrough()
|
|
3162
3164
|
)
|
|
3163
3165
|
);
|
|
@@ -3172,13 +3174,33 @@ import {
|
|
|
3172
3174
|
createJsonResponseHandler as createJsonResponseHandler5,
|
|
3173
3175
|
delay as delay2,
|
|
3174
3176
|
getFromApi as getFromApi2,
|
|
3175
|
-
lazySchema as lazySchema14,
|
|
3176
3177
|
parseProviderOptions as parseProviderOptions5,
|
|
3177
3178
|
postJsonToApi as postJsonToApi4,
|
|
3178
|
-
resolve as resolve4
|
|
3179
|
-
zodSchema as zodSchema14
|
|
3179
|
+
resolve as resolve4
|
|
3180
3180
|
} from "@ai-sdk/provider-utils";
|
|
3181
|
-
import { z as
|
|
3181
|
+
import { z as z17 } from "zod/v4";
|
|
3182
|
+
|
|
3183
|
+
// src/google-video-model-options.ts
|
|
3184
|
+
import { lazySchema as lazySchema15, zodSchema as zodSchema15 } from "@ai-sdk/provider-utils";
|
|
3185
|
+
import { z as z16 } from "zod/v4";
|
|
3186
|
+
var googleVideoModelOptionsSchema = lazySchema15(
|
|
3187
|
+
() => zodSchema15(
|
|
3188
|
+
z16.object({
|
|
3189
|
+
pollIntervalMs: z16.number().positive().nullish(),
|
|
3190
|
+
pollTimeoutMs: z16.number().positive().nullish(),
|
|
3191
|
+
personGeneration: z16.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
|
3192
|
+
negativePrompt: z16.string().nullish(),
|
|
3193
|
+
referenceImages: z16.array(
|
|
3194
|
+
z16.object({
|
|
3195
|
+
bytesBase64Encoded: z16.string().nullish(),
|
|
3196
|
+
gcsUri: z16.string().nullish()
|
|
3197
|
+
})
|
|
3198
|
+
).nullish()
|
|
3199
|
+
}).passthrough()
|
|
3200
|
+
)
|
|
3201
|
+
);
|
|
3202
|
+
|
|
3203
|
+
// src/google-video-model.ts
|
|
3182
3204
|
var GoogleVideoModel = class {
|
|
3183
3205
|
constructor(modelId, config) {
|
|
3184
3206
|
this.modelId = modelId;
|
|
@@ -3390,42 +3412,26 @@ var GoogleVideoModel = class {
|
|
|
3390
3412
|
};
|
|
3391
3413
|
}
|
|
3392
3414
|
};
|
|
3393
|
-
var googleOperationSchema =
|
|
3394
|
-
name:
|
|
3395
|
-
done:
|
|
3396
|
-
error:
|
|
3397
|
-
code:
|
|
3398
|
-
message:
|
|
3399
|
-
status:
|
|
3415
|
+
var googleOperationSchema = z17.object({
|
|
3416
|
+
name: z17.string().nullish(),
|
|
3417
|
+
done: z17.boolean().nullish(),
|
|
3418
|
+
error: z17.object({
|
|
3419
|
+
code: z17.number().nullish(),
|
|
3420
|
+
message: z17.string(),
|
|
3421
|
+
status: z17.string().nullish()
|
|
3400
3422
|
}).nullish(),
|
|
3401
|
-
response:
|
|
3402
|
-
generateVideoResponse:
|
|
3403
|
-
generatedSamples:
|
|
3404
|
-
|
|
3405
|
-
video:
|
|
3406
|
-
uri:
|
|
3423
|
+
response: z17.object({
|
|
3424
|
+
generateVideoResponse: z17.object({
|
|
3425
|
+
generatedSamples: z17.array(
|
|
3426
|
+
z17.object({
|
|
3427
|
+
video: z17.object({
|
|
3428
|
+
uri: z17.string().nullish()
|
|
3407
3429
|
}).nullish()
|
|
3408
3430
|
})
|
|
3409
3431
|
).nullish()
|
|
3410
3432
|
}).nullish()
|
|
3411
3433
|
}).nullish()
|
|
3412
3434
|
});
|
|
3413
|
-
var googleVideoModelOptionsSchema = lazySchema14(
|
|
3414
|
-
() => zodSchema14(
|
|
3415
|
-
z15.object({
|
|
3416
|
-
pollIntervalMs: z15.number().positive().nullish(),
|
|
3417
|
-
pollTimeoutMs: z15.number().positive().nullish(),
|
|
3418
|
-
personGeneration: z15.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
|
3419
|
-
negativePrompt: z15.string().nullish(),
|
|
3420
|
-
referenceImages: z15.array(
|
|
3421
|
-
z15.object({
|
|
3422
|
-
bytesBase64Encoded: z15.string().nullish(),
|
|
3423
|
-
gcsUri: z15.string().nullish()
|
|
3424
|
-
})
|
|
3425
|
-
).nullish()
|
|
3426
|
-
}).passthrough()
|
|
3427
|
-
)
|
|
3428
|
-
);
|
|
3429
3435
|
|
|
3430
3436
|
// src/google-provider.ts
|
|
3431
3437
|
function createGoogle(options = {}) {
|