@ai-sdk/google
Advanced tools
+14
-0
@@ -178,2 +178,3 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils'; | ||
| usageMetadata?: { | ||
| [x: string]: unknown; | ||
| cachedContentTokenCount?: number | null | undefined; | ||
@@ -183,2 +184,3 @@ thoughtsTokenCount?: number | null | undefined; | ||
| candidatesTokenCount?: number | null | undefined; | ||
| toolUsePromptTokenCount?: number | null | undefined; | ||
| totalTokenCount?: number | null | undefined; | ||
@@ -188,9 +190,21 @@ trafficType?: string | null | undefined; | ||
| promptTokensDetails?: { | ||
| [x: string]: unknown; | ||
| modality: string; | ||
| tokenCount: number; | ||
| }[] | null | undefined; | ||
| cacheTokensDetails?: { | ||
| [x: string]: unknown; | ||
| modality: string; | ||
| tokenCount: number; | ||
| }[] | null | undefined; | ||
| candidatesTokensDetails?: { | ||
| [x: string]: unknown; | ||
| modality: string; | ||
| tokenCount: number; | ||
| }[] | null | undefined; | ||
| toolUsePromptTokensDetails?: { | ||
| [x: string]: unknown; | ||
| modality: string; | ||
| tokenCount: number; | ||
| }[] | null | undefined; | ||
| } | null | undefined; | ||
@@ -197,0 +211,0 @@ promptFeedback?: { |
@@ -354,2 +354,3 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils'; | ||
| usageMetadata?: { | ||
| [x: string]: unknown; | ||
| cachedContentTokenCount?: number | null | undefined; | ||
@@ -359,2 +360,3 @@ thoughtsTokenCount?: number | null | undefined; | ||
| candidatesTokenCount?: number | null | undefined; | ||
| toolUsePromptTokenCount?: number | null | undefined; | ||
| totalTokenCount?: number | null | undefined; | ||
@@ -364,9 +366,21 @@ trafficType?: string | null | undefined; | ||
| promptTokensDetails?: { | ||
| [x: string]: unknown; | ||
| modality: string; | ||
| tokenCount: number; | ||
| }[] | null | undefined; | ||
| cacheTokensDetails?: { | ||
| [x: string]: unknown; | ||
| modality: string; | ||
| tokenCount: number; | ||
| }[] | null | undefined; | ||
| candidatesTokensDetails?: { | ||
| [x: string]: unknown; | ||
| modality: string; | ||
| tokenCount: number; | ||
| }[] | null | undefined; | ||
| toolUsePromptTokensDetails?: { | ||
| [x: string]: unknown; | ||
| modality: string; | ||
| tokenCount: number; | ||
| }[] | null | undefined; | ||
| } | null | undefined; | ||
@@ -373,0 +387,0 @@ promptFeedback?: { |
+1
-1
| { | ||
| "name": "@ai-sdk/google", | ||
| "version": "4.0.55", | ||
| "version": "4.0.56", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -12,2 +12,3 @@ import type { LanguageModelV4Usage } from '@ai-sdk/provider'; | ||
| candidatesTokenCount?: number | null; | ||
| toolUsePromptTokenCount?: number | null; | ||
| totalTokenCount?: number | null; | ||
@@ -19,3 +20,5 @@ cachedContentTokenCount?: number | null; | ||
| promptTokensDetails?: GoogleTokenDetail[] | null; | ||
| cacheTokensDetails?: GoogleTokenDetail[] | null; | ||
| candidatesTokensDetails?: GoogleTokenDetail[] | null; | ||
| toolUsePromptTokensDetails?: GoogleTokenDetail[] | null; | ||
| }; | ||
@@ -22,0 +25,0 @@ |
@@ -65,2 +65,4 @@ import type { | ||
| const gemini25ModelPattern = /(^|\/)gemini-2\.5(?:[.-]|$)/i; | ||
| export type GoogleLanguageModelConfig = { | ||
@@ -262,2 +264,18 @@ provider: string; | ||
| const isGemmaModel = this.modelId.toLowerCase().startsWith('gemma-'); | ||
| const isGemini25DeveloperApiModel = | ||
| !isVertexProvider && gemini25ModelPattern.test(this.modelId); | ||
| if (isGemini25DeveloperApiModel && frequencyPenalty != null) { | ||
| warnings.push({ | ||
| type: 'unsupported', | ||
| feature: 'frequencyPenalty', | ||
| }); | ||
| } | ||
| if (isGemini25DeveloperApiModel && presencePenalty != null) { | ||
| warnings.push({ | ||
| type: 'unsupported', | ||
| feature: 'presencePenalty', | ||
| }); | ||
| } | ||
| const { usesGemini3Features } = getGoogleModelCapabilities(this.modelId); | ||
@@ -336,4 +354,8 @@ | ||
| topP, | ||
| frequencyPenalty, | ||
| presencePenalty, | ||
| frequencyPenalty: isGemini25DeveloperApiModel | ||
| ? undefined | ||
| : frequencyPenalty, | ||
| presencePenalty: isGemini25DeveloperApiModel | ||
| ? undefined | ||
| : presencePenalty, | ||
| stopSequences, | ||
@@ -1589,22 +1611,29 @@ seed, | ||
| .array( | ||
| z.object({ | ||
| modality: z.string(), | ||
| tokenCount: z.number(), | ||
| }), | ||
| z | ||
| .object({ | ||
| modality: z.string(), | ||
| tokenCount: z.number(), | ||
| }) | ||
| .loose(), | ||
| ) | ||
| .nullish(); | ||
| const usageSchema = z.object({ | ||
| cachedContentTokenCount: z.number().nullish(), | ||
| thoughtsTokenCount: z.number().nullish(), | ||
| promptTokenCount: z.number().nullish(), | ||
| candidatesTokenCount: z.number().nullish(), | ||
| totalTokenCount: z.number().nullish(), | ||
| // https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType | ||
| trafficType: z.string().nullish(), | ||
| serviceTier: z.string().nullish(), | ||
| // https://ai.google.dev/api/generate-content#Modality | ||
| promptTokensDetails: tokenDetailsSchema, | ||
| candidatesTokensDetails: tokenDetailsSchema, | ||
| }); | ||
| const usageSchema = z | ||
| .object({ | ||
| cachedContentTokenCount: z.number().nullish(), | ||
| thoughtsTokenCount: z.number().nullish(), | ||
| promptTokenCount: z.number().nullish(), | ||
| candidatesTokenCount: z.number().nullish(), | ||
| toolUsePromptTokenCount: z.number().nullish(), | ||
| totalTokenCount: z.number().nullish(), | ||
| // https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType | ||
| trafficType: z.string().nullish(), | ||
| serviceTier: z.string().nullish(), | ||
| // https://ai.google.dev/api/generate-content#Modality | ||
| promptTokensDetails: tokenDetailsSchema, | ||
| cacheTokensDetails: tokenDetailsSchema, | ||
| candidatesTokensDetails: tokenDetailsSchema, | ||
| toolUsePromptTokensDetails: tokenDetailsSchema, | ||
| }) | ||
| .loose(); | ||
@@ -1611,0 +1640,0 @@ // https://ai.google.dev/api/generate-content#UrlRetrievalMetadata |
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
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
2320872
0.29%29964
0.3%