File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,13 @@ export function getSafetySettings(level: string) {
56
56
} )
57
57
}
58
58
59
+ function canUseSearchAsTool ( model : string ) {
60
+ if ( model . startsWith ( 'gemini-2.0-flash' ) || model . startsWith ( 'gemini-2.0-pro' ) ) {
61
+ if ( model . includes ( 'lite' ) || model . includes ( 'thinking' ) ) return false
62
+ return true
63
+ }
64
+ }
65
+
59
66
export default async function chat ( {
60
67
messages = [ ] ,
61
68
systemInstruction,
@@ -96,13 +103,11 @@ export default async function chat({
96
103
}
97
104
if ( toolConfig ) modelParams . toolConfig = toolConfig
98
105
}
99
- if ( model === 'gemini-2.0-flash-exp' ) {
106
+ if ( canUseSearchAsTool ( model ) ) {
100
107
const officialPlugins = [ { googleSearch : { } } ]
101
108
if ( ! tools ) {
102
109
modelParams . tools = officialPlugins
103
110
}
104
- }
105
- if ( model . startsWith ( 'gemini-2.0-flash-exp' ) ) {
106
111
if ( modelParams . safetySettings ) {
107
112
const safetySettings : NewModelParams [ 'safetySettings' ] = [ ]
108
113
modelParams . safetySettings . forEach ( ( item ) => {
You can’t perform that action at this time.
0 commit comments