Support custom base URL for ChatGoogleGenerativeAI (#4347)

feat: Support custom base URL for ChatGoogleGenerativeAI
This commit is contained in:
Hans
2025-04-27 12:15:17 +08:00
committed by GitHub
parent ac0450523a
commit fc6eea7653
2 changed files with 29 additions and 12 deletions
@@ -163,6 +163,14 @@ class GoogleGenerativeAI_ChatModels implements INode {
optional: true,
additionalParams: true
},
{
label: 'Base URL',
name: 'baseUrl',
type: 'string',
description: 'Base URL for the API. Leave empty to use the default.',
optional: true,
additionalParams: true
},
{
label: 'Allow Image Uploads',
name: 'allowImageUploads',
@@ -197,6 +205,7 @@ class GoogleGenerativeAI_ChatModels implements INode {
const cache = nodeData.inputs?.cache as BaseCache
const contextCache = nodeData.inputs?.contextCache as FlowiseGoogleAICacheManager
const streaming = nodeData.inputs?.streaming as boolean
const baseUrl = nodeData.inputs?.baseUrl as string | undefined
const allowImageUploads = nodeData.inputs?.allowImageUploads as boolean
@@ -211,6 +220,7 @@ class GoogleGenerativeAI_ChatModels implements INode {
if (topK) obj.topK = parseFloat(topK)
if (cache) obj.cache = cache
if (temperature) obj.temperature = parseFloat(temperature)
if (baseUrl) obj.baseUrl = baseUrl
// Safety Settings
let harmCategories: string[] = convertMultiOptionsToStringArray(harmCategory)