This commit is contained in:
Yongtae
2023-08-24 11:42:49 +09:00
parent 0830b8fbe5
commit d9113da6bb
3 changed files with 17 additions and 21 deletions
@@ -43,19 +43,18 @@ class GoogleVertexAIEmbedding_Embeddings implements INode {
if (!skipExtraCredentialFile && !googleApplicationCredentialFilePath && !googleApplicationCredential)
throw new Error('Please specify your Google Application Credential')
const inputs = [
googleApplicationCredentialFilePath,
googleApplicationCredential,
skipExtraCredentialFile
];
const inputs = [googleApplicationCredentialFilePath, googleApplicationCredential, skipExtraCredentialFile]
if (inputs.filter(Boolean).length > 1) {
throw new Error('Error: More than one component has been inputted. Please use only one of the following: Google Application Credential File Path, Google Credential JSON Object, or Skip Extra Credential File.')
throw new Error(
'Error: More than one component has been inputted. Please use only one of the following: Google Application Credential File Path, Google Credential JSON Object, or Skip Extra Credential File.'
)
}
const authOptions: GoogleAuthOptions = {}
if (!skipExtraCredentialFile){
if (googleApplicationCredentialFilePath && !googleApplicationCredential) authOptions.keyFile = googleApplicationCredentialFilePath
if (!skipExtraCredentialFile) {
if (googleApplicationCredentialFilePath && !googleApplicationCredential)
authOptions.keyFile = googleApplicationCredentialFilePath
else if (!googleApplicationCredentialFilePath && googleApplicationCredential)
authOptions.credentials = JSON.parse(googleApplicationCredential)
@@ -85,22 +85,20 @@ class GoogleVertexAI_LLMs implements INode {
const googleApplicationCredential = getCredentialParam('googleApplicationCredential', credentialData, nodeData)
const projectID = getCredentialParam('projectID', credentialData, nodeData)
if (!skipExtraCredentialFile && !googleApplicationCredentialFilePath && !googleApplicationCredential)
throw new Error('Please specify your Google Application Credential')
const inputs = [
googleApplicationCredentialFilePath,
googleApplicationCredential,
skipExtraCredentialFile
];
const inputs = [googleApplicationCredentialFilePath, googleApplicationCredential, skipExtraCredentialFile]
if (inputs.filter(Boolean).length > 1) {
throw new Error('Error: More than one component has been inputted. Please use only one of the following: Google Application Credential File Path, Google Credential JSON Object, or Skip Extra Credential File.')
throw new Error(
'Error: More than one component has been inputted. Please use only one of the following: Google Application Credential File Path, Google Credential JSON Object, or Skip Extra Credential File.'
)
}
const authOptions: GoogleAuthOptions = {}
if (!skipExtraCredentialFile){
if (googleApplicationCredentialFilePath && !googleApplicationCredential) authOptions.keyFile = googleApplicationCredentialFilePath
if (!skipExtraCredentialFile) {
if (googleApplicationCredentialFilePath && !googleApplicationCredential)
authOptions.keyFile = googleApplicationCredentialFilePath
else if (!googleApplicationCredentialFilePath && googleApplicationCredential)
authOptions.credentials = JSON.parse(googleApplicationCredential)
@@ -114,7 +112,7 @@ class GoogleVertexAI_LLMs implements INode {
const obj: Partial<GoogleVertexAITextInput> = {
temperature: parseFloat(temperature),
model: modelName,
model: modelName
}
if (authOptions) obj.authOptions = authOptions