Merge pull request #869 from Yongtae723/fix/add_new_model_embedding_vertexai
Add input option for Model Name in GoogleVertexAIEmbedding
This commit is contained in:
commit
cc0e7b3703
|
|
@ -33,11 +33,34 @@ class GoogleVertexAIEmbedding_Embeddings implements INode {
|
|||
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.'
|
||||
}
|
||||
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
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const modelName = nodeData.inputs?.modelName as string
|
||||
const googleApplicationCredentialFilePath = getCredentialParam('googleApplicationCredentialFilePath', credentialData, nodeData)
|
||||
const googleApplicationCredential = getCredentialParam('googleApplicationCredential', credentialData, nodeData)
|
||||
const projectID = getCredentialParam('projectID', credentialData, nodeData)
|
||||
|
|
@ -59,6 +82,7 @@ class GoogleVertexAIEmbedding_Embeddings implements INode {
|
|||
if (projectID) authOptions.projectId = projectID
|
||||
}
|
||||
const obj: GoogleVertexAIEmbeddingsParams = {}
|
||||
if (modelName) obj.model = modelName
|
||||
if (Object.keys(authOptions).length !== 0) obj.authOptions = authOptions
|
||||
|
||||
const model = new GoogleVertexAIEmbeddings(obj)
|
||||
|
|
|
|||
Loading…
Reference in New Issue