@@ -72,17 +72,19 @@ export class GeminiHandler extends BaseProvider implements SingleCompletionHandl
7272 if ( this . options . enableUrlContext ) {
7373 tools . push ( { urlContext : { } } )
7474 }
75+
7576 if ( this . options . enableGrounding ) {
7677 tools . push ( { googleSearch : { } } )
7778 }
78- const rawConfig = {
79+
80+ const config : GenerateContentConfig = {
7981 systemInstruction,
8082 httpOptions : this . options . googleGeminiBaseUrl ? { baseUrl : this . options . googleGeminiBaseUrl } : undefined ,
8183 thinkingConfig,
84+ maxOutputTokens : this . options . modelMaxTokens ?? maxTokens ?? undefined ,
8285 temperature : this . options . modelTemperature ?? 0 ,
8386 ...( tools . length > 0 ? { tools } : { } ) ,
8487 }
85- const config = rawConfig as unknown as GenerateContentConfig
8688
8789 const params : GenerateContentParameters = { model, contents, config }
8890
@@ -207,14 +209,13 @@ export class GeminiHandler extends BaseProvider implements SingleCompletionHandl
207209 if ( this . options . enableGrounding ) {
208210 tools . push ( { googleSearch : { } } )
209211 }
210- const rawPromptConfig = {
212+ const promptConfig : GenerateContentConfig = {
211213 httpOptions : this . options . googleGeminiBaseUrl
212214 ? { baseUrl : this . options . googleGeminiBaseUrl }
213215 : undefined ,
214216 temperature : this . options . modelTemperature ?? 0 ,
215217 ...( tools . length > 0 ? { tools } : { } ) ,
216218 }
217- const promptConfig = rawPromptConfig as unknown as GenerateContentConfig
218219
219220 const result = await this . client . models . generateContent ( {
220221 model,
0 commit comments