mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 19:00:59 +03:00
implementation of llm model
This commit is contained in:
+20
-10
@@ -38,23 +38,33 @@ class GoogleVertexAIEmbedding_Embeddings implements INode {
|
|||||||
const googleApplicationCredentialFilePath = getCredentialParam('googleApplicationCredentialFilePath', credentialData, nodeData)
|
const googleApplicationCredentialFilePath = getCredentialParam('googleApplicationCredentialFilePath', credentialData, nodeData)
|
||||||
const googleApplicationCredential = getCredentialParam('googleApplicationCredential', credentialData, nodeData)
|
const googleApplicationCredential = getCredentialParam('googleApplicationCredential', credentialData, nodeData)
|
||||||
const projectID = getCredentialParam('projectID', credentialData, nodeData)
|
const projectID = getCredentialParam('projectID', credentialData, nodeData)
|
||||||
|
const skipExtraCredentialFile = getCredentialParam('skipExtraCredentialFile', credentialData, nodeData)
|
||||||
|
|
||||||
if (!googleApplicationCredentialFilePath && !googleApplicationCredential)
|
if (!skipExtraCredentialFile && !googleApplicationCredentialFilePath && !googleApplicationCredential)
|
||||||
throw new Error('Please specify your Google Application Credential')
|
throw new Error('Please specify your Google Application Credential')
|
||||||
if (googleApplicationCredentialFilePath && googleApplicationCredential)
|
|
||||||
throw new Error('Please use either Google Application Credential File Path or Google Credential JSON Object')
|
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.')
|
||||||
|
}
|
||||||
|
|
||||||
const authOptions: GoogleAuthOptions = {}
|
const authOptions: GoogleAuthOptions = {}
|
||||||
if (googleApplicationCredentialFilePath && !googleApplicationCredential) authOptions.keyFile = googleApplicationCredentialFilePath
|
if (!skipExtraCredentialFile){
|
||||||
else if (!googleApplicationCredentialFilePath && googleApplicationCredential)
|
if (googleApplicationCredentialFilePath && !googleApplicationCredential) authOptions.keyFile = googleApplicationCredentialFilePath
|
||||||
authOptions.credentials = JSON.parse(googleApplicationCredential)
|
else if (!googleApplicationCredentialFilePath && googleApplicationCredential)
|
||||||
|
authOptions.credentials = JSON.parse(googleApplicationCredential)
|
||||||
|
|
||||||
if (projectID) authOptions.projectId = projectID
|
if (projectID) authOptions.projectId = projectID
|
||||||
|
|
||||||
const obj: GoogleVertexAIEmbeddingsParams = {
|
|
||||||
authOptions
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const obj: GoogleVertexAIEmbeddingsParams = {}
|
||||||
|
if (authOptions) obj.authOptions = authOptions
|
||||||
|
|
||||||
const model = new GoogleVertexAIEmbeddings(obj)
|
const model = new GoogleVertexAIEmbeddings(obj)
|
||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user