mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +03:00
Add input option for Model Name in GoogleVertexAIEmbedding
This commit is contained in:
+28
-2
@@ -33,11 +33,35 @@ class GoogleVertexAIEmbedding_Embeddings implements INode {
|
|||||||
description:
|
description:
|
||||||
'Google Vertex AI credential. If you are using a GCP service like Cloud Run, or if you have installed default credentials on your local machine, you do not need to set this credential.'
|
'Google Vertex AI credential. If you are using a GCP service like Cloud Run, or if you have installed default credentials on your local machine, you do not need to set this credential.'
|
||||||
}
|
}
|
||||||
this.inputs = []
|
this.inputs = [
|
||||||
|
{
|
||||||
|
label: 'Model Name',
|
||||||
|
name: 'modelName',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: 'textembedding-gecko@001',
|
||||||
|
name: 'textembedding-gecko@001'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'textembedding-gecko@latest',
|
||||||
|
name: 'textembedding-gecko@latest'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'textembedding-gecko-multilingual@latest',
|
||||||
|
name: 'textembedding-gecko-multilingual@latest'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
default: 'textembedding-gecko@001',
|
||||||
|
optional: true,
|
||||||
|
additionalParams: true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||||
|
const modelName = nodeData.inputs?.modelName ?? 'textembedding-gecko@001'
|
||||||
const googleApplicationCredentialFilePath = getCredentialParam('googleApplicationCredentialFilePath', credentialData, nodeData)
|
const googleApplicationCredentialFilePath = getCredentialParam('googleApplicationCredentialFilePath', credentialData, nodeData)
|
||||||
const googleApplicationCredential = getCredentialParam('googleApplicationCredential', credentialData, nodeData)
|
const googleApplicationCredential = getCredentialParam('googleApplicationCredential', credentialData, nodeData)
|
||||||
const projectID = getCredentialParam('projectID', credentialData, nodeData)
|
const projectID = getCredentialParam('projectID', credentialData, nodeData)
|
||||||
@@ -58,7 +82,9 @@ class GoogleVertexAIEmbedding_Embeddings implements INode {
|
|||||||
|
|
||||||
if (projectID) authOptions.projectId = projectID
|
if (projectID) authOptions.projectId = projectID
|
||||||
}
|
}
|
||||||
const obj: GoogleVertexAIEmbeddingsParams = {}
|
const obj: GoogleVertexAIEmbeddingsParams = {
|
||||||
|
model: modelName
|
||||||
|
}
|
||||||
if (Object.keys(authOptions).length !== 0) obj.authOptions = authOptions
|
if (Object.keys(authOptions).length !== 0) obj.authOptions = authOptions
|
||||||
|
|
||||||
const model = new GoogleVertexAIEmbeddings(obj)
|
const model = new GoogleVertexAIEmbeddings(obj)
|
||||||
|
|||||||
Reference in New Issue
Block a user