@ai-sdk/google 4.0.0-beta.35 → 4.0.0-beta.36
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 +6 -0
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -2
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +10 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +10 -1
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/google-generative-ai-language-model.ts +8 -1
- package/src/google-generative-ai-options.ts +7 -0
package/package.json
CHANGED
|
@@ -41,6 +41,7 @@ import { googleFailedResponseHandler } from './google-error';
|
|
|
41
41
|
import {
|
|
42
42
|
GoogleGenerativeAIModelId,
|
|
43
43
|
googleLanguageModelOptions,
|
|
44
|
+
VertexServiceTierMap,
|
|
44
45
|
} from './google-generative-ai-options';
|
|
45
46
|
import { GoogleGenerativeAIProviderMetadata } from './google-generative-ai-prompt';
|
|
46
47
|
import { prepareTools } from './google-prepare-tools';
|
|
@@ -152,6 +153,12 @@ export class GoogleGenerativeAILanguageModel implements LanguageModelV4 {
|
|
|
152
153
|
});
|
|
153
154
|
}
|
|
154
155
|
|
|
156
|
+
// Vertex API requires another service tier format.
|
|
157
|
+
let sanitizedServiceTier: string | undefined = googleOptions?.serviceTier;
|
|
158
|
+
if (googleOptions?.serviceTier && isVertexProvider) {
|
|
159
|
+
sanitizedServiceTier = VertexServiceTierMap[googleOptions.serviceTier];
|
|
160
|
+
}
|
|
161
|
+
|
|
155
162
|
const isGemmaModel = this.modelId.toLowerCase().startsWith('gemma-');
|
|
156
163
|
const supportsFunctionResponseParts = this.modelId.startsWith('gemini-3');
|
|
157
164
|
|
|
@@ -253,7 +260,7 @@ export class GoogleGenerativeAILanguageModel implements LanguageModelV4 {
|
|
|
253
260
|
toolConfig,
|
|
254
261
|
cachedContent: googleOptions?.cachedContent,
|
|
255
262
|
labels: googleOptions?.labels,
|
|
256
|
-
serviceTier:
|
|
263
|
+
serviceTier: sanitizedServiceTier,
|
|
257
264
|
},
|
|
258
265
|
warnings: [...warnings, ...toolWarnings],
|
|
259
266
|
providerOptionsName,
|
|
@@ -212,3 +212,10 @@ export const googleLanguageModelOptions = lazySchema(() =>
|
|
|
212
212
|
export type GoogleLanguageModelOptions = InferSchema<
|
|
213
213
|
typeof googleLanguageModelOptions
|
|
214
214
|
>;
|
|
215
|
+
|
|
216
|
+
// Vertex API requires another service tier format.
|
|
217
|
+
export const VertexServiceTierMap = {
|
|
218
|
+
standard: 'SERVICE_TIER_STANDARD',
|
|
219
|
+
flex: 'SERVICE_TIER_FLEX',
|
|
220
|
+
priority: 'SERVICE_TIER_PRIORITY',
|
|
221
|
+
} as const;
|