@ai-sdk/google 2.0.66 → 2.0.68
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 +12 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +8 -0
- package/dist/internal/index.d.ts +8 -0
- package/dist/internal/index.js +22 -3
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +22 -3
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "2.0.
|
|
10
|
+
var VERSION = true ? "2.0.68" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -712,6 +712,11 @@ var googleGenerativeAIProviderOptions = lazySchema4(
|
|
|
712
712
|
})
|
|
713
713
|
)
|
|
714
714
|
);
|
|
715
|
+
var VertexServiceTierMap = {
|
|
716
|
+
standard: "SERVICE_TIER_STANDARD",
|
|
717
|
+
flex: "SERVICE_TIER_FLEX",
|
|
718
|
+
priority: "SERVICE_TIER_PRIORITY"
|
|
719
|
+
};
|
|
715
720
|
|
|
716
721
|
// src/google-prepare-tools.ts
|
|
717
722
|
import {
|
|
@@ -978,14 +983,19 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
978
983
|
providerOptions,
|
|
979
984
|
schema: googleGenerativeAIProviderOptions
|
|
980
985
|
});
|
|
986
|
+
const isVertexProvider = this.config.provider.startsWith("google.vertex.");
|
|
981
987
|
if ((tools == null ? void 0 : tools.some(
|
|
982
988
|
(tool) => tool.type === "provider-defined" && tool.id === "google.vertex_rag_store"
|
|
983
|
-
)) && !
|
|
989
|
+
)) && !isVertexProvider) {
|
|
984
990
|
warnings.push({
|
|
985
991
|
type: "other",
|
|
986
992
|
message: `The 'vertex_rag_store' tool is only supported with the Google Vertex provider and might not be supported or could behave unexpectedly with the current Google provider (${this.config.provider}).`
|
|
987
993
|
});
|
|
988
994
|
}
|
|
995
|
+
let sanitizedServiceTier = googleOptions == null ? void 0 : googleOptions.serviceTier;
|
|
996
|
+
if ((googleOptions == null ? void 0 : googleOptions.serviceTier) && isVertexProvider) {
|
|
997
|
+
sanitizedServiceTier = VertexServiceTierMap[googleOptions.serviceTier];
|
|
998
|
+
}
|
|
989
999
|
const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
|
|
990
1000
|
const supportsFunctionResponseParts = this.modelId.startsWith("gemini-3");
|
|
991
1001
|
const { contents, systemInstruction } = convertToGoogleGenerativeAIMessages(
|
|
@@ -1042,7 +1052,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1042
1052
|
} : googleToolConfig,
|
|
1043
1053
|
cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
|
|
1044
1054
|
labels: googleOptions == null ? void 0 : googleOptions.labels,
|
|
1045
|
-
serviceTier:
|
|
1055
|
+
serviceTier: sanitizedServiceTier
|
|
1046
1056
|
},
|
|
1047
1057
|
warnings: [...warnings, ...toolWarnings]
|
|
1048
1058
|
};
|
|
@@ -1630,6 +1640,12 @@ var getSafetyRatingSchema = () => z5.object({
|
|
|
1630
1640
|
severityScore: z5.number().nullish(),
|
|
1631
1641
|
blocked: z5.boolean().nullish()
|
|
1632
1642
|
});
|
|
1643
|
+
var tokenDetailsSchema = z5.array(
|
|
1644
|
+
z5.object({
|
|
1645
|
+
modality: z5.string(),
|
|
1646
|
+
tokenCount: z5.number()
|
|
1647
|
+
})
|
|
1648
|
+
).nullish();
|
|
1633
1649
|
var usageSchema = z5.object({
|
|
1634
1650
|
cachedContentTokenCount: z5.number().nullish(),
|
|
1635
1651
|
thoughtsTokenCount: z5.number().nullish(),
|
|
@@ -1637,7 +1653,10 @@ var usageSchema = z5.object({
|
|
|
1637
1653
|
candidatesTokenCount: z5.number().nullish(),
|
|
1638
1654
|
totalTokenCount: z5.number().nullish(),
|
|
1639
1655
|
// https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType
|
|
1640
|
-
trafficType: z5.string().nullish()
|
|
1656
|
+
trafficType: z5.string().nullish(),
|
|
1657
|
+
// https://ai.google.dev/api/generate-content#Modality
|
|
1658
|
+
promptTokensDetails: tokenDetailsSchema,
|
|
1659
|
+
candidatesTokensDetails: tokenDetailsSchema
|
|
1641
1660
|
});
|
|
1642
1661
|
var getUrlContextMetadataSchema = () => z5.object({
|
|
1643
1662
|
urlMetadata: z5.array(
|