diff --git a/packages/components/nodes/chatmodels/ChatAnthropic/AnthropicApi.credential.ts b/packages/components/credentials/AnthropicApi.credential.ts
similarity index 86%
rename from packages/components/nodes/chatmodels/ChatAnthropic/AnthropicApi.credential.ts
rename to packages/components/credentials/AnthropicApi.credential.ts
index 607fa625..448128f1 100644
--- a/packages/components/nodes/chatmodels/ChatAnthropic/AnthropicApi.credential.ts
+++ b/packages/components/credentials/AnthropicApi.credential.ts
@@ -1,4 +1,4 @@
-import { INodeParams, INodeCredential } from '../../../src/Interface'
+import { INodeParams, INodeCredential } from '../src/Interface'
class AnthropicApi implements INodeCredential {
label: string
diff --git a/packages/components/nodes/chatmodels/AzureChatOpenAI/AzureOpenAIApi.credential.ts b/packages/components/credentials/AzureOpenAIApi.credential.ts
similarity index 96%
rename from packages/components/nodes/chatmodels/AzureChatOpenAI/AzureOpenAIApi.credential.ts
rename to packages/components/credentials/AzureOpenAIApi.credential.ts
index d48e0c88..e880c91c 100644
--- a/packages/components/nodes/chatmodels/AzureChatOpenAI/AzureOpenAIApi.credential.ts
+++ b/packages/components/credentials/AzureOpenAIApi.credential.ts
@@ -1,4 +1,4 @@
-import { INodeParams, INodeCredential } from '../../../src/Interface'
+import { INodeParams, INodeCredential } from '../src/Interface'
class AzureOpenAIApi implements INodeCredential {
label: string
diff --git a/packages/components/credentials/CohereApi.credential.ts b/packages/components/credentials/CohereApi.credential.ts
new file mode 100644
index 00000000..488644a2
--- /dev/null
+++ b/packages/components/credentials/CohereApi.credential.ts
@@ -0,0 +1,21 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class CohereApi implements INodeCredential {
+ label: string
+ name: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'Cohere API'
+ this.name = 'cohereApi'
+ this.inputs = [
+ {
+ label: 'Cohere Api Key',
+ name: 'cohereApiKey',
+ type: 'password'
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: CohereApi }
diff --git a/packages/components/credentials/ConfluenceApi.credential.ts b/packages/components/credentials/ConfluenceApi.credential.ts
new file mode 100644
index 00000000..75ea1d88
--- /dev/null
+++ b/packages/components/credentials/ConfluenceApi.credential.ts
@@ -0,0 +1,31 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class ConfluenceApi implements INodeCredential {
+ label: string
+ name: string
+ description: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'Confluence API'
+ this.name = 'confluenceApi'
+ this.description =
+ 'Refer to official guide on how to get accessToken on Confluence'
+ this.inputs = [
+ {
+ label: 'Access Token',
+ name: 'accessToken',
+ type: 'password',
+ placeholder: ''
+ },
+ {
+ label: 'Username',
+ name: 'username',
+ type: 'string',
+ placeholder: ''
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: ConfluenceApi }
diff --git a/packages/components/credentials/DynamodbMemoryApi.credential.ts b/packages/components/credentials/DynamodbMemoryApi.credential.ts
new file mode 100644
index 00000000..5bdfce37
--- /dev/null
+++ b/packages/components/credentials/DynamodbMemoryApi.credential.ts
@@ -0,0 +1,27 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class DynamodbMemoryApi implements INodeCredential {
+ label: string
+ name: string
+ description: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'DynamodbMemory API'
+ this.name = 'dynamodbMemoryApi'
+ this.inputs = [
+ {
+ label: 'Access Key',
+ name: 'accessKey',
+ type: 'password'
+ },
+ {
+ label: 'Secret Access Key',
+ name: 'secretAccessKey',
+ type: 'password'
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: DynamodbMemoryApi }
diff --git a/packages/components/credentials/FigmaApi.credential.ts b/packages/components/credentials/FigmaApi.credential.ts
new file mode 100644
index 00000000..49638885
--- /dev/null
+++ b/packages/components/credentials/FigmaApi.credential.ts
@@ -0,0 +1,25 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class FigmaApi implements INodeCredential {
+ label: string
+ name: string
+ description: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'Figma API'
+ this.name = 'figmaApi'
+ this.description =
+ 'Refer to official guide on how to get accessToken on Figma'
+ this.inputs = [
+ {
+ label: 'Access Token',
+ name: 'accessToken',
+ type: 'password',
+ placeholder: ''
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: FigmaApi }
diff --git a/packages/components/credentials/GithubApi.credential.ts b/packages/components/credentials/GithubApi.credential.ts
new file mode 100644
index 00000000..ffbe4739
--- /dev/null
+++ b/packages/components/credentials/GithubApi.credential.ts
@@ -0,0 +1,25 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class GithubApi implements INodeCredential {
+ label: string
+ name: string
+ description: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'Github API'
+ this.name = 'githubApi'
+ this.description =
+ 'Refer to official guide on how to get accessToken on Github'
+ this.inputs = [
+ {
+ label: 'Access Token',
+ name: 'accessToken',
+ type: 'password',
+ placeholder: ''
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: GithubApi }
diff --git a/packages/components/credentials/HuggingFaceApi.credential.ts b/packages/components/credentials/HuggingFaceApi.credential.ts
new file mode 100644
index 00000000..2dae4319
--- /dev/null
+++ b/packages/components/credentials/HuggingFaceApi.credential.ts
@@ -0,0 +1,21 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class HuggingFaceApi implements INodeCredential {
+ label: string
+ name: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'HuggingFace API'
+ this.name = 'huggingFaceApi'
+ this.inputs = [
+ {
+ label: 'HuggingFace Api Key',
+ name: 'huggingFaceApiKey',
+ type: 'password'
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: HuggingFaceApi }
diff --git a/packages/components/nodes/memory/MotorheadMemory/MotorheadMemoryApi.credential.ts b/packages/components/credentials/MotorheadMemoryApi.credential.ts
similarity index 91%
rename from packages/components/nodes/memory/MotorheadMemory/MotorheadMemoryApi.credential.ts
rename to packages/components/credentials/MotorheadMemoryApi.credential.ts
index 4563cda2..937a9402 100644
--- a/packages/components/nodes/memory/MotorheadMemory/MotorheadMemoryApi.credential.ts
+++ b/packages/components/credentials/MotorheadMemoryApi.credential.ts
@@ -1,4 +1,4 @@
-import { INodeParams, INodeCredential } from '../../../src/Interface'
+import { INodeParams, INodeCredential } from '../src/Interface'
class MotorheadMemoryApi implements INodeCredential {
label: string
diff --git a/packages/components/credentials/NotionApi.credential.ts b/packages/components/credentials/NotionApi.credential.ts
new file mode 100644
index 00000000..47d03f3e
--- /dev/null
+++ b/packages/components/credentials/NotionApi.credential.ts
@@ -0,0 +1,24 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class NotionApi implements INodeCredential {
+ label: string
+ name: string
+ description: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'Notion API'
+ this.name = 'notionApi'
+ this.description =
+ 'You can find integration token here'
+ this.inputs = [
+ {
+ label: 'Notion Integration Token',
+ name: 'notionIntegrationToken',
+ type: 'password'
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: NotionApi }
diff --git a/packages/components/nodes/chatmodels/ChatOpenAI/OpenAIApi.credential.ts b/packages/components/credentials/OpenAIApi.credential.ts
similarity index 85%
rename from packages/components/nodes/chatmodels/ChatOpenAI/OpenAIApi.credential.ts
rename to packages/components/credentials/OpenAIApi.credential.ts
index 96209a35..9aebf049 100644
--- a/packages/components/nodes/chatmodels/ChatOpenAI/OpenAIApi.credential.ts
+++ b/packages/components/credentials/OpenAIApi.credential.ts
@@ -1,4 +1,4 @@
-import { INodeParams, INodeCredential } from '../../../src/Interface'
+import { INodeParams, INodeCredential } from '../src/Interface'
class OpenAIApi implements INodeCredential {
label: string
diff --git a/packages/components/credentials/OpenAPIAuth.credential.ts b/packages/components/credentials/OpenAPIAuth.credential.ts
new file mode 100644
index 00000000..7cc2d318
--- /dev/null
+++ b/packages/components/credentials/OpenAPIAuth.credential.ts
@@ -0,0 +1,23 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class OpenAPIAuth implements INodeCredential {
+ label: string
+ name: string
+ description: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'OpenAPI Auth Token'
+ this.name = 'openAPIAuth'
+ this.inputs = [
+ {
+ label: 'OpenAPI Token',
+ name: 'openAPIToken',
+ type: 'password',
+ description: 'Auth Token. For example: Bearer '
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: OpenAPIAuth }
diff --git a/packages/components/credentials/PineconeApi.credential.ts b/packages/components/credentials/PineconeApi.credential.ts
new file mode 100644
index 00000000..393bfd46
--- /dev/null
+++ b/packages/components/credentials/PineconeApi.credential.ts
@@ -0,0 +1,27 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class PineconeApi implements INodeCredential {
+ label: string
+ name: string
+ description: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'Pinecone API'
+ this.name = 'pineconeApi'
+ this.inputs = [
+ {
+ label: 'Pinecone Api Key',
+ name: 'pineconeApiKey',
+ type: 'password'
+ },
+ {
+ label: 'Pinecone Environment',
+ name: 'pineconeEnv',
+ type: 'string'
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: PineconeApi }
diff --git a/packages/components/credentials/QdrantApi.credential.ts b/packages/components/credentials/QdrantApi.credential.ts
new file mode 100644
index 00000000..1738cc45
--- /dev/null
+++ b/packages/components/credentials/QdrantApi.credential.ts
@@ -0,0 +1,22 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class QdrantApi implements INodeCredential {
+ label: string
+ name: string
+ description: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'Qdrant API'
+ this.name = 'qdrantApi'
+ this.inputs = [
+ {
+ label: 'Qdrant API Key',
+ name: 'qdrantApiKey',
+ type: 'password'
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: QdrantApi }
diff --git a/packages/components/credentials/SerpApi.credential.ts b/packages/components/credentials/SerpApi.credential.ts
new file mode 100644
index 00000000..0c18b103
--- /dev/null
+++ b/packages/components/credentials/SerpApi.credential.ts
@@ -0,0 +1,22 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class SerpApi implements INodeCredential {
+ label: string
+ name: string
+ description: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'Serp API'
+ this.name = 'serpApi'
+ this.inputs = [
+ {
+ label: 'Serp Api Key',
+ name: 'serpApiKey',
+ type: 'password'
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: SerpApi }
diff --git a/packages/components/credentials/SerperApi.credential.ts b/packages/components/credentials/SerperApi.credential.ts
new file mode 100644
index 00000000..71e61b32
--- /dev/null
+++ b/packages/components/credentials/SerperApi.credential.ts
@@ -0,0 +1,22 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class SerperApi implements INodeCredential {
+ label: string
+ name: string
+ description: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'Serper API'
+ this.name = 'serperApi'
+ this.inputs = [
+ {
+ label: 'Serper Api Key',
+ name: 'serperApiKey',
+ type: 'password'
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: SerperApi }
diff --git a/packages/components/credentials/SupabaseApi.credential.ts b/packages/components/credentials/SupabaseApi.credential.ts
new file mode 100644
index 00000000..d485e401
--- /dev/null
+++ b/packages/components/credentials/SupabaseApi.credential.ts
@@ -0,0 +1,22 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class SupabaseApi implements INodeCredential {
+ label: string
+ name: string
+ description: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'Supabase API'
+ this.name = 'supabaseApi'
+ this.inputs = [
+ {
+ label: 'Supabase API Key',
+ name: 'supabaseApiKey',
+ type: 'password'
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: SupabaseApi }
diff --git a/packages/components/credentials/WeaviateApi.credential.ts b/packages/components/credentials/WeaviateApi.credential.ts
new file mode 100644
index 00000000..3d5dd5b9
--- /dev/null
+++ b/packages/components/credentials/WeaviateApi.credential.ts
@@ -0,0 +1,22 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class WeaviateApi implements INodeCredential {
+ label: string
+ name: string
+ description: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'Weaviate API'
+ this.name = 'weaviateApi'
+ this.inputs = [
+ {
+ label: 'Weaviate API Key',
+ name: 'weaviateApiKey',
+ type: 'password'
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: WeaviateApi }
diff --git a/packages/components/credentials/ZapierNLAApi.credential.ts b/packages/components/credentials/ZapierNLAApi.credential.ts
new file mode 100644
index 00000000..03cb01b8
--- /dev/null
+++ b/packages/components/credentials/ZapierNLAApi.credential.ts
@@ -0,0 +1,22 @@
+import { INodeParams, INodeCredential } from '../src/Interface'
+
+class ZapierNLAApi implements INodeCredential {
+ label: string
+ name: string
+ description: string
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'Zapier NLA API'
+ this.name = 'zapierNLAApi'
+ this.inputs = [
+ {
+ label: 'Zapier NLA Api Key',
+ name: 'zapierNLAApiKey',
+ type: 'password'
+ }
+ ]
+ }
+}
+
+module.exports = { credClass: ZapierNLAApi }
diff --git a/packages/components/nodes/memory/ZepMemory/ZepMemoryApi.credential.ts b/packages/components/credentials/ZepMemoryApi.credential.ts
similarity index 84%
rename from packages/components/nodes/memory/ZepMemory/ZepMemoryApi.credential.ts
rename to packages/components/credentials/ZepMemoryApi.credential.ts
index 5e92ef5d..d886328b 100644
--- a/packages/components/nodes/memory/ZepMemory/ZepMemoryApi.credential.ts
+++ b/packages/components/credentials/ZepMemoryApi.credential.ts
@@ -1,4 +1,4 @@
-import { INodeParams, INodeCredential } from '../../../src/Interface'
+import { INodeParams, INodeCredential } from '../src/Interface'
class ZepMemoryApi implements INodeCredential {
label: string
@@ -7,7 +7,7 @@ class ZepMemoryApi implements INodeCredential {
inputs: INodeParams[]
constructor() {
- this.label = 'Zep Memory Api'
+ this.label = 'Zep Memory API'
this.name = 'zepMemoryApi'
this.description =
'Refer to official guide on how to create API key on Zep'
diff --git a/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts b/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts
index f4d065d9..9faf83dd 100644
--- a/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts
+++ b/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts
@@ -22,7 +22,7 @@ class OpenAIFunctionAgent_Agents implements INode {
this.name = 'openAIFunctionAgent'
this.type = 'AgentExecutor'
this.category = 'Agents'
- this.icon = 'openai.png'
+ this.icon = 'openai.svg'
this.description = `An agent that uses OpenAI's Function Calling functionality to pick the tool and args to call`
this.baseClasses = [this.type, ...getBaseClasses(AgentExecutor)]
this.inputs = [
diff --git a/packages/components/nodes/agents/OpenAIFunctionAgent/openai.png b/packages/components/nodes/agents/OpenAIFunctionAgent/openai.png
deleted file mode 100644
index de08a05b..00000000
Binary files a/packages/components/nodes/agents/OpenAIFunctionAgent/openai.png and /dev/null differ
diff --git a/packages/components/nodes/agents/OpenAIFunctionAgent/openai.svg b/packages/components/nodes/agents/OpenAIFunctionAgent/openai.svg
new file mode 100644
index 00000000..9d3261dd
--- /dev/null
+++ b/packages/components/nodes/agents/OpenAIFunctionAgent/openai.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/packages/components/nodes/chains/ApiChain/OpenAPIChain.ts b/packages/components/nodes/chains/ApiChain/OpenAPIChain.ts
index a231e80a..583ca1f4 100644
--- a/packages/components/nodes/chains/ApiChain/OpenAPIChain.ts
+++ b/packages/components/nodes/chains/ApiChain/OpenAPIChain.ts
@@ -20,7 +20,7 @@ class OpenApiChain_Chains implements INode {
this.type = 'openApiChain'
this.icon = 'openapi.png'
this.category = 'Chains'
- this.description = 'Chain to run queries against OpenAPI'
+ this.description = 'Chain that automatically select and call APIs based only on an OpenAPI spec'
this.baseClasses = [this.type, ...getBaseClasses(APIChain)]
this.inputs = [
{
diff --git a/packages/components/nodes/chatmodels/AzureChatOpenAI/Azure.svg b/packages/components/nodes/chatmodels/AzureChatOpenAI/Azure.svg
index 51eb6253..47ad8c44 100644
--- a/packages/components/nodes/chatmodels/AzureChatOpenAI/Azure.svg
+++ b/packages/components/nodes/chatmodels/AzureChatOpenAI/Azure.svg
@@ -1,5 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/components/nodes/chatmodels/ChatHuggingFace/ChatHuggingFace.ts b/packages/components/nodes/chatmodels/ChatHuggingFace/ChatHuggingFace.ts
index d92dd1e0..f192fefd 100644
--- a/packages/components/nodes/chatmodels/ChatHuggingFace/ChatHuggingFace.ts
+++ b/packages/components/nodes/chatmodels/ChatHuggingFace/ChatHuggingFace.ts
@@ -1,5 +1,5 @@
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
-import { getBaseClasses } from '../../../src/utils'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { HFInput, HuggingFaceInference } from './core'
class ChatHuggingFace_ChatModels implements INode {
@@ -10,6 +10,7 @@ class ChatHuggingFace_ChatModels implements INode {
category: string
description: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -20,17 +21,28 @@ class ChatHuggingFace_ChatModels implements INode {
this.category = 'Chat Models'
this.description = 'Wrapper around HuggingFace large language models'
this.baseClasses = [this.type, 'BaseChatModel', ...getBaseClasses(HuggingFaceInference)]
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['huggingFaceApi']
+ }
this.inputs = [
{
label: 'Model',
name: 'model',
type: 'string',
- placeholder: 'gpt2'
+ description: 'If using own inference endpoint, leave this blank',
+ placeholder: 'gpt2',
+ optional: true
},
{
- label: 'HuggingFace Api Key',
- name: 'apiKey',
- type: 'password'
+ label: 'Endpoint',
+ name: 'endpoint',
+ type: 'string',
+ placeholder: 'https://xyz.eu-west-1.aws.endpoints.huggingface.cloud/gpt2',
+ description: 'Using your own inference endpoint',
+ optional: true
},
{
label: 'Temperature',
@@ -71,22 +83,12 @@ class ChatHuggingFace_ChatModels implements INode {
description: 'Frequency Penalty parameter may not apply to certain model. Please check available model parameters',
optional: true,
additionalParams: true
- },
- {
- label: 'Endpoint',
- name: 'endpoint',
- type: 'string',
- placeholder: 'https://xyz.eu-west-1.aws.endpoints.huggingface.cloud/gpt2',
- description: 'Using your own inference endpoint',
- optional: true,
- additionalParams: true
}
]
}
- async init(nodeData: INodeData): Promise {
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const model = nodeData.inputs?.model as string
- const apiKey = nodeData.inputs?.apiKey as string
const temperature = nodeData.inputs?.temperature as string
const maxTokens = nodeData.inputs?.maxTokens as string
const topP = nodeData.inputs?.topP as string
@@ -94,9 +96,12 @@ class ChatHuggingFace_ChatModels implements INode {
const frequencyPenalty = nodeData.inputs?.frequencyPenalty as string
const endpoint = nodeData.inputs?.endpoint as string
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const huggingFaceApiKey = getCredentialParam('huggingFaceApiKey', credentialData, nodeData)
+
const obj: Partial = {
model,
- apiKey
+ apiKey: huggingFaceApiKey
}
if (temperature) obj.temperature = parseFloat(temperature)
diff --git a/packages/components/nodes/chatmodels/ChatOpenAI/ChatOpenAI.ts b/packages/components/nodes/chatmodels/ChatOpenAI/ChatOpenAI.ts
index 1339d1fe..13262b5f 100644
--- a/packages/components/nodes/chatmodels/ChatOpenAI/ChatOpenAI.ts
+++ b/packages/components/nodes/chatmodels/ChatOpenAI/ChatOpenAI.ts
@@ -17,7 +17,7 @@ class ChatOpenAI_ChatModels implements INode {
this.label = 'ChatOpenAI'
this.name = 'chatOpenAI'
this.type = 'ChatOpenAI'
- this.icon = 'openai.png'
+ this.icon = 'openai.svg'
this.category = 'Chat Models'
this.description = 'Wrapper around OpenAI large language models that use the Chat endpoint'
this.baseClasses = [this.type, ...getBaseClasses(ChatOpenAI)]
diff --git a/packages/components/nodes/chatmodels/ChatOpenAI/openai.png b/packages/components/nodes/chatmodels/ChatOpenAI/openai.png
deleted file mode 100644
index de08a05b..00000000
Binary files a/packages/components/nodes/chatmodels/ChatOpenAI/openai.png and /dev/null differ
diff --git a/packages/components/nodes/chatmodels/ChatOpenAI/openai.svg b/packages/components/nodes/chatmodels/ChatOpenAI/openai.svg
new file mode 100644
index 00000000..9d3261dd
--- /dev/null
+++ b/packages/components/nodes/chatmodels/ChatOpenAI/openai.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/packages/components/nodes/documentloaders/Confluence/Confluence.ts b/packages/components/nodes/documentloaders/Confluence/Confluence.ts
index 9a69be14..db992310 100644
--- a/packages/components/nodes/documentloaders/Confluence/Confluence.ts
+++ b/packages/components/nodes/documentloaders/Confluence/Confluence.ts
@@ -1,6 +1,7 @@
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
import { TextSplitter } from 'langchain/text_splitter'
import { ConfluencePagesLoader, ConfluencePagesLoaderParams } from 'langchain/document_loaders/web/confluence'
+import { getCredentialData, getCredentialParam } from '../../../src'
class Confluence_DocumentLoaders implements INode {
label: string
@@ -10,6 +11,7 @@ class Confluence_DocumentLoaders implements INode {
icon: string
category: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -20,6 +22,12 @@ class Confluence_DocumentLoaders implements INode {
this.category = 'Document Loaders'
this.description = `Load data from a Confluence Document`
this.baseClasses = [this.type]
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['confluenceApi']
+ }
this.inputs = [
{
label: 'Text Splitter',
@@ -27,18 +35,6 @@ class Confluence_DocumentLoaders implements INode {
type: 'TextSplitter',
optional: true
},
- {
- label: 'Username',
- name: 'username',
- type: 'string',
- placeholder: ''
- },
- {
- label: 'Access Token',
- name: 'accessToken',
- type: 'password',
- placeholder: ''
- },
{
label: 'Base URL',
name: 'baseUrl',
@@ -49,7 +45,9 @@ class Confluence_DocumentLoaders implements INode {
label: 'Space Key',
name: 'spaceKey',
type: 'string',
- placeholder: '~EXAMPLE362906de5d343d49dcdbae5dEXAMPLE'
+ placeholder: '~EXAMPLE362906de5d343d49dcdbae5dEXAMPLE',
+ description:
+ 'Refer to official guide on how to get Confluence Space Key'
},
{
label: 'Limit',
@@ -68,16 +66,18 @@ class Confluence_DocumentLoaders implements INode {
]
}
- async init(nodeData: INodeData): Promise {
- const username = nodeData.inputs?.username as string
- const accessToken = nodeData.inputs?.accessToken as string
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const spaceKey = nodeData.inputs?.spaceKey as string
const baseUrl = nodeData.inputs?.baseUrl as string
const limit = nodeData.inputs?.limit as number
const textSplitter = nodeData.inputs?.textSplitter as TextSplitter
const metadata = nodeData.inputs?.metadata
- const options: ConfluencePagesLoaderParams = {
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const accessToken = getCredentialParam('accessToken', credentialData, nodeData)
+ const username = getCredentialParam('username', credentialData, nodeData)
+
+ const confluenceOptions: ConfluencePagesLoaderParams = {
username,
accessToken,
baseUrl,
@@ -85,7 +85,7 @@ class Confluence_DocumentLoaders implements INode {
limit
}
- const loader = new ConfluencePagesLoader(options)
+ const loader = new ConfluencePagesLoader(confluenceOptions)
let docs = []
diff --git a/packages/components/nodes/documentloaders/Figma/Figma.ts b/packages/components/nodes/documentloaders/Figma/Figma.ts
index 388c4ee0..e570490e 100644
--- a/packages/components/nodes/documentloaders/Figma/Figma.ts
+++ b/packages/components/nodes/documentloaders/Figma/Figma.ts
@@ -1,4 +1,5 @@
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
+import { getCredentialData, getCredentialParam } from '../../../src'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
import { FigmaFileLoader, FigmaLoaderParams } from 'langchain/document_loaders/web/figma'
class Figma_DocumentLoaders implements INode {
@@ -9,34 +10,39 @@ class Figma_DocumentLoaders implements INode {
icon: string
category: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
this.label = 'Figma'
this.name = 'figma'
this.type = 'Document'
- this.icon = 'figma.png'
+ this.icon = 'figma.svg'
this.category = 'Document Loaders'
this.description = 'Load data from a Figma file'
this.baseClasses = [this.type]
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['figmaApi']
+ }
this.inputs = [
- {
- label: 'Access Token',
- name: 'accessToken',
- type: 'password',
- placeholder: ''
- },
{
label: 'File Key',
name: 'fileKey',
type: 'string',
- placeholder: 'key'
+ placeholder: 'key',
+ description:
+ 'The file key can be read from any Figma file URL: https://www.figma.com/file/:key/:title. For example, in https://www.figma.com/file/12345/Website, the file key is 12345'
},
{
label: 'Node IDs',
name: 'nodeIds',
type: 'string',
- placeholder: '0, 1, 2'
+ placeholder: '0, 1, 2',
+ description:
+ 'A list of Node IDs, seperated by comma. Refer to official guide on how to get Node IDs'
},
{
label: 'Recursive',
@@ -60,18 +66,20 @@ class Figma_DocumentLoaders implements INode {
]
}
- async init(nodeData: INodeData): Promise {
- const accessToken = nodeData.inputs?.accessToken as string
- const nodeIds = (nodeData.inputs?.nodeIds as string)?.split(',') || []
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
+ const nodeIds = (nodeData.inputs?.nodeIds as string)?.trim().split(',') || []
const fileKey = nodeData.inputs?.fileKey as string
- const options: FigmaLoaderParams = {
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const accessToken = getCredentialParam('accessToken', credentialData, nodeData)
+
+ const figmaOptions: FigmaLoaderParams = {
accessToken,
nodeIds,
fileKey
}
- const loader = new FigmaFileLoader(options)
+ const loader = new FigmaFileLoader(figmaOptions)
const docs = await loader.load()
return docs
diff --git a/packages/components/nodes/documentloaders/Figma/figma.png b/packages/components/nodes/documentloaders/Figma/figma.png
deleted file mode 100644
index 72372ddf..00000000
Binary files a/packages/components/nodes/documentloaders/Figma/figma.png and /dev/null differ
diff --git a/packages/components/nodes/documentloaders/Figma/figma.svg b/packages/components/nodes/documentloaders/Figma/figma.svg
new file mode 100644
index 00000000..c4f85674
--- /dev/null
+++ b/packages/components/nodes/documentloaders/Figma/figma.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/packages/components/nodes/documentloaders/Github/Github.ts b/packages/components/nodes/documentloaders/Github/Github.ts
index bbaad3cb..4a968403 100644
--- a/packages/components/nodes/documentloaders/Github/Github.ts
+++ b/packages/components/nodes/documentloaders/Github/Github.ts
@@ -1,6 +1,7 @@
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
import { TextSplitter } from 'langchain/text_splitter'
import { GithubRepoLoader, GithubRepoLoaderParams } from 'langchain/document_loaders/web/github'
+import { getCredentialData, getCredentialParam } from '../../../src'
class Github_DocumentLoaders implements INode {
label: string
@@ -10,6 +11,7 @@ class Github_DocumentLoaders implements INode {
icon: string
category: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -20,6 +22,14 @@ class Github_DocumentLoaders implements INode {
this.category = 'Document Loaders'
this.description = `Load data from a GitHub repository`
this.baseClasses = [this.type]
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ description: 'Only needed when accessing private repo',
+ optional: true,
+ credentialNames: ['githubApi']
+ }
this.inputs = [
{
label: 'Repo Link',
@@ -33,13 +43,6 @@ class Github_DocumentLoaders implements INode {
type: 'string',
default: 'main'
},
- {
- label: 'Access Token',
- name: 'accessToken',
- type: 'password',
- placeholder: '',
- optional: true
- },
{
label: 'Recursive',
name: 'recursive',
@@ -62,23 +65,25 @@ class Github_DocumentLoaders implements INode {
]
}
- async init(nodeData: INodeData): Promise {
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const repoLink = nodeData.inputs?.repoLink as string
const branch = nodeData.inputs?.branch as string
const recursive = nodeData.inputs?.recursive as boolean
- const accessToken = nodeData.inputs?.accessToken as string
const textSplitter = nodeData.inputs?.textSplitter as TextSplitter
const metadata = nodeData.inputs?.metadata
- const options: GithubRepoLoaderParams = {
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const accessToken = getCredentialParam('accessToken', credentialData, nodeData)
+
+ const githubOptions: GithubRepoLoaderParams = {
branch,
recursive,
unknown: 'warn'
}
- if (accessToken) options.accessToken = accessToken
+ if (accessToken) githubOptions.accessToken = accessToken
- const loader = new GithubRepoLoader(repoLink, options)
+ const loader = new GithubRepoLoader(repoLink, githubOptions)
const docs = textSplitter ? await loader.loadAndSplit(textSplitter) : await loader.load()
if (metadata) {
diff --git a/packages/components/nodes/documentloaders/NotionDB/NotionDB.ts b/packages/components/nodes/documentloaders/NotionDB/NotionDB.ts
index 71e5e507..5fec6083 100644
--- a/packages/components/nodes/documentloaders/NotionDB/NotionDB.ts
+++ b/packages/components/nodes/documentloaders/NotionDB/NotionDB.ts
@@ -1,6 +1,7 @@
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
import { TextSplitter } from 'langchain/text_splitter'
-import { NotionDBLoader, NotionDBLoaderParams } from 'langchain/document_loaders/web/notiondb'
+import { NotionAPILoader, NotionAPILoaderOptions } from 'langchain/document_loaders/web/notionapi'
+import { getCredentialData, getCredentialParam } from '../../../src'
class NotionDB_DocumentLoaders implements INode {
label: string
@@ -10,6 +11,7 @@ class NotionDB_DocumentLoaders implements INode {
icon: string
category: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -18,8 +20,14 @@ class NotionDB_DocumentLoaders implements INode {
this.type = 'Document'
this.icon = 'notion.png'
this.category = 'Document Loaders'
- this.description = 'Load data from Notion Database ID'
+ this.description = 'Load data from Notion Database (each row is a separate document with all properties as metadata)'
this.baseClasses = [this.type]
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['notionApi']
+ }
this.inputs = [
{
label: 'Text Splitter',
@@ -34,19 +42,6 @@ class NotionDB_DocumentLoaders implements INode {
description:
'If your URL looks like - https://www.notion.so/?v=, then is the database ID'
},
- {
- label: 'Notion Integration Token',
- name: 'notionIntegrationToken',
- type: 'password',
- description:
- 'You can find integration token here'
- },
- {
- label: 'Page Size Limit',
- name: 'pageSizeLimit',
- type: 'number',
- default: 10
- },
{
label: 'Metadata',
name: 'metadata',
@@ -57,19 +52,22 @@ class NotionDB_DocumentLoaders implements INode {
]
}
- async init(nodeData: INodeData): Promise {
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const textSplitter = nodeData.inputs?.textSplitter as TextSplitter
const databaseId = nodeData.inputs?.databaseId as string
- const notionIntegrationToken = nodeData.inputs?.notionIntegrationToken as string
- const pageSizeLimit = nodeData.inputs?.pageSizeLimit as string
const metadata = nodeData.inputs?.metadata
- const obj: NotionDBLoaderParams = {
- pageSizeLimit: pageSizeLimit ? parseInt(pageSizeLimit, 10) : 10,
- databaseId,
- notionIntegrationToken
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const notionIntegrationToken = getCredentialParam('notionIntegrationToken', credentialData, nodeData)
+
+ const obj: NotionAPILoaderOptions = {
+ clientOptions: {
+ auth: notionIntegrationToken
+ },
+ id: databaseId,
+ type: 'database'
}
- const loader = new NotionDBLoader(obj)
+ const loader = new NotionAPILoader(obj)
let docs = []
if (textSplitter) {
diff --git a/packages/components/nodes/documentloaders/NotionPage/NotionPage.ts b/packages/components/nodes/documentloaders/NotionPage/NotionPage.ts
new file mode 100644
index 00000000..57da8aaa
--- /dev/null
+++ b/packages/components/nodes/documentloaders/NotionPage/NotionPage.ts
@@ -0,0 +1,99 @@
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
+import { TextSplitter } from 'langchain/text_splitter'
+import { NotionAPILoader, NotionAPILoaderOptions } from 'langchain/document_loaders/web/notionapi'
+import { getCredentialData, getCredentialParam } from '../../../src'
+
+class NotionPage_DocumentLoaders implements INode {
+ label: string
+ name: string
+ description: string
+ type: string
+ icon: string
+ category: string
+ baseClasses: string[]
+ credential: INodeParams
+ inputs: INodeParams[]
+
+ constructor() {
+ this.label = 'Notion Page'
+ this.name = 'notionPage'
+ this.type = 'Document'
+ this.icon = 'notion.png'
+ this.category = 'Document Loaders'
+ this.description = 'Load data from Notion Page (including child pages all as separate documents)'
+ this.baseClasses = [this.type]
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['notionApi']
+ }
+ this.inputs = [
+ {
+ label: 'Text Splitter',
+ name: 'textSplitter',
+ type: 'TextSplitter',
+ optional: true
+ },
+ {
+ label: 'Notion Page Id',
+ name: 'pageId',
+ type: 'string',
+ description:
+ 'The last The 32 char hex in the url path. For example: https://www.notion.so/skarard/LangChain-Notion-API-b34ca03f219c4420a6046fc4bdfdf7b4, b34ca03f219c4420a6046fc4bdfdf7b4 is the Page ID'
+ },
+ {
+ label: 'Metadata',
+ name: 'metadata',
+ type: 'json',
+ optional: true,
+ additionalParams: true
+ }
+ ]
+ }
+
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
+ const textSplitter = nodeData.inputs?.textSplitter as TextSplitter
+ const pageId = nodeData.inputs?.pageId as string
+ const metadata = nodeData.inputs?.metadata
+
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const notionIntegrationToken = getCredentialParam('notionIntegrationToken', credentialData, nodeData)
+
+ const obj: NotionAPILoaderOptions = {
+ clientOptions: {
+ auth: notionIntegrationToken
+ },
+ id: pageId,
+ type: 'page'
+ }
+ const loader = new NotionAPILoader(obj)
+
+ let docs = []
+ if (textSplitter) {
+ docs = await loader.loadAndSplit(textSplitter)
+ } else {
+ docs = await loader.load()
+ }
+
+ if (metadata) {
+ const parsedMetadata = typeof metadata === 'object' ? metadata : JSON.parse(metadata)
+ let finaldocs = []
+ for (const doc of docs) {
+ const newdoc = {
+ ...doc,
+ metadata: {
+ ...doc.metadata,
+ ...parsedMetadata
+ }
+ }
+ finaldocs.push(newdoc)
+ }
+ return finaldocs
+ }
+
+ return docs
+ }
+}
+
+module.exports = { nodeClass: NotionPage_DocumentLoaders }
diff --git a/packages/components/nodes/documentloaders/NotionPage/notion.png b/packages/components/nodes/documentloaders/NotionPage/notion.png
new file mode 100644
index 00000000..39105167
Binary files /dev/null and b/packages/components/nodes/documentloaders/NotionPage/notion.png differ
diff --git a/packages/components/nodes/embeddings/AzureOpenAIEmbedding/Azure.svg b/packages/components/nodes/embeddings/AzureOpenAIEmbedding/Azure.svg
index 51eb6253..47ad8c44 100644
--- a/packages/components/nodes/embeddings/AzureOpenAIEmbedding/Azure.svg
+++ b/packages/components/nodes/embeddings/AzureOpenAIEmbedding/Azure.svg
@@ -1,5 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/components/nodes/embeddings/AzureOpenAIEmbedding/AzureOpenAIEmbedding.ts b/packages/components/nodes/embeddings/AzureOpenAIEmbedding/AzureOpenAIEmbedding.ts
index 4133539e..15c9f460 100644
--- a/packages/components/nodes/embeddings/AzureOpenAIEmbedding/AzureOpenAIEmbedding.ts
+++ b/packages/components/nodes/embeddings/AzureOpenAIEmbedding/AzureOpenAIEmbedding.ts
@@ -1,6 +1,6 @@
import { AzureOpenAIInput } from 'langchain/chat_models/openai'
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
-import { getBaseClasses } from '../../../src/utils'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { OpenAIEmbeddings, OpenAIEmbeddingsParams } from 'langchain/embeddings/openai'
class AzureOpenAIEmbedding_Embeddings implements INode {
@@ -11,6 +11,7 @@ class AzureOpenAIEmbedding_Embeddings implements INode {
category: string
description: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -21,32 +22,13 @@ class AzureOpenAIEmbedding_Embeddings implements INode {
this.category = 'Embeddings'
this.description = 'Azure OpenAI API to generate embeddings for a given text'
this.baseClasses = [this.type, ...getBaseClasses(OpenAIEmbeddings)]
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['azureOpenAIApi']
+ }
this.inputs = [
- {
- label: 'Azure OpenAI Api Key',
- name: 'azureOpenAIApiKey',
- type: 'password'
- },
- {
- label: 'Azure OpenAI Api Instance Name',
- name: 'azureOpenAIApiInstanceName',
- type: 'string',
- placeholder: 'YOUR-INSTANCE-NAME'
- },
- {
- label: 'Azure OpenAI Api Deployment Name',
- name: 'azureOpenAIApiDeploymentName',
- type: 'string',
- placeholder: 'YOUR-DEPLOYMENT-NAME'
- },
- {
- label: 'Azure OpenAI Api Version',
- name: 'azureOpenAIApiVersion',
- type: 'string',
- placeholder: '2023-03-15-preview',
- description:
- 'Description of Supported API Versions. Please refer examples'
- },
{
label: 'Batch Size',
name: 'batchSize',
@@ -65,14 +47,16 @@ class AzureOpenAIEmbedding_Embeddings implements INode {
]
}
- async init(nodeData: INodeData): Promise {
- const azureOpenAIApiKey = nodeData.inputs?.azureOpenAIApiKey as string
- const azureOpenAIApiInstanceName = nodeData.inputs?.azureOpenAIApiInstanceName as string
- const azureOpenAIApiDeploymentName = nodeData.inputs?.azureOpenAIApiDeploymentName as string
- const azureOpenAIApiVersion = nodeData.inputs?.azureOpenAIApiVersion as string
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const batchSize = nodeData.inputs?.batchSize as string
const timeout = nodeData.inputs?.timeout as string
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const azureOpenAIApiKey = getCredentialParam('azureOpenAIApiKey', credentialData, nodeData)
+ const azureOpenAIApiInstanceName = getCredentialParam('azureOpenAIApiInstanceName', credentialData, nodeData)
+ const azureOpenAIApiDeploymentName = getCredentialParam('azureOpenAIApiDeploymentName', credentialData, nodeData)
+ const azureOpenAIApiVersion = getCredentialParam('azureOpenAIApiVersion', credentialData, nodeData)
+
const obj: Partial & Partial = {
azureOpenAIApiKey,
azureOpenAIApiInstanceName,
diff --git a/packages/components/nodes/embeddings/CohereEmbedding/CohereEmbedding.ts b/packages/components/nodes/embeddings/CohereEmbedding/CohereEmbedding.ts
index 344713a4..914d643d 100644
--- a/packages/components/nodes/embeddings/CohereEmbedding/CohereEmbedding.ts
+++ b/packages/components/nodes/embeddings/CohereEmbedding/CohereEmbedding.ts
@@ -1,5 +1,5 @@
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
-import { getBaseClasses } from '../../../src/utils'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { CohereEmbeddings, CohereEmbeddingsParams } from 'langchain/embeddings/cohere'
class CohereEmbedding_Embeddings implements INode {
@@ -10,6 +10,7 @@ class CohereEmbedding_Embeddings implements INode {
category: string
description: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -20,12 +21,13 @@ class CohereEmbedding_Embeddings implements INode {
this.category = 'Embeddings'
this.description = 'Cohere API to generate embeddings for a given text'
this.baseClasses = [this.type, ...getBaseClasses(CohereEmbeddings)]
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['cohereApi']
+ }
this.inputs = [
- {
- label: 'Cohere API Key',
- name: 'cohereApiKey',
- type: 'password'
- },
{
label: 'Model Name',
name: 'modelName',
@@ -50,12 +52,14 @@ class CohereEmbedding_Embeddings implements INode {
]
}
- async init(nodeData: INodeData): Promise {
- const apiKey = nodeData.inputs?.cohereApiKey as string
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const modelName = nodeData.inputs?.modelName as string
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const cohereApiKey = getCredentialParam('cohereApiKey', credentialData, nodeData)
+
const obj: Partial & { apiKey?: string } = {
- apiKey
+ apiKey: cohereApiKey
}
if (modelName) obj.modelName = modelName
diff --git a/packages/components/nodes/embeddings/HuggingFaceInferenceEmbedding/HuggingFaceInferenceEmbedding.ts b/packages/components/nodes/embeddings/HuggingFaceInferenceEmbedding/HuggingFaceInferenceEmbedding.ts
index d77d623f..bfbb93ed 100644
--- a/packages/components/nodes/embeddings/HuggingFaceInferenceEmbedding/HuggingFaceInferenceEmbedding.ts
+++ b/packages/components/nodes/embeddings/HuggingFaceInferenceEmbedding/HuggingFaceInferenceEmbedding.ts
@@ -1,5 +1,5 @@
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
-import { getBaseClasses } from '../../../src/utils'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { HuggingFaceInferenceEmbeddings, HuggingFaceInferenceEmbeddingsParams } from './core'
class HuggingFaceInferenceEmbedding_Embeddings implements INode {
@@ -10,6 +10,7 @@ class HuggingFaceInferenceEmbedding_Embeddings implements INode {
category: string
description: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -20,12 +21,13 @@ class HuggingFaceInferenceEmbedding_Embeddings implements INode {
this.category = 'Embeddings'
this.description = 'HuggingFace Inference API to generate embeddings for a given text'
this.baseClasses = [this.type, ...getBaseClasses(HuggingFaceInferenceEmbeddings)]
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['huggingFaceApi']
+ }
this.inputs = [
- {
- label: 'HuggingFace Api Key',
- name: 'apiKey',
- type: 'password'
- },
{
label: 'Model',
name: 'modelName',
@@ -43,13 +45,15 @@ class HuggingFaceInferenceEmbedding_Embeddings implements INode {
]
}
- async init(nodeData: INodeData): Promise {
- const apiKey = nodeData.inputs?.apiKey as string
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const modelName = nodeData.inputs?.modelName as string
const endpoint = nodeData.inputs?.endpoint as string
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const huggingFaceApiKey = getCredentialParam('huggingFaceApiKey', credentialData, nodeData)
+
const obj: Partial = {
- apiKey
+ apiKey: huggingFaceApiKey
}
if (modelName) obj.model = modelName
diff --git a/packages/components/nodes/embeddings/OpenAIEmbedding/OpenAIEmbedding.ts b/packages/components/nodes/embeddings/OpenAIEmbedding/OpenAIEmbedding.ts
index 0fd08973..f2f5eb43 100644
--- a/packages/components/nodes/embeddings/OpenAIEmbedding/OpenAIEmbedding.ts
+++ b/packages/components/nodes/embeddings/OpenAIEmbedding/OpenAIEmbedding.ts
@@ -1,5 +1,5 @@
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
-import { getBaseClasses } from '../../../src/utils'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { OpenAIEmbeddings, OpenAIEmbeddingsParams } from 'langchain/embeddings/openai'
class OpenAIEmbedding_Embeddings implements INode {
@@ -10,22 +10,24 @@ class OpenAIEmbedding_Embeddings implements INode {
category: string
description: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
this.label = 'OpenAI Embeddings'
this.name = 'openAIEmbeddings'
this.type = 'OpenAIEmbeddings'
- this.icon = 'openai.png'
+ this.icon = 'openai.svg'
this.category = 'Embeddings'
this.description = 'OpenAI API to generate embeddings for a given text'
this.baseClasses = [this.type, ...getBaseClasses(OpenAIEmbeddings)]
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['openAIApi']
+ }
this.inputs = [
- {
- label: 'OpenAI Api Key',
- name: 'openAIApiKey',
- type: 'password'
- },
{
label: 'Strip New Lines',
name: 'stripNewLines',
@@ -57,13 +59,15 @@ class OpenAIEmbedding_Embeddings implements INode {
]
}
- async init(nodeData: INodeData): Promise {
- const openAIApiKey = nodeData.inputs?.openAIApiKey as string
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const stripNewLines = nodeData.inputs?.stripNewLines as boolean
const batchSize = nodeData.inputs?.batchSize as string
const timeout = nodeData.inputs?.timeout as string
const basePath = nodeData.inputs?.basepath as string
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const openAIApiKey = getCredentialParam('openAIApiKey', credentialData, nodeData)
+
const obj: Partial & { openAIApiKey?: string } = {
openAIApiKey
}
diff --git a/packages/components/nodes/embeddings/OpenAIEmbedding/openai.png b/packages/components/nodes/embeddings/OpenAIEmbedding/openai.png
deleted file mode 100644
index de08a05b..00000000
Binary files a/packages/components/nodes/embeddings/OpenAIEmbedding/openai.png and /dev/null differ
diff --git a/packages/components/nodes/embeddings/OpenAIEmbedding/openai.svg b/packages/components/nodes/embeddings/OpenAIEmbedding/openai.svg
new file mode 100644
index 00000000..9d3261dd
--- /dev/null
+++ b/packages/components/nodes/embeddings/OpenAIEmbedding/openai.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/packages/components/nodes/llms/Azure OpenAI/Azure.svg b/packages/components/nodes/llms/Azure OpenAI/Azure.svg
index 51eb6253..47ad8c44 100644
--- a/packages/components/nodes/llms/Azure OpenAI/Azure.svg
+++ b/packages/components/nodes/llms/Azure OpenAI/Azure.svg
@@ -1,5 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/components/nodes/llms/Azure OpenAI/AzureOpenAI.ts b/packages/components/nodes/llms/Azure OpenAI/AzureOpenAI.ts
index 130eed33..9729dd41 100644
--- a/packages/components/nodes/llms/Azure OpenAI/AzureOpenAI.ts
+++ b/packages/components/nodes/llms/Azure OpenAI/AzureOpenAI.ts
@@ -1,5 +1,5 @@
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
-import { getBaseClasses } from '../../../src/utils'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { AzureOpenAIInput, OpenAI, OpenAIInput } from 'langchain/llms/openai'
class AzureOpenAI_LLMs implements INode {
@@ -10,6 +10,7 @@ class AzureOpenAI_LLMs implements INode {
category: string
description: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -20,12 +21,13 @@ class AzureOpenAI_LLMs implements INode {
this.category = 'LLMs'
this.description = 'Wrapper around Azure OpenAI large language models'
this.baseClasses = [this.type, ...getBaseClasses(OpenAI)]
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['azureOpenAIApi']
+ }
this.inputs = [
- {
- label: 'Azure OpenAI Api Key',
- name: 'azureOpenAIApiKey',
- type: 'password'
- },
{
label: 'Model Name',
name: 'modelName',
@@ -90,26 +92,6 @@ class AzureOpenAI_LLMs implements INode {
default: 0.9,
optional: true
},
- {
- label: 'Azure OpenAI Api Instance Name',
- name: 'azureOpenAIApiInstanceName',
- type: 'string',
- placeholder: 'YOUR-INSTANCE-NAME'
- },
- {
- label: 'Azure OpenAI Api Deployment Name',
- name: 'azureOpenAIApiDeploymentName',
- type: 'string',
- placeholder: 'YOUR-DEPLOYMENT-NAME'
- },
- {
- label: 'Azure OpenAI Api Version',
- name: 'azureOpenAIApiVersion',
- type: 'string',
- placeholder: '2023-06-01-preview',
- description:
- 'Description of Supported API Versions. Please refer examples'
- },
{
label: 'Max Tokens',
name: 'maxTokens',
@@ -155,13 +137,9 @@ class AzureOpenAI_LLMs implements INode {
]
}
- async init(nodeData: INodeData): Promise {
- const azureOpenAIApiKey = nodeData.inputs?.azureOpenAIApiKey as string
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const temperature = nodeData.inputs?.temperature as string
const modelName = nodeData.inputs?.modelName as string
- const azureOpenAIApiInstanceName = nodeData.inputs?.azureOpenAIApiInstanceName as string
- const azureOpenAIApiDeploymentName = nodeData.inputs?.azureOpenAIApiDeploymentName as string
- const azureOpenAIApiVersion = nodeData.inputs?.azureOpenAIApiVersion as string
const maxTokens = nodeData.inputs?.maxTokens as string
const topP = nodeData.inputs?.topP as string
const frequencyPenalty = nodeData.inputs?.frequencyPenalty as string
@@ -170,6 +148,12 @@ class AzureOpenAI_LLMs implements INode {
const bestOf = nodeData.inputs?.bestOf as string
const streaming = nodeData.inputs?.streaming as boolean
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const azureOpenAIApiKey = getCredentialParam('azureOpenAIApiKey', credentialData, nodeData)
+ const azureOpenAIApiInstanceName = getCredentialParam('azureOpenAIApiInstanceName', credentialData, nodeData)
+ const azureOpenAIApiDeploymentName = getCredentialParam('azureOpenAIApiDeploymentName', credentialData, nodeData)
+ const azureOpenAIApiVersion = getCredentialParam('azureOpenAIApiVersion', credentialData, nodeData)
+
const obj: Partial & Partial = {
temperature: parseFloat(temperature),
modelName,
diff --git a/packages/components/nodes/llms/Cohere/Cohere.ts b/packages/components/nodes/llms/Cohere/Cohere.ts
index 75151571..36bc077a 100644
--- a/packages/components/nodes/llms/Cohere/Cohere.ts
+++ b/packages/components/nodes/llms/Cohere/Cohere.ts
@@ -1,5 +1,5 @@
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
-import { getBaseClasses } from '../../../src/utils'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { Cohere, CohereInput } from './core'
class Cohere_LLMs implements INode {
@@ -10,6 +10,7 @@ class Cohere_LLMs implements INode {
category: string
description: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -20,12 +21,13 @@ class Cohere_LLMs implements INode {
this.category = 'LLMs'
this.description = 'Wrapper around Cohere large language models'
this.baseClasses = [this.type, ...getBaseClasses(Cohere)]
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['cohereApi']
+ }
this.inputs = [
- {
- label: 'Cohere Api Key',
- name: 'cohereApiKey',
- type: 'password'
- },
{
label: 'Model Name',
name: 'modelName',
@@ -75,14 +77,16 @@ class Cohere_LLMs implements INode {
]
}
- async init(nodeData: INodeData): Promise {
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const temperature = nodeData.inputs?.temperature as string
const modelName = nodeData.inputs?.modelName as string
- const apiKey = nodeData.inputs?.cohereApiKey as string
const maxTokens = nodeData.inputs?.maxTokens as string
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const cohereApiKey = getCredentialParam('cohereApiKey', credentialData, nodeData)
+
const obj: CohereInput = {
- apiKey
+ apiKey: cohereApiKey
}
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
diff --git a/packages/components/nodes/llms/HuggingFaceInference/HuggingFaceInference.ts b/packages/components/nodes/llms/HuggingFaceInference/HuggingFaceInference.ts
index 92eb46d5..fae1525f 100644
--- a/packages/components/nodes/llms/HuggingFaceInference/HuggingFaceInference.ts
+++ b/packages/components/nodes/llms/HuggingFaceInference/HuggingFaceInference.ts
@@ -1,5 +1,5 @@
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
-import { getBaseClasses } from '../../../src/utils'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { HFInput, HuggingFaceInference } from './core'
class HuggingFaceInference_LLMs implements INode {
@@ -10,6 +10,7 @@ class HuggingFaceInference_LLMs implements INode {
category: string
description: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -20,17 +21,28 @@ class HuggingFaceInference_LLMs implements INode {
this.category = 'LLMs'
this.description = 'Wrapper around HuggingFace large language models'
this.baseClasses = [this.type, ...getBaseClasses(HuggingFaceInference)]
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['huggingFaceApi']
+ }
this.inputs = [
{
label: 'Model',
name: 'model',
type: 'string',
- placeholder: 'gpt2'
+ description: 'If using own inference endpoint, leave this blank',
+ placeholder: 'gpt2',
+ optional: true
},
{
- label: 'HuggingFace Api Key',
- name: 'apiKey',
- type: 'password'
+ label: 'Endpoint',
+ name: 'endpoint',
+ type: 'string',
+ placeholder: 'https://xyz.eu-west-1.aws.endpoints.huggingface.cloud/gpt2',
+ description: 'Using your own inference endpoint',
+ optional: true
},
{
label: 'Temperature',
@@ -71,22 +83,12 @@ class HuggingFaceInference_LLMs implements INode {
description: 'Frequency Penalty parameter may not apply to certain model. Please check available model parameters',
optional: true,
additionalParams: true
- },
- {
- label: 'Endpoint',
- name: 'endpoint',
- type: 'string',
- placeholder: 'https://xyz.eu-west-1.aws.endpoints.huggingface.cloud/gpt2',
- description: 'Using your own inference endpoint',
- optional: true,
- additionalParams: true
}
]
}
- async init(nodeData: INodeData): Promise {
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const model = nodeData.inputs?.model as string
- const apiKey = nodeData.inputs?.apiKey as string
const temperature = nodeData.inputs?.temperature as string
const maxTokens = nodeData.inputs?.maxTokens as string
const topP = nodeData.inputs?.topP as string
@@ -94,9 +96,12 @@ class HuggingFaceInference_LLMs implements INode {
const frequencyPenalty = nodeData.inputs?.frequencyPenalty as string
const endpoint = nodeData.inputs?.endpoint as string
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const huggingFaceApiKey = getCredentialParam('huggingFaceApiKey', credentialData, nodeData)
+
const obj: Partial = {
model,
- apiKey
+ apiKey: huggingFaceApiKey
}
if (temperature) obj.temperature = parseFloat(temperature)
diff --git a/packages/components/nodes/llms/OpenAI/OpenAI.ts b/packages/components/nodes/llms/OpenAI/OpenAI.ts
index 50aa1c60..884cf63f 100644
--- a/packages/components/nodes/llms/OpenAI/OpenAI.ts
+++ b/packages/components/nodes/llms/OpenAI/OpenAI.ts
@@ -17,7 +17,7 @@ class OpenAI_LLMs implements INode {
this.label = 'OpenAI'
this.name = 'openAI'
this.type = 'OpenAI'
- this.icon = 'openai.png'
+ this.icon = 'openai.svg'
this.category = 'LLMs'
this.description = 'Wrapper around OpenAI large language models'
this.baseClasses = [this.type, ...getBaseClasses(OpenAI)]
diff --git a/packages/components/nodes/llms/OpenAI/openai.png b/packages/components/nodes/llms/OpenAI/openai.png
deleted file mode 100644
index de08a05b..00000000
Binary files a/packages/components/nodes/llms/OpenAI/openai.png and /dev/null differ
diff --git a/packages/components/nodes/llms/OpenAI/openai.svg b/packages/components/nodes/llms/OpenAI/openai.svg
new file mode 100644
index 00000000..9d3261dd
--- /dev/null
+++ b/packages/components/nodes/llms/OpenAI/openai.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/packages/components/nodes/memory/DynamoDb/DynamoDb.ts b/packages/components/nodes/memory/DynamoDb/DynamoDb.ts
index 49d15cb6..d9fc75d0 100644
--- a/packages/components/nodes/memory/DynamoDb/DynamoDb.ts
+++ b/packages/components/nodes/memory/DynamoDb/DynamoDb.ts
@@ -1,4 +1,4 @@
-import { ICommonObject, INode, INodeData, INodeParams, getBaseClasses } from '../../../src'
+import { ICommonObject, INode, INodeData, INodeParams, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src'
import { DynamoDBChatMessageHistory } from 'langchain/stores/message/dynamodb'
import { BufferMemory } from 'langchain/memory'
@@ -10,6 +10,7 @@ class DynamoDb_Memory implements INode {
icon: string
category: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -20,6 +21,12 @@ class DynamoDb_Memory implements INode {
this.category = 'Memory'
this.description = 'Stores the conversation in dynamo db table'
this.baseClasses = [this.type, ...getBaseClasses(BufferMemory)]
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['dynamodbMemoryApi']
+ }
this.inputs = [
{
label: 'Table Name',
@@ -31,6 +38,13 @@ class DynamoDb_Memory implements INode {
name: 'partitionKey',
type: 'string'
},
+ {
+ label: 'Region',
+ name: 'region',
+ type: 'string',
+ description: 'The aws region in which table is located',
+ placeholder: 'us-east-1'
+ },
{
label: 'Session ID',
name: 'sessionId',
@@ -40,28 +54,12 @@ class DynamoDb_Memory implements INode {
additionalParams: true,
optional: true
},
- {
- label: 'Region',
- name: 'region',
- type: 'string',
- description: 'The aws region in which table is located',
- placeholder: 'us-east-1'
- },
- {
- label: 'Access Key',
- name: 'accessKey',
- type: 'password'
- },
- {
- label: 'Secret Access Key',
- name: 'secretAccessKey',
- type: 'password'
- },
{
label: 'Memory Key',
name: 'memoryKey',
type: 'string',
- default: 'chat_history'
+ default: 'chat_history',
+ additionalParams: true
}
]
}
@@ -70,12 +68,14 @@ class DynamoDb_Memory implements INode {
const partitionKey = nodeData.inputs?.partitionKey as string
const sessionId = nodeData.inputs?.sessionId as string
const region = nodeData.inputs?.region as string
- const accessKey = nodeData.inputs?.accessKey as string
- const secretAccessKey = nodeData.inputs?.secretAccessKey as string
const memoryKey = nodeData.inputs?.memoryKey as string
const chatId = options.chatId
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const accessKey = getCredentialParam('accessKey', credentialData, nodeData)
+ const secretAccessKey = getCredentialParam('secretAccessKey', credentialData, nodeData)
+
const dynamoDb = new DynamoDBChatMessageHistory({
tableName,
partitionKey,
diff --git a/packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts b/packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts
index 9caf604c..904bd672 100644
--- a/packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts
+++ b/packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts
@@ -20,7 +20,7 @@ class MotorMemory_Memory implements INode {
this.type = 'MotorheadMemory'
this.icon = 'motorhead.png'
this.category = 'Memory'
- this.description = 'Remembers previous conversational back and forths directly'
+ this.description = 'Use Motorhead Memory to store chat conversations'
this.baseClasses = [this.type, ...getBaseClasses(MotorheadMemory)]
this.credential = {
label: 'Connect Credential',
@@ -38,12 +38,6 @@ class MotorMemory_Memory implements INode {
optional: true,
description: 'To use the online version, leave the URL blank. More details at https://getmetal.io.'
},
- {
- label: 'Memory Key',
- name: 'memoryKey',
- type: 'string',
- default: 'chat_history'
- },
{
label: 'Session Id',
name: 'sessionId',
@@ -52,6 +46,13 @@ class MotorMemory_Memory implements INode {
default: '',
additionalParams: true,
optional: true
+ },
+ {
+ label: 'Memory Key',
+ name: 'memoryKey',
+ type: 'string',
+ default: 'chat_history',
+ additionalParams: true
}
]
}
diff --git a/packages/components/nodes/memory/RedisBackedChatMemory/RedisBackedChatMemory.ts b/packages/components/nodes/memory/RedisBackedChatMemory/RedisBackedChatMemory.ts
index 2b4e51c2..37f1cbe2 100644
--- a/packages/components/nodes/memory/RedisBackedChatMemory/RedisBackedChatMemory.ts
+++ b/packages/components/nodes/memory/RedisBackedChatMemory/RedisBackedChatMemory.ts
@@ -44,13 +44,15 @@ class RedisBackedChatMemory_Memory implements INode {
name: 'sessionTTL',
type: 'number',
description: 'Omit this parameter to make sessions never expire',
+ additionalParams: true,
optional: true
},
{
label: 'Memory Key',
name: 'memoryKey',
type: 'string',
- default: 'chat_history'
+ default: 'chat_history',
+ additionalParams: true
}
]
}
diff --git a/packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts b/packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts
index d6168061..0de7151b 100644
--- a/packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts
+++ b/packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts
@@ -1,8 +1,9 @@
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
import { OpenApiToolkit } from 'langchain/agents'
import { JsonSpec, JsonObject } from 'langchain/tools'
import { BaseLanguageModel } from 'langchain/base_language'
import { load } from 'js-yaml'
+import { getCredentialData, getCredentialParam } from '../../../src'
class OpenAPIToolkit_Tools implements INode {
label: string
@@ -12,6 +13,7 @@ class OpenAPIToolkit_Tools implements INode {
icon: string
category: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -21,12 +23,15 @@ class OpenAPIToolkit_Tools implements INode {
this.icon = 'openapi.png'
this.category = 'Tools'
this.description = 'Load OpenAPI specification'
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ description: 'Only needed if the YAML OpenAPI Spec requires authentication',
+ optional: true,
+ credentialNames: ['openAPIAuth']
+ }
this.inputs = [
- {
- label: 'OpenAI API Key',
- name: 'openAIApiKey',
- type: 'password'
- },
{
label: 'Language Model',
name: 'model',
@@ -42,11 +47,13 @@ class OpenAPIToolkit_Tools implements INode {
this.baseClasses = [this.type, 'Tool']
}
- async init(nodeData: INodeData): Promise {
- const openAIApiKey = nodeData.inputs?.openAIApiKey as string
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const model = nodeData.inputs?.model as BaseLanguageModel
const yamlFileBase64 = nodeData.inputs?.yamlFile as string
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const openAPIToken = getCredentialParam('openAPIToken', credentialData, nodeData)
+
const splitDataURI = yamlFileBase64.split(',')
splitDataURI.pop()
const bf = Buffer.from(splitDataURI.pop() || '', 'base64')
@@ -56,10 +63,10 @@ class OpenAPIToolkit_Tools implements INode {
throw new Error('Failed to load OpenAPI spec')
}
- const headers = {
- 'Content-Type': 'application/json',
- Authorization: `Bearer ${openAIApiKey}`
+ const headers: ICommonObject = {
+ 'Content-Type': 'application/json'
}
+ if (openAPIToken) headers.Authorization = `Bearer ${openAPIToken}`
const toolkit = new OpenApiToolkit(new JsonSpec(data), model, headers)
return toolkit.tools
diff --git a/packages/components/nodes/tools/SerpAPI/SerpAPI.ts b/packages/components/nodes/tools/SerpAPI/SerpAPI.ts
index 69432408..7e87e9c1 100644
--- a/packages/components/nodes/tools/SerpAPI/SerpAPI.ts
+++ b/packages/components/nodes/tools/SerpAPI/SerpAPI.ts
@@ -1,5 +1,5 @@
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
-import { getBaseClasses } from '../../../src/utils'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { SerpAPI } from 'langchain/tools'
class SerpAPI_Tools implements INode {
@@ -10,6 +10,7 @@ class SerpAPI_Tools implements INode {
icon: string
category: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -19,19 +20,20 @@ class SerpAPI_Tools implements INode {
this.icon = 'serp.png'
this.category = 'Tools'
this.description = 'Wrapper around SerpAPI - a real-time API to access Google search results'
- this.inputs = [
- {
- label: 'Serp Api Key',
- name: 'apiKey',
- type: 'password'
- }
- ]
+ this.inputs = []
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['serpApi']
+ }
this.baseClasses = [this.type, ...getBaseClasses(SerpAPI)]
}
- async init(nodeData: INodeData): Promise {
- const apiKey = nodeData.inputs?.apiKey as string
- return new SerpAPI(apiKey)
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const serpApiKey = getCredentialParam('serpApiKey', credentialData, nodeData)
+ return new SerpAPI(serpApiKey)
}
}
diff --git a/packages/components/nodes/tools/Serper/Serper.ts b/packages/components/nodes/tools/Serper/Serper.ts
index 65dff57c..495ac8af 100644
--- a/packages/components/nodes/tools/Serper/Serper.ts
+++ b/packages/components/nodes/tools/Serper/Serper.ts
@@ -1,5 +1,5 @@
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
-import { getBaseClasses } from '../../../src/utils'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { Serper } from 'langchain/tools'
class Serper_Tools implements INode {
@@ -10,6 +10,7 @@ class Serper_Tools implements INode {
icon: string
category: string
baseClasses: string[]
+ credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -19,19 +20,20 @@ class Serper_Tools implements INode {
this.icon = 'serper.png'
this.category = 'Tools'
this.description = 'Wrapper around Serper.dev - Google Search API'
- this.inputs = [
- {
- label: 'Serper Api Key',
- name: 'apiKey',
- type: 'password'
- }
- ]
+ this.inputs = []
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['serperApi']
+ }
this.baseClasses = [this.type, ...getBaseClasses(Serper)]
}
- async init(nodeData: INodeData): Promise {
- const apiKey = nodeData.inputs?.apiKey as string
- return new Serper(apiKey)
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const serperApiKey = getCredentialParam('serperApiKey', credentialData, nodeData)
+ return new Serper(serperApiKey)
}
}
diff --git a/packages/components/nodes/tools/ZapierNLA/ZapierNLA.ts b/packages/components/nodes/tools/ZapierNLA/ZapierNLA.ts
index d16e32e6..06d3dc5a 100644
--- a/packages/components/nodes/tools/ZapierNLA/ZapierNLA.ts
+++ b/packages/components/nodes/tools/ZapierNLA/ZapierNLA.ts
@@ -1,6 +1,7 @@
import { ZapierNLAWrapper, ZapierNLAWrapperParams } from 'langchain/tools'
-import { INode, INodeData, INodeParams } from '../../../src/Interface'
+import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
import { ZapierToolKit } from 'langchain/agents'
+import { getCredentialData, getCredentialParam } from '../../../src'
class ZapierNLA_Tools implements INode {
label: string
@@ -11,29 +12,31 @@ class ZapierNLA_Tools implements INode {
category: string
baseClasses: string[]
inputs: INodeParams[]
+ credential: INodeParams
constructor() {
this.label = 'Zapier NLA'
this.name = 'zapierNLA'
this.type = 'ZapierNLA'
- this.icon = 'zapier.png'
+ this.icon = 'zapier.svg'
this.category = 'Tools'
this.description = "Access to apps and actions on Zapier's platform through a natural language API interface"
- this.inputs = [
- {
- label: 'Zapier NLA Api Key',
- name: 'apiKey',
- type: 'password'
- }
- ]
+ this.inputs = []
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['zapierNLAApi']
+ }
this.baseClasses = [this.type, 'Tool']
}
- async init(nodeData: INodeData): Promise {
- const apiKey = nodeData.inputs?.apiKey as string
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const zapierNLAApiKey = getCredentialParam('zapierNLAApiKey', credentialData, nodeData)
const obj: Partial = {
- apiKey
+ apiKey: zapierNLAApiKey
}
const zapier = new ZapierNLAWrapper(obj)
const toolkit = await ZapierToolKit.fromZapierNLAWrapper(zapier)
diff --git a/packages/components/nodes/tools/ZapierNLA/zapier.png b/packages/components/nodes/tools/ZapierNLA/zapier.png
deleted file mode 100644
index 769716fa..00000000
Binary files a/packages/components/nodes/tools/ZapierNLA/zapier.png and /dev/null differ
diff --git a/packages/components/nodes/tools/ZapierNLA/zapier.svg b/packages/components/nodes/tools/ZapierNLA/zapier.svg
new file mode 100644
index 00000000..6ed35f29
--- /dev/null
+++ b/packages/components/nodes/tools/ZapierNLA/zapier.svg
@@ -0,0 +1,8 @@
+
+
\ No newline at end of file
diff --git a/packages/components/nodes/vectorstores/Pinecone_Existing/Pinecone_Existing.ts b/packages/components/nodes/vectorstores/Pinecone_Existing/Pinecone_Existing.ts
index e57da396..3d37d61e 100644
--- a/packages/components/nodes/vectorstores/Pinecone_Existing/Pinecone_Existing.ts
+++ b/packages/components/nodes/vectorstores/Pinecone_Existing/Pinecone_Existing.ts
@@ -1,8 +1,8 @@
-import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
+import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { PineconeClient } from '@pinecone-database/pinecone'
import { PineconeLibArgs, PineconeStore } from 'langchain/vectorstores/pinecone'
import { Embeddings } from 'langchain/embeddings/base'
-import { getBaseClasses } from '../../../src/utils'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
class Pinecone_Existing_VectorStores implements INode {
label: string
@@ -13,6 +13,7 @@ class Pinecone_Existing_VectorStores implements INode {
category: string
baseClasses: string[]
inputs: INodeParams[]
+ credential: INodeParams
outputs: INodeOutputsValue[]
constructor() {
@@ -23,22 +24,18 @@ class Pinecone_Existing_VectorStores implements INode {
this.category = 'Vector Stores'
this.description = 'Load existing index from Pinecone (i.e: Document has been upserted)'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['pineconeApi']
+ }
this.inputs = [
{
label: 'Embeddings',
name: 'embeddings',
type: 'Embeddings'
},
- {
- label: 'Pinecone Api Key',
- name: 'pineconeApiKey',
- type: 'password'
- },
- {
- label: 'Pinecone Environment',
- name: 'pineconeEnv',
- type: 'string'
- },
{
label: 'Pinecone Index',
name: 'pineconeIndex',
@@ -83,9 +80,7 @@ class Pinecone_Existing_VectorStores implements INode {
]
}
- async init(nodeData: INodeData): Promise {
- const pineconeApiKey = nodeData.inputs?.pineconeApiKey as string
- const pineconeEnv = nodeData.inputs?.pineconeEnv as string
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const index = nodeData.inputs?.pineconeIndex as string
const pineconeNamespace = nodeData.inputs?.pineconeNamespace as string
const pineconeMetadataFilter = nodeData.inputs?.pineconeMetadataFilter
@@ -94,6 +89,10 @@ class Pinecone_Existing_VectorStores implements INode {
const topK = nodeData.inputs?.topK as string
const k = topK ? parseInt(topK, 10) : 4
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData)
+ const pineconeEnv = getCredentialParam('pineconeEnv', credentialData, nodeData)
+
const client = new PineconeClient()
await client.init({
apiKey: pineconeApiKey,
diff --git a/packages/components/nodes/vectorstores/Pinecone_Upsert/Pinecone_Upsert.ts b/packages/components/nodes/vectorstores/Pinecone_Upsert/Pinecone_Upsert.ts
index ad1767c2..a3cc9094 100644
--- a/packages/components/nodes/vectorstores/Pinecone_Upsert/Pinecone_Upsert.ts
+++ b/packages/components/nodes/vectorstores/Pinecone_Upsert/Pinecone_Upsert.ts
@@ -1,9 +1,9 @@
-import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
+import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { PineconeClient } from '@pinecone-database/pinecone'
import { PineconeLibArgs, PineconeStore } from 'langchain/vectorstores/pinecone'
import { Embeddings } from 'langchain/embeddings/base'
import { Document } from 'langchain/document'
-import { getBaseClasses } from '../../../src/utils'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { flatten } from 'lodash'
class PineconeUpsert_VectorStores implements INode {
@@ -15,6 +15,7 @@ class PineconeUpsert_VectorStores implements INode {
category: string
baseClasses: string[]
inputs: INodeParams[]
+ credential: INodeParams
outputs: INodeOutputsValue[]
constructor() {
@@ -25,6 +26,12 @@ class PineconeUpsert_VectorStores implements INode {
this.category = 'Vector Stores'
this.description = 'Upsert documents to Pinecone'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['pineconeApi']
+ }
this.inputs = [
{
label: 'Document',
@@ -37,16 +44,6 @@ class PineconeUpsert_VectorStores implements INode {
name: 'embeddings',
type: 'Embeddings'
},
- {
- label: 'Pinecone Api Key',
- name: 'pineconeApiKey',
- type: 'password'
- },
- {
- label: 'Pinecone Environment',
- name: 'pineconeEnv',
- type: 'string'
- },
{
label: 'Pinecone Index',
name: 'pineconeIndex',
@@ -84,9 +81,7 @@ class PineconeUpsert_VectorStores implements INode {
]
}
- async init(nodeData: INodeData): Promise {
- const pineconeApiKey = nodeData.inputs?.pineconeApiKey as string
- const pineconeEnv = nodeData.inputs?.pineconeEnv as string
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const index = nodeData.inputs?.pineconeIndex as string
const pineconeNamespace = nodeData.inputs?.pineconeNamespace as string
const docs = nodeData.inputs?.document as Document[]
@@ -95,6 +90,10 @@ class PineconeUpsert_VectorStores implements INode {
const topK = nodeData.inputs?.topK as string
const k = topK ? parseInt(topK, 10) : 4
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData)
+ const pineconeEnv = getCredentialParam('pineconeEnv', credentialData, nodeData)
+
const client = new PineconeClient()
await client.init({
apiKey: pineconeApiKey,
diff --git a/packages/components/nodes/vectorstores/Qdrant_Existing/Qdrant_Existing.ts b/packages/components/nodes/vectorstores/Qdrant_Existing/Qdrant_Existing.ts
index f1eef8f9..bb4ac6ed 100644
--- a/packages/components/nodes/vectorstores/Qdrant_Existing/Qdrant_Existing.ts
+++ b/packages/components/nodes/vectorstores/Qdrant_Existing/Qdrant_Existing.ts
@@ -1,8 +1,8 @@
-import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
+import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { QdrantClient } from '@qdrant/js-client-rest'
import { QdrantVectorStore, QdrantLibArgs } from 'langchain/vectorstores/qdrant'
import { Embeddings } from 'langchain/embeddings/base'
-import { getBaseClasses } from '../../../src/utils'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
class Qdrant_Existing_VectorStores implements INode {
label: string
@@ -13,16 +13,25 @@ class Qdrant_Existing_VectorStores implements INode {
category: string
baseClasses: string[]
inputs: INodeParams[]
+ credential: INodeParams
outputs: INodeOutputsValue[]
constructor() {
this.label = 'Qdrant Load Existing Index'
this.name = 'qdrantExistingIndex'
this.type = 'Qdrant'
- this.icon = 'qdrant_logo.svg'
+ this.icon = 'qdrant.png'
this.category = 'Vector Stores'
this.description = 'Load existing index from Qdrant (i.e., documents have been upserted)'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ description: 'Only needed when using Qdrant cloud hosted',
+ optional: true,
+ credentialNames: ['qdrantApi']
+ }
this.inputs = [
{
label: 'Embeddings',
@@ -40,12 +49,6 @@ class Qdrant_Existing_VectorStores implements INode {
name: 'qdrantCollection',
type: 'string'
},
- {
- label: 'Qdrant API Key',
- name: 'qdrantApiKey',
- type: 'password',
- optional: true
- },
{
label: 'Qdrant Collection Cofiguration',
name: 'qdrantCollectionCofiguration',
@@ -77,17 +80,18 @@ class Qdrant_Existing_VectorStores implements INode {
]
}
- async init(nodeData: INodeData): Promise {
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const qdrantServerUrl = nodeData.inputs?.qdrantServerUrl as string
const collectionName = nodeData.inputs?.qdrantCollection as string
- const qdrantApiKey = nodeData.inputs?.qdrantApiKey as string
let qdrantCollectionCofiguration = nodeData.inputs?.qdrantCollectionCofiguration
const embeddings = nodeData.inputs?.embeddings as Embeddings
const output = nodeData.outputs?.output as string
const topK = nodeData.inputs?.topK as string
const k = topK ? parseInt(topK, 10) : 4
- // connect to Qdrant Cloud
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const qdrantApiKey = getCredentialParam('qdrantApiKey', credentialData, nodeData)
+
const client = new QdrantClient({
url: qdrantServerUrl,
apiKey: qdrantApiKey
diff --git a/packages/components/nodes/vectorstores/Qdrant_Existing/qdrant.png b/packages/components/nodes/vectorstores/Qdrant_Existing/qdrant.png
new file mode 100644
index 00000000..ecb2a56d
Binary files /dev/null and b/packages/components/nodes/vectorstores/Qdrant_Existing/qdrant.png differ
diff --git a/packages/components/nodes/vectorstores/Qdrant_Existing/qdrant_logo.svg b/packages/components/nodes/vectorstores/Qdrant_Existing/qdrant_logo.svg
deleted file mode 100644
index 82fb8b39..00000000
--- a/packages/components/nodes/vectorstores/Qdrant_Existing/qdrant_logo.svg
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
diff --git a/packages/components/nodes/vectorstores/Qdrant_Upsert/Qdrant_Upsert.ts b/packages/components/nodes/vectorstores/Qdrant_Upsert/Qdrant_Upsert.ts
index dae1d31d..c0a7b305 100644
--- a/packages/components/nodes/vectorstores/Qdrant_Upsert/Qdrant_Upsert.ts
+++ b/packages/components/nodes/vectorstores/Qdrant_Upsert/Qdrant_Upsert.ts
@@ -1,9 +1,9 @@
-import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
+import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { QdrantClient } from '@qdrant/js-client-rest'
import { QdrantVectorStore, QdrantLibArgs } from 'langchain/vectorstores/qdrant'
import { Embeddings } from 'langchain/embeddings/base'
import { Document } from 'langchain/document'
-import { getBaseClasses } from '../../../src/utils'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { flatten } from 'lodash'
class QdrantUpsert_VectorStores implements INode {
@@ -15,16 +15,25 @@ class QdrantUpsert_VectorStores implements INode {
category: string
baseClasses: string[]
inputs: INodeParams[]
+ credential: INodeParams
outputs: INodeOutputsValue[]
constructor() {
this.label = 'Qdrant Upsert Document'
this.name = 'qdrantUpsert'
this.type = 'Qdrant'
- this.icon = 'qdrant_logo.svg'
+ this.icon = 'qdrant.png'
this.category = 'Vector Stores'
this.description = 'Upsert documents to Qdrant'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ description: 'Only needed when using Qdrant cloud hosted',
+ optional: true,
+ credentialNames: ['qdrantApi']
+ }
this.inputs = [
{
label: 'Document',
@@ -48,12 +57,6 @@ class QdrantUpsert_VectorStores implements INode {
name: 'qdrantCollection',
type: 'string'
},
- {
- label: 'Qdrant API Key',
- name: 'qdrantApiKey',
- type: 'password',
- optional: true
- },
{
label: 'Top K',
name: 'topK',
@@ -78,17 +81,18 @@ class QdrantUpsert_VectorStores implements INode {
]
}
- async init(nodeData: INodeData): Promise {
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const qdrantServerUrl = nodeData.inputs?.qdrantServerUrl as string
const collectionName = nodeData.inputs?.qdrantCollection as string
- const qdrantApiKey = nodeData.inputs?.qdrantApiKey as string
const docs = nodeData.inputs?.document as Document[]
const embeddings = nodeData.inputs?.embeddings as Embeddings
const output = nodeData.outputs?.output as string
const topK = nodeData.inputs?.topK as string
const k = topK ? parseInt(topK, 10) : 4
- // connect to Qdrant Cloud
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const qdrantApiKey = getCredentialParam('qdrantApiKey', credentialData, nodeData)
+
const client = new QdrantClient({
url: qdrantServerUrl,
apiKey: qdrantApiKey
diff --git a/packages/components/nodes/vectorstores/Qdrant_Upsert/qdrant.png b/packages/components/nodes/vectorstores/Qdrant_Upsert/qdrant.png
new file mode 100644
index 00000000..ecb2a56d
Binary files /dev/null and b/packages/components/nodes/vectorstores/Qdrant_Upsert/qdrant.png differ
diff --git a/packages/components/nodes/vectorstores/Qdrant_Upsert/qdrant_logo.svg b/packages/components/nodes/vectorstores/Qdrant_Upsert/qdrant_logo.svg
deleted file mode 100644
index 82fb8b39..00000000
--- a/packages/components/nodes/vectorstores/Qdrant_Upsert/qdrant_logo.svg
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
diff --git a/packages/components/nodes/vectorstores/Supabase_Existing/Supabase_Exisiting.ts b/packages/components/nodes/vectorstores/Supabase_Existing/Supabase_Exisiting.ts
index 173660ca..6bea7e2a 100644
--- a/packages/components/nodes/vectorstores/Supabase_Existing/Supabase_Exisiting.ts
+++ b/packages/components/nodes/vectorstores/Supabase_Existing/Supabase_Exisiting.ts
@@ -1,6 +1,6 @@
-import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
+import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { Embeddings } from 'langchain/embeddings/base'
-import { getBaseClasses } from '../../../src/utils'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { SupabaseLibArgs, SupabaseVectorStore } from 'langchain/vectorstores/supabase'
import { createClient } from '@supabase/supabase-js'
@@ -13,6 +13,7 @@ class Supabase_Existing_VectorStores implements INode {
category: string
baseClasses: string[]
inputs: INodeParams[]
+ credential: INodeParams
outputs: INodeOutputsValue[]
constructor() {
@@ -23,17 +24,18 @@ class Supabase_Existing_VectorStores implements INode {
this.category = 'Vector Stores'
this.description = 'Load existing index from Supabase (i.e: Document has been upserted)'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['supabaseApi']
+ }
this.inputs = [
{
label: 'Embeddings',
name: 'embeddings',
type: 'Embeddings'
},
- {
- label: 'Supabase API Key',
- name: 'supabaseApiKey',
- type: 'password'
- },
{
label: 'Supabase Project URL',
name: 'supabaseProjUrl',
@@ -80,8 +82,7 @@ class Supabase_Existing_VectorStores implements INode {
]
}
- async init(nodeData: INodeData): Promise {
- const supabaseApiKey = nodeData.inputs?.supabaseApiKey as string
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const supabaseProjUrl = nodeData.inputs?.supabaseProjUrl as string
const tableName = nodeData.inputs?.tableName as string
const queryName = nodeData.inputs?.queryName as string
@@ -91,6 +92,9 @@ class Supabase_Existing_VectorStores implements INode {
const topK = nodeData.inputs?.topK as string
const k = topK ? parseInt(topK, 10) : 4
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const supabaseApiKey = getCredentialParam('supabaseApiKey', credentialData, nodeData)
+
const client = createClient(supabaseProjUrl, supabaseApiKey)
const obj: SupabaseLibArgs = {
diff --git a/packages/components/nodes/vectorstores/Supabase_Upsert/Supabase_Upsert.ts b/packages/components/nodes/vectorstores/Supabase_Upsert/Supabase_Upsert.ts
index 69997a56..40e0cc89 100644
--- a/packages/components/nodes/vectorstores/Supabase_Upsert/Supabase_Upsert.ts
+++ b/packages/components/nodes/vectorstores/Supabase_Upsert/Supabase_Upsert.ts
@@ -1,7 +1,7 @@
-import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
+import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { Embeddings } from 'langchain/embeddings/base'
import { Document } from 'langchain/document'
-import { getBaseClasses } from '../../../src/utils'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { SupabaseVectorStore } from 'langchain/vectorstores/supabase'
import { createClient } from '@supabase/supabase-js'
import { flatten } from 'lodash'
@@ -15,6 +15,7 @@ class SupabaseUpsert_VectorStores implements INode {
category: string
baseClasses: string[]
inputs: INodeParams[]
+ credential: INodeParams
outputs: INodeOutputsValue[]
constructor() {
@@ -25,6 +26,12 @@ class SupabaseUpsert_VectorStores implements INode {
this.category = 'Vector Stores'
this.description = 'Upsert documents to Supabase'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ credentialNames: ['supabaseApi']
+ }
this.inputs = [
{
label: 'Document',
@@ -37,11 +44,6 @@ class SupabaseUpsert_VectorStores implements INode {
name: 'embeddings',
type: 'Embeddings'
},
- {
- label: 'Supabase API Key',
- name: 'supabaseApiKey',
- type: 'password'
- },
{
label: 'Supabase Project URL',
name: 'supabaseProjUrl',
@@ -81,8 +83,7 @@ class SupabaseUpsert_VectorStores implements INode {
]
}
- async init(nodeData: INodeData): Promise {
- const supabaseApiKey = nodeData.inputs?.supabaseApiKey as string
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const supabaseProjUrl = nodeData.inputs?.supabaseProjUrl as string
const tableName = nodeData.inputs?.tableName as string
const queryName = nodeData.inputs?.queryName as string
@@ -92,6 +93,9 @@ class SupabaseUpsert_VectorStores implements INode {
const topK = nodeData.inputs?.topK as string
const k = topK ? parseInt(topK, 10) : 4
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const supabaseApiKey = getCredentialParam('supabaseApiKey', credentialData, nodeData)
+
const client = createClient(supabaseProjUrl, supabaseApiKey)
const flattenDocs = docs && docs.length ? flatten(docs) : []
diff --git a/packages/components/nodes/vectorstores/Weaviate_Existing/Weaviate_Existing.ts b/packages/components/nodes/vectorstores/Weaviate_Existing/Weaviate_Existing.ts
index 595691bd..3bf27d56 100644
--- a/packages/components/nodes/vectorstores/Weaviate_Existing/Weaviate_Existing.ts
+++ b/packages/components/nodes/vectorstores/Weaviate_Existing/Weaviate_Existing.ts
@@ -1,6 +1,6 @@
-import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
+import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { Embeddings } from 'langchain/embeddings/base'
-import { getBaseClasses } from '../../../src/utils'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import weaviate, { WeaviateClient, ApiKey } from 'weaviate-ts-client'
import { WeaviateLibArgs, WeaviateStore } from 'langchain/vectorstores/weaviate'
@@ -13,6 +13,7 @@ class Weaviate_Existing_VectorStores implements INode {
category: string
baseClasses: string[]
inputs: INodeParams[]
+ credential: INodeParams
outputs: INodeOutputsValue[]
constructor() {
@@ -23,6 +24,14 @@ class Weaviate_Existing_VectorStores implements INode {
this.category = 'Vector Stores'
this.description = 'Load existing index from Weaviate (i.e: Document has been upserted)'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ description: 'Only needed when using Weaviate cloud hosted',
+ optional: true,
+ credentialNames: ['weaviateApi']
+ }
this.inputs = [
{
label: 'Embeddings',
@@ -57,12 +66,6 @@ class Weaviate_Existing_VectorStores implements INode {
type: 'string',
placeholder: 'Test'
},
- {
- label: 'Weaviate API Key',
- name: 'weaviateApiKey',
- type: 'password',
- optional: true
- },
{
label: 'Weaviate Text Key',
name: 'weaviateTextKey',
@@ -104,11 +107,10 @@ class Weaviate_Existing_VectorStores implements INode {
]
}
- async init(nodeData: INodeData): Promise {
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const weaviateScheme = nodeData.inputs?.weaviateScheme as string
const weaviateHost = nodeData.inputs?.weaviateHost as string
const weaviateIndex = nodeData.inputs?.weaviateIndex as string
- const weaviateApiKey = nodeData.inputs?.weaviateApiKey as string
const weaviateTextKey = nodeData.inputs?.weaviateTextKey as string
const weaviateMetadataKeys = nodeData.inputs?.weaviateMetadataKeys as string
const embeddings = nodeData.inputs?.embeddings as Embeddings
@@ -116,6 +118,9 @@ class Weaviate_Existing_VectorStores implements INode {
const topK = nodeData.inputs?.topK as string
const k = topK ? parseInt(topK, 10) : 4
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const weaviateApiKey = getCredentialParam('weaviateApiKey', credentialData, nodeData)
+
const clientConfig: any = {
scheme: weaviateScheme,
host: weaviateHost
diff --git a/packages/components/nodes/vectorstores/Weaviate_Upsert/Weaviate_Upsert.ts b/packages/components/nodes/vectorstores/Weaviate_Upsert/Weaviate_Upsert.ts
index 06137426..07f8f2ff 100644
--- a/packages/components/nodes/vectorstores/Weaviate_Upsert/Weaviate_Upsert.ts
+++ b/packages/components/nodes/vectorstores/Weaviate_Upsert/Weaviate_Upsert.ts
@@ -1,7 +1,7 @@
-import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
+import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { Embeddings } from 'langchain/embeddings/base'
import { Document } from 'langchain/document'
-import { getBaseClasses } from '../../../src/utils'
+import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { WeaviateLibArgs, WeaviateStore } from 'langchain/vectorstores/weaviate'
import weaviate, { WeaviateClient, ApiKey } from 'weaviate-ts-client'
import { flatten } from 'lodash'
@@ -15,6 +15,7 @@ class WeaviateUpsert_VectorStores implements INode {
category: string
baseClasses: string[]
inputs: INodeParams[]
+ credential: INodeParams
outputs: INodeOutputsValue[]
constructor() {
@@ -25,6 +26,14 @@ class WeaviateUpsert_VectorStores implements INode {
this.category = 'Vector Stores'
this.description = 'Upsert documents to Weaviate'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
+ this.credential = {
+ label: 'Connect Credential',
+ name: 'credential',
+ type: 'credential',
+ description: 'Only needed when using Weaviate cloud hosted',
+ optional: true,
+ credentialNames: ['weaviateApi']
+ }
this.inputs = [
{
label: 'Document',
@@ -65,12 +74,6 @@ class WeaviateUpsert_VectorStores implements INode {
type: 'string',
placeholder: 'Test'
},
- {
- label: 'Weaviate API Key',
- name: 'weaviateApiKey',
- type: 'password',
- optional: true
- },
{
label: 'Weaviate Text Key',
name: 'weaviateTextKey',
@@ -112,11 +115,10 @@ class WeaviateUpsert_VectorStores implements INode {
]
}
- async init(nodeData: INodeData): Promise {
+ async init(nodeData: INodeData, _: string, options: ICommonObject): Promise {
const weaviateScheme = nodeData.inputs?.weaviateScheme as string
const weaviateHost = nodeData.inputs?.weaviateHost as string
const weaviateIndex = nodeData.inputs?.weaviateIndex as string
- const weaviateApiKey = nodeData.inputs?.weaviateApiKey as string
const weaviateTextKey = nodeData.inputs?.weaviateTextKey as string
const weaviateMetadataKeys = nodeData.inputs?.weaviateMetadataKeys as string
const docs = nodeData.inputs?.document as Document[]
@@ -125,6 +127,9 @@ class WeaviateUpsert_VectorStores implements INode {
const topK = nodeData.inputs?.topK as string
const k = topK ? parseInt(topK, 10) : 4
+ const credentialData = await getCredentialData(nodeData.credential ?? '', options)
+ const weaviateApiKey = getCredentialParam('weaviateApiKey', credentialData, nodeData)
+
const clientConfig: any = {
scheme: weaviateScheme,
host: weaviateHost
diff --git a/packages/components/package.json b/packages/components/package.json
index 3459a372..59013a1f 100644
--- a/packages/components/package.json
+++ b/packages/components/package.json
@@ -20,6 +20,7 @@
"@dqbd/tiktoken": "^1.0.7",
"@getzep/zep-js": "^0.3.1",
"@huggingface/inference": "^2.6.1",
+ "@notionhq/client": "^2.2.7",
"@opensearch-project/opensearch": "^1.2.0",
"@pinecone-database/pinecone": "^0.0.12",
"@qdrant/js-client-rest": "^1.2.2",
@@ -42,6 +43,7 @@
"mammoth": "^1.5.1",
"moment": "^2.29.3",
"node-fetch": "^2.6.11",
+ "notion-to-md": "^3.1.1",
"pdf-parse": "^1.1.1",
"pdfjs-dist": "^3.7.107",
"playwright": "^1.35.0",
diff --git a/packages/components/tsconfig.json b/packages/components/tsconfig.json
index 2002d62f..5ace3d9e 100644
--- a/packages/components/tsconfig.json
+++ b/packages/components/tsconfig.json
@@ -16,5 +16,5 @@
"declaration": true,
"module": "commonjs"
},
- "include": ["src", "nodes"]
+ "include": ["src", "nodes", "credentials"]
}
diff --git a/packages/server/src/NodesPool.ts b/packages/server/src/NodesPool.ts
index e339f592..62db41ba 100644
--- a/packages/server/src/NodesPool.ts
+++ b/packages/server/src/NodesPool.ts
@@ -27,7 +27,7 @@ export class NodesPool {
const nodeFiles = await this.getFiles(nodesPath)
return Promise.all(
nodeFiles.map(async (file) => {
- if (file.endsWith('.js') && !file.endsWith('.credential.js')) {
+ if (file.endsWith('.js')) {
const nodeModule = await require(file)
if (nodeModule.nodeClass) {
@@ -66,7 +66,7 @@ export class NodesPool {
*/
private async initializeCrdentials() {
const packagePath = getNodeModulesPackagePath('flowise-components')
- const nodesPath = path.join(packagePath, 'dist', 'nodes')
+ const nodesPath = path.join(packagePath, 'dist', 'credentials')
const nodeFiles = await this.getFiles(nodesPath)
return Promise.all(
nodeFiles.map(async (file) => {