diff --git a/packages/components/nodes/embeddings/GoogleVertexAIEmbedding/GoogleVertexAIEmbedding.ts b/packages/components/nodes/embeddings/GoogleVertexAIEmbedding/GoogleVertexAIEmbedding.ts new file mode 100644 index 000000000..05ceb415a --- /dev/null +++ b/packages/components/nodes/embeddings/GoogleVertexAIEmbedding/GoogleVertexAIEmbedding.ts @@ -0,0 +1,56 @@ +import { GoogleVertexAIEmbeddings, GoogleVertexAIEmbeddingsParams} from "langchain/embeddings/googlevertexai"; +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses} from '../../../src/utils' + +class GoogleVertexAIEmbedding_Embeddings implements INode { + label: string + name: string + version: number + type: string + icon: string + category: string + description: string + baseClasses: string[] + credential: INodeParams + inputs: INodeParams[] + + + constructor() { + this.label = 'GoogleVertexAI Embeddings' + this.name = 'googlevertexaiEmbeddings' + this.version = 1.0 + this.type = 'GoogleVertexAIEmbeddings' + this.icon = 'vertexai.svg' + this.category = 'Embeddings' + this.description = 'Google vertexAI API to generate embeddings for a given text' + this.baseClasses = [this.type, ...getBaseClasses(GoogleVertexAIEmbeddings)] + this.inputs = [ + { + label: 'Model Name', + name: 'modelName', + type: 'options', + options: [ + { + label: 'textembedding-gecko', + name: 'textembedding-gecko' + } + ], + default: 'textembedding-gecko', + } + ] + } + + + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { + + const model = nodeData.inputs?.modelName as string + const obj: GoogleVertexAIEmbeddingsParams = { + model + } + + const embedding = new GoogleVertexAIEmbeddings(obj); + return embedding + } +} + +module.exports = { nodeClass: GoogleVertexAIEmbedding_Embeddings } \ No newline at end of file