@ai-sdk/google 2.0.68 → 2.0.70
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 +13 -0
- package/README.md +2 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +16 -4
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +16 -4
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { Resolvable, FetchFunction, InferValidator } from '@ai-sdk/provider-util
|
|
|
3
3
|
import { LanguageModelV2 } from '@ai-sdk/provider';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
|
|
6
|
-
type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-
|
|
6
|
+
type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'gemini-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
|
7
7
|
|
|
8
8
|
type GoogleGenerativeAIConfig = {
|
|
9
9
|
provider: string;
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Resolvable, FetchFunction, InferValidator } from '@ai-sdk/provider-util
|
|
|
3
3
|
import { LanguageModelV2 } from '@ai-sdk/provider';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
|
|
6
|
-
type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-
|
|
6
|
+
type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'gemini-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
|
7
7
|
|
|
8
8
|
type GoogleGenerativeAIConfig = {
|
|
9
9
|
provider: string;
|
package/dist/internal/index.js
CHANGED
|
@@ -656,6 +656,7 @@ function prepareTools({
|
|
|
656
656
|
};
|
|
657
657
|
}
|
|
658
658
|
const functionDeclarations = [];
|
|
659
|
+
let hasStrictTools = false;
|
|
659
660
|
for (const tool of tools) {
|
|
660
661
|
switch (tool.type) {
|
|
661
662
|
case "function":
|
|
@@ -664,6 +665,9 @@ function prepareTools({
|
|
|
664
665
|
description: (_a = tool.description) != null ? _a : "",
|
|
665
666
|
parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
|
|
666
667
|
});
|
|
668
|
+
if (tool.strict === true) {
|
|
669
|
+
hasStrictTools = true;
|
|
670
|
+
}
|
|
667
671
|
break;
|
|
668
672
|
default:
|
|
669
673
|
toolWarnings.push({ type: "unsupported-tool", tool });
|
|
@@ -673,7 +677,7 @@ function prepareTools({
|
|
|
673
677
|
if (toolChoice == null) {
|
|
674
678
|
return {
|
|
675
679
|
tools: [{ functionDeclarations }],
|
|
676
|
-
toolConfig: void 0,
|
|
680
|
+
toolConfig: hasStrictTools ? { functionCallingConfig: { mode: "VALIDATED" } } : void 0,
|
|
677
681
|
toolWarnings
|
|
678
682
|
};
|
|
679
683
|
}
|
|
@@ -682,7 +686,11 @@ function prepareTools({
|
|
|
682
686
|
case "auto":
|
|
683
687
|
return {
|
|
684
688
|
tools: [{ functionDeclarations }],
|
|
685
|
-
toolConfig: {
|
|
689
|
+
toolConfig: {
|
|
690
|
+
functionCallingConfig: {
|
|
691
|
+
mode: hasStrictTools ? "VALIDATED" : "AUTO"
|
|
692
|
+
}
|
|
693
|
+
},
|
|
686
694
|
toolWarnings
|
|
687
695
|
};
|
|
688
696
|
case "none":
|
|
@@ -694,7 +702,11 @@ function prepareTools({
|
|
|
694
702
|
case "required":
|
|
695
703
|
return {
|
|
696
704
|
tools: [{ functionDeclarations }],
|
|
697
|
-
toolConfig: {
|
|
705
|
+
toolConfig: {
|
|
706
|
+
functionCallingConfig: {
|
|
707
|
+
mode: hasStrictTools ? "VALIDATED" : "ANY"
|
|
708
|
+
}
|
|
709
|
+
},
|
|
698
710
|
toolWarnings
|
|
699
711
|
};
|
|
700
712
|
case "tool":
|
|
@@ -702,7 +714,7 @@ function prepareTools({
|
|
|
702
714
|
tools: [{ functionDeclarations }],
|
|
703
715
|
toolConfig: {
|
|
704
716
|
functionCallingConfig: {
|
|
705
|
-
mode: "ANY",
|
|
717
|
+
mode: hasStrictTools ? "VALIDATED" : "ANY",
|
|
706
718
|
allowedFunctionNames: [toolChoice.toolName]
|
|
707
719
|
}
|
|
708
720
|
},
|