Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ai-sdk/google

Package Overview
Dependencies
Maintainers
3
Versions
514
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/google - npm Package Compare versions

Comparing version
3.0.77
to
3.0.78
+12
-0
CHANGELOG.md
# @ai-sdk/google
## 3.0.78
### Patch Changes
- cf63828: fix(google): read `serviceTier` from `usageMetadata.serviceTier` in both generate and stream paths
The previous implementation read `serviceTier` from the `x-gemini-service-tier`
response header, which is only populated on non-streaming responses. Gemini
streaming includes the value in `usageMetadata.serviceTier` on every chunk, so
`providerMetadata.google.serviceTier` was always `null` for streams. Read from
`usageMetadata` for both paths instead.
## 3.0.77

@@ -4,0 +16,0 @@

+1
-0

@@ -174,2 +174,3 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';

trafficType?: string | null | undefined;
serviceTier?: string | null | undefined;
promptTokensDetails?: {

@@ -176,0 +177,0 @@ modality: string;

@@ -174,2 +174,3 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';

trafficType?: string | null | undefined;
serviceTier?: string | null | undefined;
promptTokensDetails?: {

@@ -176,0 +177,0 @@ modality: string;

@@ -209,2 +209,3 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';

trafficType?: string | null | undefined;
serviceTier?: string | null | undefined;
promptTokensDetails?: {

@@ -211,0 +212,0 @@ modality: string;

@@ -209,2 +209,3 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';

trafficType?: string | null | undefined;
serviceTier?: string | null | undefined;
promptTokensDetails?: {

@@ -211,0 +212,0 @@ modality: string;

+1
-1
{
"name": "@ai-sdk/google",
"version": "3.0.77",
"version": "3.0.78",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -15,2 +15,3 @@ import type { LanguageModelV3Usage } from '@ai-sdk/provider';

trafficType?: string | null;
serviceTier?: string | null;
promptTokensDetails?: GoogleGenerativeAITokenDetail[] | null;

@@ -17,0 +18,0 @@ candidatesTokensDetails?: GoogleGenerativeAITokenDetail[] | null;

@@ -501,3 +501,3 @@ import type {

finishMessage: candidate.finishMessage ?? null,
serviceTier: responseHeaders?.['x-gemini-service-tier'] ?? null,
serviceTier: usageMetadata?.serviceTier ?? null,
} satisfies GoogleGenerativeAIProviderMetadata,

@@ -546,4 +546,2 @@ },

let lastUrlContextMetadata: UrlContextMetadataSchema | null = null;
const serviceTier: string | null =
responseHeaders?.['x-gemini-service-tier'] ?? null;

@@ -1048,3 +1046,3 @@ const generateId = this.config.generateId;

finishMessage: candidate.finishMessage ?? null,
serviceTier,
serviceTier: usage?.serviceTier ?? null,
} satisfies GoogleGenerativeAIProviderMetadata,

@@ -1395,2 +1393,3 @@ };

trafficType: z.string().nullish(),
serviceTier: z.string().nullish(),
// https://ai.google.dev/api/generate-content#Modality

@@ -1397,0 +1396,0 @@ promptTokensDetails: tokenDetailsSchema,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display