@ai-sdk/google 4.0.82 → 4.0.83
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 +20 -0
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/google-image-model.ts +16 -0
- package/src/realtime/google-realtime-event-mapper.ts +16 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/google",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.83",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ai-sdk/provider": "4.0.
|
|
39
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
38
|
+
"@ai-sdk/provider": "4.0.19",
|
|
39
|
+
"@ai-sdk/provider-utils": "5.0.50"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@ai-sdk/test-server": "2.0.2",
|
|
@@ -32,6 +32,12 @@ interface GoogleImageModelConfig {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
const googleImageModelsWithFileInputSupport = new Set<string>([
|
|
36
|
+
'gemini-2.5-flash-image',
|
|
37
|
+
'gemini-3-pro-image-preview',
|
|
38
|
+
'gemini-3.1-flash-image-preview',
|
|
39
|
+
]);
|
|
40
|
+
|
|
35
41
|
export class GoogleImageModel implements ImageModelV4 {
|
|
36
42
|
readonly specificationVersion = 'v4';
|
|
37
43
|
|
|
@@ -56,6 +62,16 @@ export class GoogleImageModel implements ImageModelV4 {
|
|
|
56
62
|
return 1;
|
|
57
63
|
}
|
|
58
64
|
|
|
65
|
+
get supportsFileInputs(): boolean | undefined {
|
|
66
|
+
return googleImageModelsWithFileInputSupport.has(this.modelId)
|
|
67
|
+
? true
|
|
68
|
+
: undefined;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get supportsMaskInputs(): boolean | undefined {
|
|
72
|
+
return this.supportsFileInputs === true ? false : undefined;
|
|
73
|
+
}
|
|
74
|
+
|
|
59
75
|
get provider(): string {
|
|
60
76
|
return this.config.provider;
|
|
61
77
|
}
|
|
@@ -481,14 +481,24 @@ export function buildGoogleSessionConfig(
|
|
|
481
481
|
setup.outputAudioTranscription = {};
|
|
482
482
|
}
|
|
483
483
|
|
|
484
|
-
//
|
|
485
|
-
//
|
|
486
|
-
//
|
|
487
|
-
|
|
484
|
+
// Background-reasoning models require a `thinkingLevel` or `thinkingBudget`.
|
|
485
|
+
// Default to the lowest-latency level when the effective thinking config (the
|
|
486
|
+
// typed option, else a raw `providerOptions.generationConfig.thinkingConfig`)
|
|
487
|
+
// sets neither. Merged last so it survives a raw
|
|
488
|
+
// `providerOptions.generationConfig`.
|
|
489
|
+
const rawGenerationConfig = restProviderOptions.generationConfig;
|
|
490
|
+
const explicitThinkingConfig =
|
|
488
491
|
googleOptions?.thinkingConfig ??
|
|
489
|
-
(
|
|
490
|
-
|
|
492
|
+
(isRecord(rawGenerationConfig) &&
|
|
493
|
+
isRecord(rawGenerationConfig.thinkingConfig)
|
|
494
|
+
? rawGenerationConfig.thinkingConfig
|
|
491
495
|
: undefined);
|
|
496
|
+
const thinkingConfig =
|
|
497
|
+
isThinkingLiveModel(modelId) &&
|
|
498
|
+
explicitThinkingConfig?.thinkingLevel == null &&
|
|
499
|
+
explicitThinkingConfig?.thinkingBudget == null
|
|
500
|
+
? { ...explicitThinkingConfig, thinkingLevel: 'low' as const }
|
|
501
|
+
: googleOptions?.thinkingConfig;
|
|
492
502
|
const applyThinkingConfig = () => {
|
|
493
503
|
if (thinkingConfig == null) return;
|
|
494
504
|
const target = isRecord(setup.generationConfig)
|