@@ -114,6 +114,16 @@ export interface GoogleGenerativeAIChatInput extends BaseChatModelParams {
114
114
*/
115
115
apiKey ?: string ;
116
116
117
+ /**
118
+ * Google API version to use
119
+ */
120
+ apiVersion ?: string ;
121
+
122
+ /**
123
+ * Google API base URL to use
124
+ */
125
+ baseUrl ?: string ;
126
+
117
127
/** Whether to stream the results or not */
118
128
streaming ?: boolean ;
119
129
}
@@ -181,6 +191,10 @@ export class ChatGoogleGenerativeAI
181
191
182
192
apiKey ?: string ;
183
193
194
+ apiVersion ?: string = "v1" ;
195
+
196
+ baseUrl ?: string = "https://generativeai.googleapis.com" ;
197
+
184
198
streaming = false ;
185
199
186
200
private client : GenerativeModel ;
@@ -249,18 +263,24 @@ export class ChatGoogleGenerativeAI
249
263
250
264
this . streaming = fields ?. streaming ?? this . streaming ;
251
265
252
- this . client = new GenerativeAI ( this . apiKey ) . getGenerativeModel ( {
253
- model : this . model ,
254
- safetySettings : this . safetySettings as SafetySetting [ ] ,
255
- generationConfig : {
256
- candidateCount : 1 ,
257
- stopSequences : this . stopSequences ,
258
- maxOutputTokens : this . maxOutputTokens ,
259
- temperature : this . temperature ,
260
- topP : this . topP ,
261
- topK : this . topK ,
266
+ this . client = new GenerativeAI ( this . apiKey ) . getGenerativeModel (
267
+ {
268
+ model : this . model ,
269
+ safetySettings : this . safetySettings as SafetySetting [ ] ,
270
+ generationConfig : {
271
+ candidateCount : 1 ,
272
+ stopSequences : this . stopSequences ,
273
+ maxOutputTokens : this . maxOutputTokens ,
274
+ temperature : this . temperature ,
275
+ topP : this . topP ,
276
+ topK : this . topK ,
277
+ } ,
262
278
} ,
263
- } ) ;
279
+ {
280
+ apiVersion : this . apiVersion ,
281
+ baseUrl : this . baseUrl ,
282
+ }
283
+ ) ;
264
284
}
265
285
266
286
_combineLLMOutput ( ) {
0 commit comments