This commit is contained in:
Yongtae
2023-08-02 22:28:49 +09:00
parent 6f80f87c55
commit 63d920158c
@@ -1,6 +1,6 @@
import { GoogleVertexAIEmbeddings, GoogleVertexAIEmbeddingsParams} from "langchain/embeddings/googlevertexai"; import { GoogleVertexAIEmbeddings, GoogleVertexAIEmbeddingsParams } from 'langchain/embeddings/googlevertexai'
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
import { getBaseClasses} from '../../../src/utils' import { getBaseClasses } from '../../../src/utils'
class GoogleVertexAIEmbedding_Embeddings implements INode { class GoogleVertexAIEmbedding_Embeddings implements INode {
label: string label: string
@@ -14,7 +14,6 @@ class GoogleVertexAIEmbedding_Embeddings implements INode {
credential: INodeParams credential: INodeParams
inputs: INodeParams[] inputs: INodeParams[]
constructor() { constructor() {
this.label = 'GoogleVertexAI Embeddings' this.label = 'GoogleVertexAI Embeddings'
this.name = 'googlevertexaiEmbeddings' this.name = 'googlevertexaiEmbeddings'
@@ -35,20 +34,18 @@ class GoogleVertexAIEmbedding_Embeddings implements INode {
name: 'textembedding-gecko' name: 'textembedding-gecko'
} }
], ],
default: 'textembedding-gecko', default: 'textembedding-gecko'
} }
] ]
} }
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> { async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
const model = nodeData.inputs?.modelName as string const model = nodeData.inputs?.modelName as string
const obj: GoogleVertexAIEmbeddingsParams = { const obj: GoogleVertexAIEmbeddingsParams = {
model model
} }
const embedding = new GoogleVertexAIEmbeddings(obj); const embedding = new GoogleVertexAIEmbeddings(obj)
return embedding return embedding
} }
} }