mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 09:01:09 +03:00
Support cache system instructs for Google GenAI (#4148)
* Support cache system instructs for Google GenAI * format code * Update FlowiseGoogleAICacheManager.ts --------- Co-authored-by: Henry Heng <henryheng@flowiseai.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import { ICommonObject, IMultiModalOption, INode, INodeData, INodeOptionsValue,
|
||||
import { convertMultiOptionsToStringArray, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||
import { getModels, MODEL_TYPE } from '../../../src/modelLoader'
|
||||
import { ChatGoogleGenerativeAI, GoogleGenerativeAIChatInput } from './FlowiseChatGoogleGenerativeAI'
|
||||
import type FlowiseGoogleAICacheManager from '../../cache/GoogleGenerativeAIContextCache/FlowiseGoogleAICacheManager'
|
||||
|
||||
class GoogleGenerativeAI_ChatModels implements INode {
|
||||
label: string
|
||||
@@ -42,6 +43,12 @@ class GoogleGenerativeAI_ChatModels implements INode {
|
||||
type: 'BaseCache',
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Context Cache',
|
||||
name: 'contextCache',
|
||||
type: 'GoogleAICacheManager',
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Model Name',
|
||||
name: 'modelName',
|
||||
@@ -188,6 +195,7 @@ class GoogleGenerativeAI_ChatModels implements INode {
|
||||
const harmCategory = nodeData.inputs?.harmCategory as string
|
||||
const harmBlockThreshold = nodeData.inputs?.harmBlockThreshold as string
|
||||
const cache = nodeData.inputs?.cache as BaseCache
|
||||
const contextCache = nodeData.inputs?.contextCache as FlowiseGoogleAICacheManager
|
||||
const streaming = nodeData.inputs?.streaming as boolean
|
||||
|
||||
const allowImageUploads = nodeData.inputs?.allowImageUploads as boolean
|
||||
@@ -225,6 +233,7 @@ class GoogleGenerativeAI_ChatModels implements INode {
|
||||
|
||||
const model = new ChatGoogleGenerativeAI(nodeData.id, obj)
|
||||
model.setMultiModalOption(multiModalOption)
|
||||
if (contextCache) model.setContextCache(contextCache)
|
||||
|
||||
return model
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user