@ai-sdk/google 4.0.107 → 4.0.109
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 +34 -0
- package/dist/index.d.ts +11 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +262 -113
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +9 -0
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +249 -99
- package/dist/internal/index.js.map +1 -1
- package/docs/15-google.mdx +27 -3
- package/package.json +3 -3
- package/src/convert-to-google-messages.ts +16 -5
- package/src/google-batch.ts +3 -4
- package/src/google-embedding-model.ts +2 -1
- package/src/google-files.ts +7 -7
- package/src/google-json-accumulator.ts +26 -14
- package/src/google-language-model.ts +42 -90
- package/src/google-model-capabilities.ts +7 -40
- package/src/google-model-catalog.ts +319 -0
- package/src/google-prompt.ts +15 -0
- package/src/google-provider.ts +15 -11
- package/src/index.ts +1 -0
- package/src/interactions/cancel-google-interaction.ts +7 -2
- package/src/interactions/google-interactions-language-model.ts +8 -12
- package/src/interactions/poll-google-interactions.ts +4 -2
- package/src/interactions/stream-google-interactions.ts +4 -7
- package/src/realtime/google-realtime-model.ts +7 -3
- package/src/speech-translation/google-speech-translation-model.ts +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 4.0.109
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7716e18: Support promises and synchronous or asynchronous callbacks in provider API key and token settings. Resolve credentials per authenticated request while preserving existing authentication behavior and synchronous credential serialization.
|
|
8
|
+
|
|
9
|
+
The experimental OpenAI Live `getServerWebSocketConfig()` method can now resolve asynchronously. Await its result before using the connection settings.
|
|
10
|
+
|
|
11
|
+
- dfed8e8: Consolidate Google language model capabilities and request policies into a model catalog shared by runtime resolution and generated documentation, preserving existing Google and Vertex request behavior.
|
|
12
|
+
- Updated dependencies [7716e18]
|
|
13
|
+
- Updated dependencies [5c247e9]
|
|
14
|
+
- Updated dependencies [dcd2f8d]
|
|
15
|
+
- @ai-sdk/provider-utils@5.0.72
|
|
16
|
+
- @ai-sdk/provider@4.0.35
|
|
17
|
+
|
|
18
|
+
## 4.0.108
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 9f108f8: close string values in tool-call input streamed with `streamFunctionCallArguments` on their final chunk
|
|
23
|
+
- b1bcea1: Add videoMetadata support for file parts. Pass startOffset, endOffset, and fps through per-file providerOptions to control video clipping and frame rate with the Google and Google Vertex providers.
|
|
24
|
+
- 61a315e: fix: map the top-level `reasoning` option consistently across providers
|
|
25
|
+
|
|
26
|
+
Providers now resolve reasoning the same way:
|
|
27
|
+
|
|
28
|
+
1. A provider-specific reasoning setting in `providerOptions` is sent unchanged. OpenAI no longer drops `providerOptions.openai.reasoningEffort` values that are not in its list for the model, and Fireworks no longer rewrites `providerOptions.fireworks.reasoningEffort`. Fireworks also sends top-level `reasoning` values directly instead of rounding them to `'high'` at most, except for model families known to reject `'none'` (GPT-OSS, GLM-5.3, Muse Spark) or `'minimal'` (Nemotron, Inkling).
|
|
29
|
+
2. Otherwise, `reasoning` maps to the closest level the model supports, rounding down, and rounds up only when there is no lower level. For example, `'xhigh'` now maps to `'high'` instead of `'max'` on Anthropic and Bedrock models without `xhigh` effort, and `'medium'` maps to `'low'` instead of `'high'` on DeepSeek, Kimi K3, and Mistral GLM-5.3 models.
|
|
30
|
+
3. `'none'` on a model that cannot disable reasoning maps to the model's lowest level with a compatibility warning, instead of being dropped or sending a request the API rejects. This affects GPT-6 models without `'none'`, xAI grok-4.5 and later, Groq GPT-OSS, Kimi K3, Perplexity, QuiverAI, Bedrock OpenAI `gpt-oss` models, and Gemini 2.5 Pro (minimum thinking budget). Gemini 3 and Anthropic and Bedrock `between_tools` mappings now emit the compatibility warning too.
|
|
31
|
+
|
|
32
|
+
`mapReasoningToProviderEffort` now accepts any `reasoning` value, returns an optional `providerOptionsEffort` unchanged, and rounds levels that are missing from the effort map to the closest supported level. `mapReasoningToProviderBudget` maps `'none'` to the minimum reasoning budget, always returns a budget, and uses the default percentage for levels missing from `budgetPercentages`. `OpenAICompatibleChatConfig` adds an optional `mapReasoning` function for mapping the top-level `reasoning` option.
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [61a315e]
|
|
35
|
+
- @ai-sdk/provider-utils@5.0.71
|
|
36
|
+
|
|
3
37
|
## 4.0.107
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -235,6 +235,13 @@ type PromptFeedbackSchema = NonNullable<InferSchema<typeof responseSchema>['prom
|
|
|
235
235
|
type UsageMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['usageMetadata']>;
|
|
236
236
|
//#endregion
|
|
237
237
|
//#region src/google-prompt.d.ts
|
|
238
|
+
declare const googleVideoMetadataSchema: z.ZodObject<{
|
|
239
|
+
startOffset: z.ZodOptional<z.ZodString>;
|
|
240
|
+
endOffset: z.ZodOptional<z.ZodString>;
|
|
241
|
+
fps: z.ZodOptional<z.ZodNumber>;
|
|
242
|
+
}, z.core.$strip>;
|
|
243
|
+
/** Metadata for preprocessing video file parts. */
|
|
244
|
+
type GoogleVideoMetadata = z.infer<typeof googleVideoMetadataSchema>;
|
|
238
245
|
type GoogleGroundingMetadata = GroundingMetadataSchema;
|
|
239
246
|
type GoogleUrlContextMetadata = UrlContextMetadataSchema;
|
|
240
247
|
type GoogleSafetyRating = SafetyRatingSchema;
|
|
@@ -747,7 +754,7 @@ interface GoogleProviderSettings {
|
|
|
747
754
|
* API key that is being send using the `x-goog-api-key` header.
|
|
748
755
|
* It defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable.
|
|
749
756
|
*/
|
|
750
|
-
apiKey?: string
|
|
757
|
+
apiKey?: Resolvable<string>;
|
|
751
758
|
/**
|
|
752
759
|
* Custom headers to include in the requests.
|
|
753
760
|
*/
|
|
@@ -785,7 +792,7 @@ export declare const google: GoogleProvider;
|
|
|
785
792
|
type GoogleRealtimeModelConfig = {
|
|
786
793
|
provider: string;
|
|
787
794
|
baseURL: string;
|
|
788
|
-
headers:
|
|
795
|
+
headers: Resolvable<Record<string, string | undefined>>;
|
|
789
796
|
fetch?: FetchFunction;
|
|
790
797
|
};
|
|
791
798
|
declare class GoogleRealtimeModel implements Experimental_RealtimeModelV4 {
|
|
@@ -901,7 +908,7 @@ export declare class GoogleTranscriptionModel implements TranscriptionModelV4 {
|
|
|
901
908
|
type GoogleSpeechTranslationModelConfig = {
|
|
902
909
|
provider: string;
|
|
903
910
|
baseURL: string;
|
|
904
|
-
headers:
|
|
911
|
+
headers: Resolvable<Record<string, string | undefined>>;
|
|
905
912
|
webSocket?: WebSocketConstructor;
|
|
906
913
|
_internal?: {
|
|
907
914
|
currentDate?: () => Date;
|
|
@@ -928,5 +935,5 @@ declare class GoogleSpeechTranslationModel implements Experimental_SpeechTransla
|
|
|
928
935
|
//#region src/version.d.ts
|
|
929
936
|
export declare const VERSION: string;
|
|
930
937
|
//#endregion
|
|
931
|
-
export { GoogleRealtimeModel as Experimental_GoogleRealtimeModel, type GoogleRealtimeModelConfig as Experimental_GoogleRealtimeModelConfig, type GoogleRealtimeModelId as Experimental_GoogleRealtimeModelId, type GoogleRealtimeModelOptions as Experimental_GoogleRealtimeModelOptions, GoogleSpeechTranslationModel as Experimental_GoogleSpeechTranslationModel, GoogleSpeechTranslationModel as Experimental_GoogleTranslationModel, type GoogleSpeechTranslationModelConfig as Experimental_GoogleSpeechTranslationModelConfig, type GoogleSpeechTranslationModelConfig as Experimental_GoogleTranslationModelConfig, type GoogleSpeechTranslationModelId as Experimental_GoogleSpeechTranslationModelId, type GoogleSpeechTranslationModelId as Experimental_GoogleTranslationModelId, type GoogleSpeechTranslationModelOptions as Experimental_GoogleSpeechTranslationModelOptions, type GoogleSpeechTranslationModelOptions as Experimental_GoogleTranslationModelOptions, type GoogleEmbeddingModelOptions, type GoogleEmbeddingModelOptions as GoogleGenerativeAIEmbeddingProviderOptions, type GoogleErrorData, type GoogleFilesUploadOptions, type GoogleImageModelOptions as GoogleGenerativeAIImageProviderOptions, type GoogleImageModelOptions, type GoogleProvider as GoogleGenerativeAIProvider, type GoogleProvider, type GoogleProviderMetadata as GoogleGenerativeAIProviderMetadata, type GoogleProviderMetadata, type GoogleLanguageModelOptions as GoogleGenerativeAIProviderOptions, type GoogleLanguageModelOptions, type GoogleProviderSettings as GoogleGenerativeAIProviderSettings, type GoogleProviderSettings, type GoogleVideoModelId as GoogleGenerativeAIVideoModelId, type GoogleVideoModelId, type GoogleVideoModelOptions as GoogleGenerativeAIVideoProviderOptions, type GoogleVideoModelOptions, type GoogleInteractionsAgentName, type GoogleInteractionsModelId, type GoogleInteractionsProviderMetadata, type GoogleInteractionsVideoOptions, type GoogleLanguageModelInteractionsOptions, type GoogleSpeechModelId, type GoogleSpeechModelOptions, type GoogleTranscriptionModelId, type GoogleTranscriptionModelOptions, createGoogle as createGoogleGenerativeAI };
|
|
938
|
+
export { GoogleRealtimeModel as Experimental_GoogleRealtimeModel, type GoogleRealtimeModelConfig as Experimental_GoogleRealtimeModelConfig, type GoogleRealtimeModelId as Experimental_GoogleRealtimeModelId, type GoogleRealtimeModelOptions as Experimental_GoogleRealtimeModelOptions, GoogleSpeechTranslationModel as Experimental_GoogleSpeechTranslationModel, GoogleSpeechTranslationModel as Experimental_GoogleTranslationModel, type GoogleSpeechTranslationModelConfig as Experimental_GoogleSpeechTranslationModelConfig, type GoogleSpeechTranslationModelConfig as Experimental_GoogleTranslationModelConfig, type GoogleSpeechTranslationModelId as Experimental_GoogleSpeechTranslationModelId, type GoogleSpeechTranslationModelId as Experimental_GoogleTranslationModelId, type GoogleSpeechTranslationModelOptions as Experimental_GoogleSpeechTranslationModelOptions, type GoogleSpeechTranslationModelOptions as Experimental_GoogleTranslationModelOptions, type GoogleEmbeddingModelOptions, type GoogleEmbeddingModelOptions as GoogleGenerativeAIEmbeddingProviderOptions, type GoogleErrorData, type GoogleFilesUploadOptions, type GoogleImageModelOptions as GoogleGenerativeAIImageProviderOptions, type GoogleImageModelOptions, type GoogleProvider as GoogleGenerativeAIProvider, type GoogleProvider, type GoogleProviderMetadata as GoogleGenerativeAIProviderMetadata, type GoogleProviderMetadata, type GoogleLanguageModelOptions as GoogleGenerativeAIProviderOptions, type GoogleLanguageModelOptions, type GoogleProviderSettings as GoogleGenerativeAIProviderSettings, type GoogleProviderSettings, type GoogleVideoModelId as GoogleGenerativeAIVideoModelId, type GoogleVideoModelId, type GoogleVideoModelOptions as GoogleGenerativeAIVideoProviderOptions, type GoogleVideoModelOptions, type GoogleInteractionsAgentName, type GoogleInteractionsModelId, type GoogleInteractionsProviderMetadata, type GoogleInteractionsVideoOptions, type GoogleLanguageModelInteractionsOptions, type GoogleSpeechModelId, type GoogleSpeechModelOptions, type GoogleTranscriptionModelId, type GoogleTranscriptionModelOptions, type GoogleVideoMetadata, createGoogle as createGoogleGenerativeAI };
|
|
932
939
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["DecisionModelV4","BatchV4","SpeechTranslationModelV4","RealtimeFactoryV4","RealtimeModelV4ClientSecretOptions","RealtimeModelV4ClientSecretResult","RealtimeModelV4ServerEvent","RealtimeModelV4ClientEvent","RealtimeModelV4","RealtimeModelV4SessionConfig","TranscriptionModelV4StreamOptions","SpeechTranslationModelV4StreamOptions","SpeechTranslationModelV4"],"sources":["../src/google-error.ts","../src/google-language-model-options.ts","../src/google-language-model.ts","../src/google-prompt.ts","../src/tool/google-search.ts","../src/google-image-model-options.ts","../src/google-embedding-model-options.ts","../src/google-video-model-options.ts","../src/google-video-settings.ts","../src/google-speech-model-options.ts","../src/google-files.ts","../src/interactions/google-interactions-language-model-options.ts","../src/interactions/google-interactions-provider-metadata.ts","../src/interactions/google-interactions-agent.ts","../src/google-tools.ts","../src/google-image-settings.ts","../src/transcription/google-transcription-model-options.ts","../src/speech-translation/google-speech-translation-model-options.ts","../src/google-provider.ts","../src/realtime/google-realtime-model.ts","../src/realtime/google-realtime-model-options.ts","../src/transcription/google-transcription-model.ts","../src/speech-translation/google-speech-translation-model.ts","../src/version.ts"],"mappings":";;;;cAgBM,wDAAqB;;;;;;;;KAQf,kBAAkB,mBAAmB;;;KCjBrC;cAqDC,6DAA0B;;;;;;;;;;;;;;;WAA1B;;;;;;;;;;;;;;;;;;;;;;;;KA+OD,6BAA6B,mBAChC;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["DecisionModelV4","BatchV4","SpeechTranslationModelV4","RealtimeFactoryV4","RealtimeModelV4ClientSecretOptions","RealtimeModelV4ClientSecretResult","RealtimeModelV4ServerEvent","RealtimeModelV4ClientEvent","RealtimeModelV4","RealtimeModelV4SessionConfig","TranscriptionModelV4StreamOptions","SpeechTranslationModelV4StreamOptions","SpeechTranslationModelV4"],"sources":["../src/google-error.ts","../src/google-language-model-options.ts","../src/google-language-model.ts","../src/google-prompt.ts","../src/tool/google-search.ts","../src/google-image-model-options.ts","../src/google-embedding-model-options.ts","../src/google-video-model-options.ts","../src/google-video-settings.ts","../src/google-speech-model-options.ts","../src/google-files.ts","../src/interactions/google-interactions-language-model-options.ts","../src/interactions/google-interactions-provider-metadata.ts","../src/interactions/google-interactions-agent.ts","../src/google-tools.ts","../src/google-image-settings.ts","../src/transcription/google-transcription-model-options.ts","../src/speech-translation/google-speech-translation-model-options.ts","../src/google-provider.ts","../src/realtime/google-realtime-model.ts","../src/realtime/google-realtime-model-options.ts","../src/transcription/google-transcription-model.ts","../src/speech-translation/google-speech-translation-model.ts","../src/version.ts"],"mappings":";;;;cAgBM,wDAAqB;;;;;;;;KAQf,kBAAkB,mBAAmB;;;KCjBrC;cAqDC,6DAA0B;;;;;;;;;;;;;;;WAA1B;;;;;;;;;;;;;;;;;;;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