Feature/custom model name for gemini (#3088)

custom model name for gemini
This commit is contained in:
Henry Heng 2024-08-26 16:11:54 +01:00 committed by GitHub
parent 75f779f861
commit a781576f16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 2 deletions

View File

@ -21,7 +21,7 @@ class GoogleGenerativeAI_ChatModels implements INode {
constructor() { constructor() {
this.label = 'ChatGoogleGenerativeAI' this.label = 'ChatGoogleGenerativeAI'
this.name = 'chatGoogleGenerativeAI' this.name = 'chatGoogleGenerativeAI'
this.version = 2.0 this.version = 2.1
this.type = 'ChatGoogleGenerativeAI' this.type = 'ChatGoogleGenerativeAI'
this.icon = 'GoogleGemini.svg' this.icon = 'GoogleGemini.svg'
this.category = 'Chat Models' this.category = 'Chat Models'
@ -49,6 +49,14 @@ class GoogleGenerativeAI_ChatModels implements INode {
loadMethod: 'listModels', loadMethod: 'listModels',
default: 'gemini-pro' default: 'gemini-pro'
}, },
{
label: 'Custom Model Name',
name: 'customModelName',
type: 'string',
placeholder: 'gemini-1.5-pro-exp-0801',
description: 'Custom model name to use. If provided, it will override the model selected',
additionalParams: true
},
{ {
label: 'Temperature', label: 'Temperature',
name: 'temperature', name: 'temperature',
@ -165,6 +173,7 @@ class GoogleGenerativeAI_ChatModels implements INode {
const temperature = nodeData.inputs?.temperature as string const temperature = nodeData.inputs?.temperature as string
const modelName = nodeData.inputs?.modelName as string const modelName = nodeData.inputs?.modelName as string
const customModelName = nodeData.inputs?.customModelName as string
const maxOutputTokens = nodeData.inputs?.maxOutputTokens as string const maxOutputTokens = nodeData.inputs?.maxOutputTokens as string
const topP = nodeData.inputs?.topP as string const topP = nodeData.inputs?.topP as string
const topK = nodeData.inputs?.topK as string const topK = nodeData.inputs?.topK as string
@ -177,7 +186,7 @@ class GoogleGenerativeAI_ChatModels implements INode {
const obj: Partial<GoogleGenerativeAIChatInput> = { const obj: Partial<GoogleGenerativeAIChatInput> = {
apiKey: apiKey, apiKey: apiKey,
modelName: modelName, modelName: customModelName || modelName,
streaming: streaming ?? true streaming: streaming ?? true
} }