From a0d0d5e6e3ddfe22a00b4083ff8d5c7fcb01f2d0 Mon Sep 17 00:00:00 2001 From: Yongtae Date: Mon, 7 Aug 2023 12:11:35 +0900 Subject: [PATCH] move project id and remove location --- .../credentials/GoogleAuth.credential.ts | 8 +++++++ .../GoogleVertexAIEmbedding.ts | 23 ++----------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/packages/components/credentials/GoogleAuth.credential.ts b/packages/components/credentials/GoogleAuth.credential.ts index 484ff522..d06d32b1 100644 --- a/packages/components/credentials/GoogleAuth.credential.ts +++ b/packages/components/credentials/GoogleAuth.credential.ts @@ -17,6 +17,14 @@ class GoogleVertexAuth implements INodeCredential { description: 'Path to your google application credential json file', placeholder: 'your-path/application_default_credentials.json', type: 'string' + }, + { + label: 'Project ID', + name: 'projectID', + description: 'Project ID of GCP. If not provided, it will be read from the credential file', + type: 'string', + optional: true, + additionalParams: true } ] } diff --git a/packages/components/nodes/embeddings/GoogleVertexAIEmbedding/GoogleVertexAIEmbedding.ts b/packages/components/nodes/embeddings/GoogleVertexAIEmbedding/GoogleVertexAIEmbedding.ts index dbcc9c62..d68911a9 100644 --- a/packages/components/nodes/embeddings/GoogleVertexAIEmbedding/GoogleVertexAIEmbedding.ts +++ b/packages/components/nodes/embeddings/GoogleVertexAIEmbedding/GoogleVertexAIEmbedding.ts @@ -30,32 +30,14 @@ class GoogleVertexAIEmbedding_Embeddings implements INode { type: 'credential', credentialNames: ['googleVertexAuth'] } - this.inputs = [ - { - label: 'Project ID', - name: 'projectID', - description: 'project id of GCP', - type: 'string', - additionalParams: true, - optional: true - }, - { - label: 'location', - name: 'location', - description: 'location of API', - type: 'string', - additionalParams: true, - optional: true - } - ] + this.inputs = [] } async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { - const projectID = nodeData.inputs?.projectID as string - const location = nodeData.inputs?.location as string const credentialData = await getCredentialData(nodeData.credential ?? '', options) const googleApplicationCredentialFilePath = getCredentialParam('googleApplicationCredentialFilePath', credentialData, nodeData) if (!googleApplicationCredentialFilePath) throw new Error('Please specify your Google Application Credential file path') + const projectID = getCredentialParam('projectID', credentialData, nodeData) const authOptions: GoogleAuthOptions = { keyFile: googleApplicationCredentialFilePath @@ -66,7 +48,6 @@ class GoogleVertexAIEmbedding_Embeddings implements INode { const obj: GoogleVertexAIEmbeddingsParams = { authOptions } - if (location) obj.location = location const model = new GoogleVertexAIEmbeddings(obj) return model