diff --git a/package.json b/package.json index 804c3c96..b3545fa5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flowise", - "version": "1.4.5", + "version": "1.4.6", "private": true, "homepage": "https://flowiseai.com", "workspaces": [ diff --git a/packages/components/credentials/GoogleGenerativeAI.credential.ts b/packages/components/credentials/GoogleGenerativeAI.credential.ts new file mode 100644 index 00000000..e5ad45bf --- /dev/null +++ b/packages/components/credentials/GoogleGenerativeAI.credential.ts @@ -0,0 +1,26 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class GoogleGenerativeAICredential implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Google Generative AI' + this.name = 'googleGenerativeAI' + this.version = 1.0 + this.description = + 'You can get your API key from official page here.' + this.inputs = [ + { + label: 'Google AI API Key', + name: 'googleGenerativeAPIKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: GoogleGenerativeAICredential } diff --git a/packages/components/credentials/MistralApi.credential.ts b/packages/components/credentials/MistralApi.credential.ts new file mode 100644 index 00000000..a254f665 --- /dev/null +++ b/packages/components/credentials/MistralApi.credential.ts @@ -0,0 +1,25 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class MistralAICredential implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'MistralAI API' + this.name = 'mistralAIApi' + this.version = 1.0 + this.description = 'You can get your API key from official console here.' + this.inputs = [ + { + label: 'MistralAI API Key', + name: 'mistralAIAPIKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: MistralAICredential } diff --git a/packages/components/credentials/RedisCacheApi.credential.ts b/packages/components/credentials/RedisCacheApi.credential.ts index 4d1a2498..2b4ad618 100644 --- a/packages/components/credentials/RedisCacheApi.credential.ts +++ b/packages/components/credentials/RedisCacheApi.credential.ts @@ -35,6 +35,11 @@ class RedisCacheApi implements INodeCredential { name: 'redisCachePwd', type: 'password', placeholder: '' + }, + { + label: 'Use SSL', + name: 'redisCacheSslEnabled', + type: 'boolean' } ] } diff --git a/packages/components/nodes/agents/AirtableAgent/airtable.svg b/packages/components/nodes/agents/AirtableAgent/airtable.svg index 867c3b5a..5c2a9950 100644 --- a/packages/components/nodes/agents/AirtableAgent/airtable.svg +++ b/packages/components/nodes/agents/AirtableAgent/airtable.svg @@ -1,9 +1,5 @@ - - - - - - - - + + + + diff --git a/packages/components/nodes/agents/AutoGPT/AutoGPT.ts b/packages/components/nodes/agents/AutoGPT/AutoGPT.ts index 6c26b944..43b490f4 100644 --- a/packages/components/nodes/agents/AutoGPT/AutoGPT.ts +++ b/packages/components/nodes/agents/AutoGPT/AutoGPT.ts @@ -29,7 +29,7 @@ class AutoGPT_Agents implements INode { this.version = 1.0 this.type = 'AutoGPT' this.category = 'Agents' - this.icon = 'autogpt.png' + this.icon = 'autogpt.svg' this.description = 'Autonomous agent with chain of thoughts for self-guided task completion' this.baseClasses = ['AutoGPT'] this.inputs = [ diff --git a/packages/components/nodes/agents/AutoGPT/autogpt.png b/packages/components/nodes/agents/AutoGPT/autogpt.png deleted file mode 100644 index bdeff726..00000000 Binary files a/packages/components/nodes/agents/AutoGPT/autogpt.png and /dev/null differ diff --git a/packages/components/nodes/agents/AutoGPT/autogpt.svg b/packages/components/nodes/agents/AutoGPT/autogpt.svg new file mode 100644 index 00000000..99da2d0f --- /dev/null +++ b/packages/components/nodes/agents/AutoGPT/autogpt.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/packages/components/nodes/agents/BabyAGI/BabyAGI.ts b/packages/components/nodes/agents/BabyAGI/BabyAGI.ts index e31f31c6..f82f134b 100644 --- a/packages/components/nodes/agents/BabyAGI/BabyAGI.ts +++ b/packages/components/nodes/agents/BabyAGI/BabyAGI.ts @@ -20,7 +20,7 @@ class BabyAGI_Agents implements INode { this.version = 1.0 this.type = 'BabyAGI' this.category = 'Agents' - this.icon = 'babyagi.jpg' + this.icon = 'babyagi.svg' this.description = 'Task Driven Autonomous Agent which creates new task and reprioritizes task list based on objective' this.baseClasses = ['BabyAGI'] this.inputs = [ diff --git a/packages/components/nodes/agents/BabyAGI/babyagi.jpg b/packages/components/nodes/agents/BabyAGI/babyagi.jpg deleted file mode 100644 index cd585139..00000000 Binary files a/packages/components/nodes/agents/BabyAGI/babyagi.jpg and /dev/null differ diff --git a/packages/components/nodes/agents/BabyAGI/babyagi.svg b/packages/components/nodes/agents/BabyAGI/babyagi.svg new file mode 100644 index 00000000..2fadd1b9 --- /dev/null +++ b/packages/components/nodes/agents/BabyAGI/babyagi.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/components/nodes/agents/CSVAgent/CSVAgent.ts b/packages/components/nodes/agents/CSVAgent/CSVAgent.ts index 5baad2ec..70996c4d 100644 --- a/packages/components/nodes/agents/CSVAgent/CSVAgent.ts +++ b/packages/components/nodes/agents/CSVAgent/CSVAgent.ts @@ -23,7 +23,7 @@ class CSV_Agents implements INode { this.version = 1.0 this.type = 'AgentExecutor' this.category = 'Agents' - this.icon = 'csvagent.png' + this.icon = 'CSVagent.svg' this.description = 'Agent used to to answer queries on CSV data' this.baseClasses = [this.type, ...getBaseClasses(AgentExecutor)] this.inputs = [ diff --git a/packages/components/nodes/agents/CSVAgent/CSVagent.svg b/packages/components/nodes/agents/CSVAgent/CSVagent.svg new file mode 100644 index 00000000..f57bd886 --- /dev/null +++ b/packages/components/nodes/agents/CSVAgent/CSVagent.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/components/nodes/agents/CSVAgent/csvagent.png b/packages/components/nodes/agents/CSVAgent/csvagent.png deleted file mode 100644 index 3ed16bb2..00000000 Binary files a/packages/components/nodes/agents/CSVAgent/csvagent.png and /dev/null differ diff --git a/packages/components/nodes/agents/ConversationalAgent/agent.svg b/packages/components/nodes/agents/ConversationalAgent/agent.svg index c87861e5..62fd4a65 100644 --- a/packages/components/nodes/agents/ConversationalAgent/agent.svg +++ b/packages/components/nodes/agents/ConversationalAgent/agent.svg @@ -1,9 +1,7 @@ - - - - - - - - - \ No newline at end of file + + + + + + + diff --git a/packages/components/nodes/agents/ConversationalRetrievalAgent/agent.svg b/packages/components/nodes/agents/ConversationalRetrievalAgent/agent.svg index c87861e5..62fd4a65 100644 --- a/packages/components/nodes/agents/ConversationalRetrievalAgent/agent.svg +++ b/packages/components/nodes/agents/ConversationalRetrievalAgent/agent.svg @@ -1,9 +1,7 @@ - - - - - - - - - \ No newline at end of file + + + + + + + diff --git a/packages/components/nodes/agents/MRKLAgentChat/agent.svg b/packages/components/nodes/agents/MRKLAgentChat/agent.svg index c87861e5..62fd4a65 100644 --- a/packages/components/nodes/agents/MRKLAgentChat/agent.svg +++ b/packages/components/nodes/agents/MRKLAgentChat/agent.svg @@ -1,9 +1,7 @@ - - - - - - - - - \ No newline at end of file + + + + + + + diff --git a/packages/components/nodes/agents/MRKLAgentLLM/agent.svg b/packages/components/nodes/agents/MRKLAgentLLM/agent.svg index c87861e5..62fd4a65 100644 --- a/packages/components/nodes/agents/MRKLAgentLLM/agent.svg +++ b/packages/components/nodes/agents/MRKLAgentLLM/agent.svg @@ -1,9 +1,7 @@ - - - - - - - - - \ No newline at end of file + + + + + + + diff --git a/packages/components/nodes/agents/OpenAIAssistant/OpenAIAssistant.ts b/packages/components/nodes/agents/OpenAIAssistant/OpenAIAssistant.ts index d4426394..42686ae0 100644 --- a/packages/components/nodes/agents/OpenAIAssistant/OpenAIAssistant.ts +++ b/packages/components/nodes/agents/OpenAIAssistant/OpenAIAssistant.ts @@ -27,7 +27,7 @@ class OpenAIAssistant_Agents implements INode { this.version = 2.0 this.type = 'OpenAIAssistant' this.category = 'Agents' - this.icon = 'openai.png' + this.icon = 'assistant.svg' this.description = `An agent that uses OpenAI Assistant API to pick the tool and args to call` this.baseClasses = [this.type] this.inputs = [ diff --git a/packages/components/nodes/agents/OpenAIAssistant/assistant.svg b/packages/components/nodes/agents/OpenAIAssistant/assistant.svg new file mode 100644 index 00000000..ddef9617 --- /dev/null +++ b/packages/components/nodes/agents/OpenAIAssistant/assistant.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/packages/components/nodes/agents/OpenAIAssistant/openai.png b/packages/components/nodes/agents/OpenAIAssistant/openai.png deleted file mode 100644 index de08a05b..00000000 Binary files a/packages/components/nodes/agents/OpenAIAssistant/openai.png and /dev/null differ diff --git a/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts b/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts index 96ba7ea3..c019ca5a 100644 --- a/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts +++ b/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts @@ -23,7 +23,7 @@ class OpenAIFunctionAgent_Agents implements INode { this.version = 3.0 this.type = 'AgentExecutor' this.category = 'Agents' - this.icon = 'openai.png' + this.icon = 'function.svg' this.description = `An agent that uses Function Calling to pick the tool and args to call` this.baseClasses = [this.type, ...getBaseClasses(AgentExecutor)] this.inputs = [ diff --git a/packages/components/nodes/agents/OpenAIFunctionAgent/function.svg b/packages/components/nodes/agents/OpenAIFunctionAgent/function.svg new file mode 100644 index 00000000..9e283b91 --- /dev/null +++ b/packages/components/nodes/agents/OpenAIFunctionAgent/function.svg @@ -0,0 +1,9 @@ + + + + + + + + + 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/analytic/LLMonitor/LLMonitor.ts b/packages/components/nodes/analytic/LLMonitor/LLMonitor.ts index a1ae317c..93bfbbf3 100644 --- a/packages/components/nodes/analytic/LLMonitor/LLMonitor.ts +++ b/packages/components/nodes/analytic/LLMonitor/LLMonitor.ts @@ -17,7 +17,7 @@ class LLMonitor_Analytic implements INode { this.name = 'llmonitor' this.version = 1.0 this.type = 'LLMonitor' - this.icon = 'llmonitor.png' + this.icon = 'Lunary.svg' this.category = 'Analytic' this.baseClasses = [this.type] this.inputs = [] diff --git a/packages/components/nodes/analytic/LLMonitor/Lunary.svg b/packages/components/nodes/analytic/LLMonitor/Lunary.svg new file mode 100644 index 00000000..1528de5a --- /dev/null +++ b/packages/components/nodes/analytic/LLMonitor/Lunary.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/components/nodes/analytic/LLMonitor/llmonitor.png b/packages/components/nodes/analytic/LLMonitor/llmonitor.png deleted file mode 100644 index d50a7044..00000000 Binary files a/packages/components/nodes/analytic/LLMonitor/llmonitor.png and /dev/null differ diff --git a/packages/components/nodes/analytic/LangFuse/LangFuse.ts b/packages/components/nodes/analytic/LangFuse/LangFuse.ts index dcfc3d2a..52e1ea52 100644 --- a/packages/components/nodes/analytic/LangFuse/LangFuse.ts +++ b/packages/components/nodes/analytic/LangFuse/LangFuse.ts @@ -17,7 +17,7 @@ class LangFuse_Analytic implements INode { this.name = 'langFuse' this.version = 1.0 this.type = 'LangFuse' - this.icon = 'langfuse.png' + this.icon = 'Langfuse.svg' this.category = 'Analytic' this.baseClasses = [this.type] this.inputs = [] diff --git a/packages/components/nodes/analytic/LangFuse/Langfuse.svg b/packages/components/nodes/analytic/LangFuse/Langfuse.svg new file mode 100644 index 00000000..7ebb4402 --- /dev/null +++ b/packages/components/nodes/analytic/LangFuse/Langfuse.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/components/nodes/analytic/LangFuse/langfuse.png b/packages/components/nodes/analytic/LangFuse/langfuse.png deleted file mode 100644 index df9181b8..00000000 Binary files a/packages/components/nodes/analytic/LangFuse/langfuse.png and /dev/null differ diff --git a/packages/components/nodes/cache/InMemoryCache/InMemoryCache.ts b/packages/components/nodes/cache/InMemoryCache/InMemoryCache.ts index 1ea03566..a8aa9fd4 100644 --- a/packages/components/nodes/cache/InMemoryCache/InMemoryCache.ts +++ b/packages/components/nodes/cache/InMemoryCache/InMemoryCache.ts @@ -20,7 +20,7 @@ class InMemoryCache implements INode { this.version = 1.0 this.type = 'InMemoryCache' this.description = 'Cache LLM response in memory, will be cleared once app restarted' - this.icon = 'inmemorycache.png' + this.icon = 'Memory.svg' this.category = 'Cache' this.baseClasses = [this.type, ...getBaseClasses(InMemoryCacheExtended)] this.inputs = [] diff --git a/packages/components/nodes/cache/InMemoryCache/InMemoryEmbeddingCache.ts b/packages/components/nodes/cache/InMemoryCache/InMemoryEmbeddingCache.ts index fad72482..f83fca3d 100644 --- a/packages/components/nodes/cache/InMemoryCache/InMemoryEmbeddingCache.ts +++ b/packages/components/nodes/cache/InMemoryCache/InMemoryEmbeddingCache.ts @@ -21,7 +21,7 @@ class InMemoryEmbeddingCache implements INode { this.version = 1.0 this.type = 'InMemoryEmbeddingCache' this.description = 'Cache generated Embeddings in memory to avoid needing to recompute them.' - this.icon = 'inmemorycache.png' + this.icon = 'Memory.svg' this.category = 'Cache' this.baseClasses = [this.type, ...getBaseClasses(CacheBackedEmbeddings)] this.inputs = [ diff --git a/packages/components/nodes/cache/InMemoryCache/Memory.svg b/packages/components/nodes/cache/InMemoryCache/Memory.svg new file mode 100644 index 00000000..cc97b9e6 --- /dev/null +++ b/packages/components/nodes/cache/InMemoryCache/Memory.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/packages/components/nodes/cache/InMemoryCache/inmemorycache.png b/packages/components/nodes/cache/InMemoryCache/inmemorycache.png deleted file mode 100644 index 1e5fe6d1..00000000 Binary files a/packages/components/nodes/cache/InMemoryCache/inmemorycache.png and /dev/null differ diff --git a/packages/components/nodes/cache/MomentoCache/Momento.svg b/packages/components/nodes/cache/MomentoCache/Momento.svg new file mode 100644 index 00000000..22e9474d --- /dev/null +++ b/packages/components/nodes/cache/MomentoCache/Momento.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/components/nodes/cache/MomentoCache/MomentoCache.ts b/packages/components/nodes/cache/MomentoCache/MomentoCache.ts index 2bd2625b..8b4ce416 100644 --- a/packages/components/nodes/cache/MomentoCache/MomentoCache.ts +++ b/packages/components/nodes/cache/MomentoCache/MomentoCache.ts @@ -20,7 +20,7 @@ class MomentoCache implements INode { this.version = 1.0 this.type = 'MomentoCache' this.description = 'Cache LLM response using Momento, a distributed, serverless cache' - this.icon = 'momento.png' + this.icon = 'Momento.svg' this.category = 'Cache' this.baseClasses = [this.type, ...getBaseClasses(LangchainMomentoCache)] this.credential = { diff --git a/packages/components/nodes/cache/MomentoCache/momento.png b/packages/components/nodes/cache/MomentoCache/momento.png deleted file mode 100644 index 0f2b54b6..00000000 Binary files a/packages/components/nodes/cache/MomentoCache/momento.png and /dev/null differ diff --git a/packages/components/nodes/cache/RedisCache/RedisCache.ts b/packages/components/nodes/cache/RedisCache/RedisCache.ts index 8128b6e3..4e61c239 100644 --- a/packages/components/nodes/cache/RedisCache/RedisCache.ts +++ b/packages/components/nodes/cache/RedisCache/RedisCache.ts @@ -56,12 +56,16 @@ class RedisCache implements INode { const password = getCredentialParam('redisCachePwd', credentialData, nodeData) const portStr = getCredentialParam('redisCachePort', credentialData, nodeData) const host = getCredentialParam('redisCacheHost', credentialData, nodeData) + const sslEnabled = getCredentialParam('redisCacheSslEnabled', credentialData, nodeData) + + const tlsOptions = sslEnabled === true ? { tls: { rejectUnauthorized: false } } : {} client = new Redis({ port: portStr ? parseInt(portStr) : 6379, host, username, - password + password, + ...tlsOptions }) } else { client = new Redis(redisUrl) diff --git a/packages/components/nodes/cache/RedisCache/RedisEmbeddingsCache.ts b/packages/components/nodes/cache/RedisCache/RedisEmbeddingsCache.ts index f15869d7..fe1b4df8 100644 --- a/packages/components/nodes/cache/RedisCache/RedisEmbeddingsCache.ts +++ b/packages/components/nodes/cache/RedisCache/RedisEmbeddingsCache.ts @@ -71,12 +71,16 @@ class RedisEmbeddingsCache implements INode { const password = getCredentialParam('redisCachePwd', credentialData, nodeData) const portStr = getCredentialParam('redisCachePort', credentialData, nodeData) const host = getCredentialParam('redisCacheHost', credentialData, nodeData) + const sslEnabled = getCredentialParam('redisCacheSslEnabled', credentialData, nodeData) + + const tlsOptions = sslEnabled === true ? { tls: { rejectUnauthorized: false } } : {} client = new Redis({ port: portStr ? parseInt(portStr) : 6379, host, username, - password + password, + ...tlsOptions }) } else { client = new Redis(redisUrl) diff --git a/packages/components/nodes/cache/RedisCache/redis.svg b/packages/components/nodes/cache/RedisCache/redis.svg index 90359069..b94c650f 100644 --- a/packages/components/nodes/cache/RedisCache/redis.svg +++ b/packages/components/nodes/cache/RedisCache/redis.svg @@ -1 +1,12 @@ - \ No newline at end of file + + + + + + + + + + + + diff --git a/packages/components/nodes/cache/UpstashRedisCache/Upstash.svg b/packages/components/nodes/cache/UpstashRedisCache/Upstash.svg new file mode 100644 index 00000000..582d151a --- /dev/null +++ b/packages/components/nodes/cache/UpstashRedisCache/Upstash.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/components/nodes/cache/UpstashRedisCache/UpstashRedisCache.ts b/packages/components/nodes/cache/UpstashRedisCache/UpstashRedisCache.ts index f4ed947b..311979c2 100644 --- a/packages/components/nodes/cache/UpstashRedisCache/UpstashRedisCache.ts +++ b/packages/components/nodes/cache/UpstashRedisCache/UpstashRedisCache.ts @@ -19,7 +19,7 @@ class UpstashRedisCache implements INode { this.version = 1.0 this.type = 'UpstashRedisCache' this.description = 'Cache LLM response in Upstash Redis, serverless data for Redis and Kafka' - this.icon = 'upstash.png' + this.icon = 'Upstash.svg' this.category = 'Cache' this.baseClasses = [this.type, ...getBaseClasses(LangchainUpstashRedisCache)] this.credential = { diff --git a/packages/components/nodes/cache/UpstashRedisCache/upstash.png b/packages/components/nodes/cache/UpstashRedisCache/upstash.png deleted file mode 100644 index e27e02f4..00000000 Binary files a/packages/components/nodes/cache/UpstashRedisCache/upstash.png and /dev/null differ diff --git a/packages/components/nodes/chains/ApiChain/GETApiChain.ts b/packages/components/nodes/chains/ApiChain/GETApiChain.ts index d88ab6f9..3494fa1c 100644 --- a/packages/components/nodes/chains/ApiChain/GETApiChain.ts +++ b/packages/components/nodes/chains/ApiChain/GETApiChain.ts @@ -32,7 +32,7 @@ class GETApiChain_Chains implements INode { this.name = 'getApiChain' this.version = 1.0 this.type = 'GETApiChain' - this.icon = 'apichain.svg' + this.icon = 'get.svg' this.category = 'Chains' this.description = 'Chain to run queries against GET API' this.baseClasses = [this.type, ...getBaseClasses(APIChain)] diff --git a/packages/components/nodes/chains/ApiChain/OpenAPIChain.ts b/packages/components/nodes/chains/ApiChain/OpenAPIChain.ts index 08dc3cc8..51459daa 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.name = 'openApiChain' this.version = 1.0 this.type = 'OpenAPIChain' - this.icon = 'openapi.png' + this.icon = 'openapi.svg' this.category = 'Chains' this.description = 'Chain that automatically select and call APIs based only on an OpenAPI spec' this.baseClasses = [this.type, ...getBaseClasses(APIChain)] diff --git a/packages/components/nodes/chains/ApiChain/POSTApiChain.ts b/packages/components/nodes/chains/ApiChain/POSTApiChain.ts index f005f47a..309b3310 100644 --- a/packages/components/nodes/chains/ApiChain/POSTApiChain.ts +++ b/packages/components/nodes/chains/ApiChain/POSTApiChain.ts @@ -21,7 +21,7 @@ class POSTApiChain_Chains implements INode { this.name = 'postApiChain' this.version = 1.0 this.type = 'POSTApiChain' - this.icon = 'apichain.svg' + this.icon = 'post.svg' this.category = 'Chains' this.description = 'Chain to run queries against POST API' this.baseClasses = [this.type, ...getBaseClasses(APIChain)] diff --git a/packages/components/nodes/chains/ApiChain/apichain.svg b/packages/components/nodes/chains/ApiChain/apichain.svg deleted file mode 100644 index 3b86b905..00000000 --- a/packages/components/nodes/chains/ApiChain/apichain.svg +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/packages/components/nodes/chains/ApiChain/get.svg b/packages/components/nodes/chains/ApiChain/get.svg new file mode 100644 index 00000000..0adfdaa8 --- /dev/null +++ b/packages/components/nodes/chains/ApiChain/get.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/components/nodes/chains/ApiChain/openapi.png b/packages/components/nodes/chains/ApiChain/openapi.png deleted file mode 100644 index 457c2e40..00000000 Binary files a/packages/components/nodes/chains/ApiChain/openapi.png and /dev/null differ diff --git a/packages/components/nodes/chains/ApiChain/openapi.svg b/packages/components/nodes/chains/ApiChain/openapi.svg new file mode 100644 index 00000000..0f623b94 --- /dev/null +++ b/packages/components/nodes/chains/ApiChain/openapi.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/components/nodes/chains/ApiChain/post.svg b/packages/components/nodes/chains/ApiChain/post.svg new file mode 100644 index 00000000..250ce69a --- /dev/null +++ b/packages/components/nodes/chains/ApiChain/post.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/components/nodes/chains/ConversationChain/ConversationChain.ts b/packages/components/nodes/chains/ConversationChain/ConversationChain.ts index 7887ce97..54d4252a 100644 --- a/packages/components/nodes/chains/ConversationChain/ConversationChain.ts +++ b/packages/components/nodes/chains/ConversationChain/ConversationChain.ts @@ -26,7 +26,7 @@ class ConversationChain_Chains implements INode { this.name = 'conversationChain' this.version = 1.0 this.type = 'ConversationChain' - this.icon = 'chain.svg' + this.icon = 'conv.svg' this.category = 'Chains' this.description = 'Chat models specific conversational chain with memory' this.baseClasses = [this.type, ...getBaseClasses(ConversationChain)] diff --git a/packages/components/nodes/chains/ConversationChain/chain.svg b/packages/components/nodes/chains/ConversationChain/chain.svg deleted file mode 100644 index a5b32f90..00000000 --- a/packages/components/nodes/chains/ConversationChain/chain.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/packages/components/nodes/chains/ConversationChain/conv.svg b/packages/components/nodes/chains/ConversationChain/conv.svg new file mode 100644 index 00000000..5f6c5a47 --- /dev/null +++ b/packages/components/nodes/chains/ConversationChain/conv.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/components/nodes/chains/ConversationalRetrievalQAChain/ConversationalRetrievalQAChain.ts b/packages/components/nodes/chains/ConversationalRetrievalQAChain/ConversationalRetrievalQAChain.ts index 9a8c1b18..36376e13 100644 --- a/packages/components/nodes/chains/ConversationalRetrievalQAChain/ConversationalRetrievalQAChain.ts +++ b/packages/components/nodes/chains/ConversationalRetrievalQAChain/ConversationalRetrievalQAChain.ts @@ -32,7 +32,7 @@ class ConversationalRetrievalQAChain_Chains implements INode { this.name = 'conversationalRetrievalQAChain' this.version = 1.0 this.type = 'ConversationalRetrievalQAChain' - this.icon = 'chain.svg' + this.icon = 'qa.svg' this.category = 'Chains' this.description = 'Document QA - built on RetrievalQAChain to provide a chat history component' this.baseClasses = [this.type, ...getBaseClasses(ConversationalRetrievalQAChain)] diff --git a/packages/components/nodes/chains/ConversationalRetrievalQAChain/chain.svg b/packages/components/nodes/chains/ConversationalRetrievalQAChain/chain.svg deleted file mode 100644 index a5b32f90..00000000 --- a/packages/components/nodes/chains/ConversationalRetrievalQAChain/chain.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/packages/components/nodes/chains/ConversationalRetrievalQAChain/qa.svg b/packages/components/nodes/chains/ConversationalRetrievalQAChain/qa.svg new file mode 100644 index 00000000..b367f7bc --- /dev/null +++ b/packages/components/nodes/chains/ConversationalRetrievalQAChain/qa.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/components/nodes/chains/LLMChain/LLMChain.ts b/packages/components/nodes/chains/LLMChain/LLMChain.ts index fd398151..b7c055e4 100644 --- a/packages/components/nodes/chains/LLMChain/LLMChain.ts +++ b/packages/components/nodes/chains/LLMChain/LLMChain.ts @@ -27,7 +27,7 @@ class LLMChain_Chains implements INode { this.name = 'llmChain' this.version = 3.0 this.type = 'LLMChain' - this.icon = 'chain.svg' + this.icon = 'LLM_Chain.svg' this.category = 'Chains' this.description = 'Chain to run queries against LLMs' this.baseClasses = [this.type, ...getBaseClasses(LLMChain)] diff --git a/packages/components/nodes/chains/LLMChain/LLM_Chain.svg b/packages/components/nodes/chains/LLMChain/LLM_Chain.svg new file mode 100644 index 00000000..5d4b56f5 --- /dev/null +++ b/packages/components/nodes/chains/LLMChain/LLM_Chain.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/components/nodes/chains/MultiPromptChain/MultiPromptChain.ts b/packages/components/nodes/chains/MultiPromptChain/MultiPromptChain.ts index d171e514..72c25566 100644 --- a/packages/components/nodes/chains/MultiPromptChain/MultiPromptChain.ts +++ b/packages/components/nodes/chains/MultiPromptChain/MultiPromptChain.ts @@ -20,7 +20,7 @@ class MultiPromptChain_Chains implements INode { this.name = 'multiPromptChain' this.version = 1.0 this.type = 'MultiPromptChain' - this.icon = 'chain.svg' + this.icon = 'prompt.svg' this.category = 'Chains' this.description = 'Chain automatically picks an appropriate prompt from multiple prompt templates' this.baseClasses = [this.type, ...getBaseClasses(MultiPromptChain)] diff --git a/packages/components/nodes/chains/MultiPromptChain/chain.svg b/packages/components/nodes/chains/MultiPromptChain/chain.svg deleted file mode 100644 index a5b32f90..00000000 --- a/packages/components/nodes/chains/MultiPromptChain/chain.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/packages/components/nodes/chains/MultiPromptChain/prompt.svg b/packages/components/nodes/chains/MultiPromptChain/prompt.svg new file mode 100644 index 00000000..cf51913f --- /dev/null +++ b/packages/components/nodes/chains/MultiPromptChain/prompt.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/components/nodes/chains/MultiRetrievalQAChain/MultiRetrievalQAChain.ts b/packages/components/nodes/chains/MultiRetrievalQAChain/MultiRetrievalQAChain.ts index 93bf2255..a2cfc309 100644 --- a/packages/components/nodes/chains/MultiRetrievalQAChain/MultiRetrievalQAChain.ts +++ b/packages/components/nodes/chains/MultiRetrievalQAChain/MultiRetrievalQAChain.ts @@ -20,7 +20,7 @@ class MultiRetrievalQAChain_Chains implements INode { this.name = 'multiRetrievalQAChain' this.version = 1.0 this.type = 'MultiRetrievalQAChain' - this.icon = 'chain.svg' + this.icon = 'qa.svg' this.category = 'Chains' this.description = 'QA Chain that automatically picks an appropriate vector store from multiple retrievers' this.baseClasses = [this.type, ...getBaseClasses(MultiRetrievalQAChain)] diff --git a/packages/components/nodes/chains/MultiRetrievalQAChain/chain.svg b/packages/components/nodes/chains/MultiRetrievalQAChain/chain.svg deleted file mode 100644 index a5b32f90..00000000 --- a/packages/components/nodes/chains/MultiRetrievalQAChain/chain.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/packages/components/nodes/chains/MultiRetrievalQAChain/qa.svg b/packages/components/nodes/chains/MultiRetrievalQAChain/qa.svg new file mode 100644 index 00000000..b367f7bc --- /dev/null +++ b/packages/components/nodes/chains/MultiRetrievalQAChain/qa.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/components/nodes/chains/RetrievalQAChain/RetrievalQAChain.ts b/packages/components/nodes/chains/RetrievalQAChain/RetrievalQAChain.ts index bff2a0a7..7f13fcfd 100644 --- a/packages/components/nodes/chains/RetrievalQAChain/RetrievalQAChain.ts +++ b/packages/components/nodes/chains/RetrievalQAChain/RetrievalQAChain.ts @@ -21,7 +21,7 @@ class RetrievalQAChain_Chains implements INode { this.name = 'retrievalQAChain' this.version = 1.0 this.type = 'RetrievalQAChain' - this.icon = 'chain.svg' + this.icon = 'qa.svg' this.category = 'Chains' this.description = 'QA chain to answer a question based on the retrieved documents' this.baseClasses = [this.type, ...getBaseClasses(RetrievalQAChain)] diff --git a/packages/components/nodes/chains/RetrievalQAChain/chain.svg b/packages/components/nodes/chains/RetrievalQAChain/chain.svg deleted file mode 100644 index a5b32f90..00000000 --- a/packages/components/nodes/chains/RetrievalQAChain/chain.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/packages/components/nodes/chains/RetrievalQAChain/qa.svg b/packages/components/nodes/chains/RetrievalQAChain/qa.svg new file mode 100644 index 00000000..b367f7bc --- /dev/null +++ b/packages/components/nodes/chains/RetrievalQAChain/qa.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/components/nodes/chains/SqlDatabaseChain/sqlchain.svg b/packages/components/nodes/chains/SqlDatabaseChain/sqlchain.svg index dcf937b3..68758320 100644 --- a/packages/components/nodes/chains/SqlDatabaseChain/sqlchain.svg +++ b/packages/components/nodes/chains/SqlDatabaseChain/sqlchain.svg @@ -1,7 +1,7 @@ - - - - - - - \ No newline at end of file + + + + + + + diff --git a/packages/components/nodes/chains/VectorDBQAChain/VectorDBQAChain.ts b/packages/components/nodes/chains/VectorDBQAChain/VectorDBQAChain.ts index 13de17dc..594ed921 100644 --- a/packages/components/nodes/chains/VectorDBQAChain/VectorDBQAChain.ts +++ b/packages/components/nodes/chains/VectorDBQAChain/VectorDBQAChain.ts @@ -21,7 +21,7 @@ class VectorDBQAChain_Chains implements INode { this.name = 'vectorDBQAChain' this.version = 1.0 this.type = 'VectorDBQAChain' - this.icon = 'chain.svg' + this.icon = 'vectordb.svg' this.category = 'Chains' this.description = 'QA chain for vector databases' this.baseClasses = [this.type, ...getBaseClasses(VectorDBQAChain)] diff --git a/packages/components/nodes/chains/VectorDBQAChain/chain.svg b/packages/components/nodes/chains/VectorDBQAChain/chain.svg deleted file mode 100644 index a5b32f90..00000000 --- a/packages/components/nodes/chains/VectorDBQAChain/chain.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/packages/components/nodes/chains/VectorDBQAChain/vectordb.svg b/packages/components/nodes/chains/VectorDBQAChain/vectordb.svg new file mode 100644 index 00000000..7add9f8d --- /dev/null +++ b/packages/components/nodes/chains/VectorDBQAChain/vectordb.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/components/nodes/chatmodels/AWSBedrock/AWSChatBedrock.ts b/packages/components/nodes/chatmodels/AWSBedrock/AWSChatBedrock.ts index 956fcdb3..fedd731d 100644 --- a/packages/components/nodes/chatmodels/AWSBedrock/AWSChatBedrock.ts +++ b/packages/components/nodes/chatmodels/AWSBedrock/AWSChatBedrock.ts @@ -1,9 +1,9 @@ import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' -import { ChatBedrock } from 'langchain/chat_models/bedrock' +import { BedrockChat } from 'langchain/chat_models/bedrock' import { BaseBedrockInput } from 'langchain/dist/util/bedrock' import { BaseCache } from 'langchain/schema' -import { BaseLLMParams } from 'langchain/llms/base' +import { BaseChatModelParams } from 'langchain/chat_models/base' /** * I had to run the following to build the component @@ -25,14 +25,14 @@ class AWSChatBedrock_ChatModels implements INode { inputs: INodeParams[] constructor() { - this.label = 'AWS Bedrock' + this.label = 'AWS ChatBedrock' this.name = 'awsChatBedrock' this.version = 3.0 this.type = 'AWSChatBedrock' - this.icon = 'awsBedrock.png' + this.icon = 'aws.svg' this.category = 'Chat Models' this.description = 'Wrapper around AWS Bedrock large language models that use the Chat endpoint' - this.baseClasses = [this.type, ...getBaseClasses(ChatBedrock)] + this.baseClasses = [this.type, ...getBaseClasses(BedrockChat)] this.credential = { label: 'AWS Credential', name: 'credential', @@ -102,6 +102,13 @@ class AWSChatBedrock_ChatModels implements INode { ], default: 'anthropic.claude-v2' }, + { + label: 'Custom Model Name', + name: 'customModel', + description: 'If provided, will override model selected from Model Name option', + type: 'string', + optional: true + }, { label: 'Temperature', name: 'temperature', @@ -109,6 +116,7 @@ class AWSChatBedrock_ChatModels implements INode { step: 0.1, description: 'Temperature parameter may not apply to certain model. Please check available model parameters', optional: true, + additionalParams: true, default: 0.7 }, { @@ -118,6 +126,7 @@ class AWSChatBedrock_ChatModels implements INode { step: 10, description: 'Max Tokens parameter may not apply to certain model. Please check available model parameters', optional: true, + additionalParams: true, default: 200 } ] @@ -126,14 +135,15 @@ class AWSChatBedrock_ChatModels implements INode { async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const iRegion = nodeData.inputs?.region as string const iModel = nodeData.inputs?.model as string + const customModel = nodeData.inputs?.customModel as string const iTemperature = nodeData.inputs?.temperature as string const iMax_tokens_to_sample = nodeData.inputs?.max_tokens_to_sample as string const cache = nodeData.inputs?.cache as BaseCache const streaming = nodeData.inputs?.streaming as boolean - const obj: BaseBedrockInput & BaseLLMParams = { + const obj: BaseBedrockInput & BaseChatModelParams = { region: iRegion, - model: iModel, + model: customModel ? customModel : iModel, maxTokens: parseInt(iMax_tokens_to_sample, 10), temperature: parseFloat(iTemperature), streaming: streaming ?? true @@ -160,7 +170,7 @@ class AWSChatBedrock_ChatModels implements INode { } if (cache) obj.cache = cache - const amazonBedrock = new ChatBedrock(obj) + const amazonBedrock = new BedrockChat(obj) return amazonBedrock } } diff --git a/packages/components/nodes/chatmodels/AWSBedrock/aws.svg b/packages/components/nodes/chatmodels/AWSBedrock/aws.svg new file mode 100644 index 00000000..0e630a3b --- /dev/null +++ b/packages/components/nodes/chatmodels/AWSBedrock/aws.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/components/nodes/chatmodels/AWSBedrock/awsBedrock.png b/packages/components/nodes/chatmodels/AWSBedrock/awsBedrock.png deleted file mode 100644 index 483bc69a..00000000 Binary files a/packages/components/nodes/chatmodels/AWSBedrock/awsBedrock.png and /dev/null differ diff --git a/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/ChatGoogleGenerativeAI.ts b/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/ChatGoogleGenerativeAI.ts new file mode 100644 index 00000000..7044645f --- /dev/null +++ b/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/ChatGoogleGenerativeAI.ts @@ -0,0 +1,107 @@ +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' +import { BaseCache } from 'langchain/schema' +import { ChatGoogleGenerativeAI } from '@langchain/google-genai' + +class GoogleGenerativeAI_ChatModels implements INode { + label: string + name: string + version: number + type: string + icon: string + category: string + description: string + baseClasses: string[] + credential: INodeParams + inputs: INodeParams[] + + constructor() { + this.label = 'ChatGoogleGenerativeAI' + this.name = 'chatGoogleGenerativeAI' + this.version = 1.0 + this.type = 'ChatGoogleGenerativeAI' + this.icon = 'gemini.png' + this.category = 'Chat Models' + this.description = 'Wrapper around Google Gemini large language models that use the Chat endpoint' + this.baseClasses = [this.type, ...getBaseClasses(ChatGoogleGenerativeAI)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['googleGenerativeAI'], + optional: false, + description: 'Google Generative AI credential.' + } + this.inputs = [ + { + label: 'Cache', + name: 'cache', + type: 'BaseCache', + optional: true + }, + { + label: 'Model Name', + name: 'modelName', + type: 'options', + options: [ + { + label: 'gemini-pro', + name: 'gemini-pro' + } + ], + default: 'gemini-pro' + }, + { + label: 'Temperature', + name: 'temperature', + type: 'number', + step: 0.1, + default: 0.9, + optional: true + }, + { + label: 'Max Output Tokens', + name: 'maxOutputTokens', + type: 'number', + step: 1, + optional: true, + additionalParams: true + }, + { + label: 'Top Probability', + name: 'topP', + type: 'number', + step: 0.1, + optional: true, + additionalParams: true + } + ] + } + + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const apiKey = getCredentialParam('googleGenerativeAPIKey', credentialData, nodeData) + + const temperature = nodeData.inputs?.temperature as string + const modelName = nodeData.inputs?.modelName as string + const maxOutputTokens = nodeData.inputs?.maxOutputTokens as string + const topP = nodeData.inputs?.topP as string + const cache = nodeData.inputs?.cache as BaseCache + + const obj = { + apiKey: apiKey, + modelName: modelName, + maxOutputTokens: 2048 + } + + if (maxOutputTokens) obj.maxOutputTokens = parseInt(maxOutputTokens, 10) + + const model = new ChatGoogleGenerativeAI(obj) + if (topP) model.topP = parseFloat(topP) + if (cache) model.cache = cache + if (temperature) model.temperature = parseFloat(temperature) + return model + } +} + +module.exports = { nodeClass: GoogleGenerativeAI_ChatModels } diff --git a/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/gemini.png b/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/gemini.png new file mode 100644 index 00000000..6c0d60f4 Binary files /dev/null and b/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/gemini.png differ diff --git a/packages/components/nodes/chatmodels/ChatMistral/ChatMistral.ts b/packages/components/nodes/chatmodels/ChatMistral/ChatMistral.ts new file mode 100644 index 00000000..2548dd99 --- /dev/null +++ b/packages/components/nodes/chatmodels/ChatMistral/ChatMistral.ts @@ -0,0 +1,150 @@ +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' +import { BaseCache } from 'langchain/schema' +import { ChatMistralAI, ChatMistralAIInput } from '@langchain/mistralai' + +class ChatMistral_ChatModels implements INode { + label: string + name: string + version: number + type: string + icon: string + category: string + description: string + baseClasses: string[] + credential: INodeParams + inputs: INodeParams[] + + constructor() { + this.label = 'ChatMistralAI' + this.name = 'chatMistralAI' + this.version = 1.0 + this.type = 'ChatMistralAI' + this.icon = 'mistralai.png' + this.category = 'Chat Models' + this.description = 'Wrapper around Mistral large language models that use the Chat endpoint' + this.baseClasses = [this.type, ...getBaseClasses(ChatMistralAI)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['mistralAIApi'] + } + this.inputs = [ + { + label: 'Cache', + name: 'cache', + type: 'BaseCache', + optional: true + }, + { + label: 'Model Name', + name: 'modelName', + type: 'options', + options: [ + { + label: 'mistral-tiny', + name: 'mistral-tiny' + }, + { + label: 'mistral-small', + name: 'mistral-small' + }, + { + label: 'mistral-medium', + name: 'mistral-medium' + } + ], + default: 'mistral-tiny' + }, + { + label: 'Temperature', + name: 'temperature', + type: 'number', + description: + 'What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.', + step: 0.1, + default: 0.9, + optional: true + }, + { + label: 'Max Output Tokens', + name: 'maxOutputTokens', + type: 'number', + description: 'The maximum number of tokens to generate in the completion.', + step: 1, + optional: true, + additionalParams: true + }, + { + label: 'Top Probability', + name: 'topP', + type: 'number', + description: + 'Nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.', + step: 0.1, + optional: true, + additionalParams: true + }, + { + label: 'Random Seed', + name: 'randomSeed', + type: 'number', + description: 'The seed to use for random sampling. If set, different calls will generate deterministic results.', + step: 1, + optional: true, + additionalParams: true + }, + { + label: 'Safe Mode', + name: 'safeMode', + type: 'boolean', + description: 'Whether to inject a safety prompt before all conversations.', + optional: true, + additionalParams: true + }, + { + label: 'Override Endpoint', + name: 'overrideEndpoint', + type: 'string', + optional: true, + additionalParams: true + } + ] + } + + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const apiKey = getCredentialParam('mistralAIAPIKey', credentialData, nodeData) + + const temperature = nodeData.inputs?.temperature as string + const modelName = nodeData.inputs?.modelName as string + const maxOutputTokens = nodeData.inputs?.maxOutputTokens as string + const topP = nodeData.inputs?.topP as string + const safeMode = nodeData.inputs?.safeMode as boolean + const randomSeed = nodeData.inputs?.safeMode as string + const overrideEndpoint = nodeData.inputs?.overrideEndpoint as string + // Waiting fix from langchain + mistral to enable streaming - https://github.com/mistralai/client-js/issues/18 + + const cache = nodeData.inputs?.cache as BaseCache + + const obj: ChatMistralAIInput = { + apiKey: apiKey, + modelName: modelName + } + + if (maxOutputTokens) obj.maxTokens = parseInt(maxOutputTokens, 10) + if (topP) obj.topP = parseFloat(topP) + if (cache) obj.cache = cache + if (temperature) obj.temperature = parseFloat(temperature) + if (randomSeed) obj.randomSeed = parseFloat(randomSeed) + if (safeMode) obj.safeMode = safeMode + if (overrideEndpoint) obj.endpoint = overrideEndpoint + + const model = new ChatMistralAI(obj) + + return model + } +} + +module.exports = { nodeClass: ChatMistral_ChatModels } diff --git a/packages/components/nodes/chatmodels/ChatMistral/mistralai.png b/packages/components/nodes/chatmodels/ChatMistral/mistralai.png new file mode 100644 index 00000000..1019f495 Binary files /dev/null and b/packages/components/nodes/chatmodels/ChatMistral/mistralai.png differ diff --git a/packages/components/nodes/chatmodels/ChatOpenAI/ChatOpenAI.ts b/packages/components/nodes/chatmodels/ChatOpenAI/ChatOpenAI.ts index 32ff5d64..49326163 100644 --- a/packages/components/nodes/chatmodels/ChatOpenAI/ChatOpenAI.ts +++ b/packages/components/nodes/chatmodels/ChatOpenAI/ChatOpenAI.ts @@ -21,7 +21,7 @@ class ChatOpenAI_ChatModels implements INode { this.name = 'chatOpenAI' this.version = 2.0 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..5c20398a --- /dev/null +++ b/packages/components/nodes/chatmodels/ChatOpenAI/openai.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/components/nodes/chatmodels/ChatOpenAICustom/ChatOpenAICustom.ts b/packages/components/nodes/chatmodels/ChatOpenAICustom/ChatOpenAICustom.ts index 2a01a2e5..e80f17b7 100644 --- a/packages/components/nodes/chatmodels/ChatOpenAICustom/ChatOpenAICustom.ts +++ b/packages/components/nodes/chatmodels/ChatOpenAICustom/ChatOpenAICustom.ts @@ -21,7 +21,7 @@ class ChatOpenAICustom_ChatModels implements INode { this.name = 'chatOpenAICustom' this.version = 2.0 this.type = 'ChatOpenAI-Custom' - this.icon = 'openai.png' + this.icon = 'openai.svg' this.category = 'Chat Models' this.description = 'Custom/FineTuned model using OpenAI Chat compatible API' this.baseClasses = [this.type, ...getBaseClasses(ChatOpenAI)] diff --git a/packages/components/nodes/chatmodels/ChatOpenAICustom/openai.png b/packages/components/nodes/chatmodels/ChatOpenAICustom/openai.png deleted file mode 100644 index de08a05b..00000000 Binary files a/packages/components/nodes/chatmodels/ChatOpenAICustom/openai.png and /dev/null differ diff --git a/packages/components/nodes/chatmodels/ChatOpenAICustom/openai.svg b/packages/components/nodes/chatmodels/ChatOpenAICustom/openai.svg new file mode 100644 index 00000000..5c20398a --- /dev/null +++ b/packages/components/nodes/chatmodels/ChatOpenAICustom/openai.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/components/nodes/documentloaders/API/APILoader.ts b/packages/components/nodes/documentloaders/API/APILoader.ts index 3de6d636..e2212366 100644 --- a/packages/components/nodes/documentloaders/API/APILoader.ts +++ b/packages/components/nodes/documentloaders/API/APILoader.ts @@ -20,7 +20,7 @@ class API_DocumentLoaders implements INode { this.name = 'apiLoader' this.version = 1.0 this.type = 'Document' - this.icon = 'api-loader.png' + this.icon = 'api.svg' this.category = 'Document Loaders' this.description = `Load data from an API` this.baseClasses = [this.type] diff --git a/packages/components/nodes/documentloaders/API/api-loader.png b/packages/components/nodes/documentloaders/API/api-loader.png deleted file mode 100644 index 93668c4c..00000000 Binary files a/packages/components/nodes/documentloaders/API/api-loader.png and /dev/null differ diff --git a/packages/components/nodes/documentloaders/API/api.svg b/packages/components/nodes/documentloaders/API/api.svg new file mode 100644 index 00000000..c353c052 --- /dev/null +++ b/packages/components/nodes/documentloaders/API/api.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/components/nodes/documentloaders/Airtable/airtable.svg b/packages/components/nodes/documentloaders/Airtable/airtable.svg index 867c3b5a..5c2a9950 100644 --- a/packages/components/nodes/documentloaders/Airtable/airtable.svg +++ b/packages/components/nodes/documentloaders/Airtable/airtable.svg @@ -1,9 +1,5 @@ - - - - - - - - + + + + diff --git a/packages/components/nodes/documentloaders/ApifyWebsiteContentCrawler/apify-symbol-transparent.svg b/packages/components/nodes/documentloaders/ApifyWebsiteContentCrawler/apify-symbol-transparent.svg index 423a3328..457caaaa 100644 --- a/packages/components/nodes/documentloaders/ApifyWebsiteContentCrawler/apify-symbol-transparent.svg +++ b/packages/components/nodes/documentloaders/ApifyWebsiteContentCrawler/apify-symbol-transparent.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + + diff --git a/packages/components/nodes/documentloaders/Cheerio/cheerio.svg b/packages/components/nodes/documentloaders/Cheerio/cheerio.svg index 8e3334b9..575888ef 100644 --- a/packages/components/nodes/documentloaders/Cheerio/cheerio.svg +++ b/packages/components/nodes/documentloaders/Cheerio/cheerio.svg @@ -1,5 +1,4 @@ - - - - - \ 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 a17c41b9..bccda24c 100644 --- a/packages/components/nodes/documentloaders/Confluence/Confluence.ts +++ b/packages/components/nodes/documentloaders/Confluence/Confluence.ts @@ -20,7 +20,7 @@ class Confluence_DocumentLoaders implements INode { this.name = 'confluence' this.version = 1.0 this.type = 'Document' - this.icon = 'confluence.png' + this.icon = 'confluence.svg' this.category = 'Document Loaders' this.description = `Load data from a Confluence Document` this.baseClasses = [this.type] diff --git a/packages/components/nodes/documentloaders/Confluence/confluence.png b/packages/components/nodes/documentloaders/Confluence/confluence.png deleted file mode 100644 index 3cbb7b3d..00000000 Binary files a/packages/components/nodes/documentloaders/Confluence/confluence.png and /dev/null differ diff --git a/packages/components/nodes/documentloaders/Confluence/confluence.svg b/packages/components/nodes/documentloaders/Confluence/confluence.svg new file mode 100644 index 00000000..f78072aa --- /dev/null +++ b/packages/components/nodes/documentloaders/Confluence/confluence.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/components/nodes/documentloaders/Csv/Csv.png b/packages/components/nodes/documentloaders/Csv/Csv.png deleted file mode 100644 index 41b84e16..00000000 Binary files a/packages/components/nodes/documentloaders/Csv/Csv.png and /dev/null differ diff --git a/packages/components/nodes/documentloaders/Csv/Csv.ts b/packages/components/nodes/documentloaders/Csv/Csv.ts index 750490b7..a6170b2d 100644 --- a/packages/components/nodes/documentloaders/Csv/Csv.ts +++ b/packages/components/nodes/documentloaders/Csv/Csv.ts @@ -18,7 +18,7 @@ class Csv_DocumentLoaders implements INode { this.name = 'csvFile' this.version = 1.0 this.type = 'Document' - this.icon = 'Csv.png' + this.icon = 'csv.svg' this.category = 'Document Loaders' this.description = `Load data from CSV files` this.baseClasses = [this.type] diff --git a/packages/components/nodes/documentloaders/Csv/csv.svg b/packages/components/nodes/documentloaders/Csv/csv.svg new file mode 100644 index 00000000..df85bfc9 --- /dev/null +++ b/packages/components/nodes/documentloaders/Csv/csv.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/components/nodes/documentloaders/Docx/Docx.png b/packages/components/nodes/documentloaders/Docx/Docx.png deleted file mode 100644 index 6d527bd2..00000000 Binary files a/packages/components/nodes/documentloaders/Docx/Docx.png and /dev/null differ diff --git a/packages/components/nodes/documentloaders/Docx/Docx.ts b/packages/components/nodes/documentloaders/Docx/Docx.ts index 41922775..26883ada 100644 --- a/packages/components/nodes/documentloaders/Docx/Docx.ts +++ b/packages/components/nodes/documentloaders/Docx/Docx.ts @@ -18,7 +18,7 @@ class Docx_DocumentLoaders implements INode { this.name = 'docxFile' this.version = 1.0 this.type = 'Document' - this.icon = 'Docx.png' + this.icon = 'docx.svg' this.category = 'Document Loaders' this.description = `Load data from DOCX files` this.baseClasses = [this.type] diff --git a/packages/components/nodes/documentloaders/Docx/docx.svg b/packages/components/nodes/documentloaders/Docx/docx.svg new file mode 100644 index 00000000..86a46116 --- /dev/null +++ b/packages/components/nodes/documentloaders/Docx/docx.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/components/nodes/documentloaders/Figma/figma.svg b/packages/components/nodes/documentloaders/Figma/figma.svg index c4f85674..355d4ba9 100644 --- a/packages/components/nodes/documentloaders/Figma/figma.svg +++ b/packages/components/nodes/documentloaders/Figma/figma.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + diff --git a/packages/components/nodes/documentloaders/Folder/folder.svg b/packages/components/nodes/documentloaders/Folder/folder.svg index eb2b9de9..d26c6b69 100644 --- a/packages/components/nodes/documentloaders/Folder/folder.svg +++ b/packages/components/nodes/documentloaders/Folder/folder.svg @@ -1,4 +1,3 @@ - - - - \ No newline at end of file + + + diff --git a/packages/components/nodes/documentloaders/Gitbook/gitbook.svg b/packages/components/nodes/documentloaders/Gitbook/gitbook.svg index df16237a..a970c8b1 100644 --- a/packages/components/nodes/documentloaders/Gitbook/gitbook.svg +++ b/packages/components/nodes/documentloaders/Gitbook/gitbook.svg @@ -1 +1,3 @@ - \ 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 6495e8e9..935b9762 100644 --- a/packages/components/nodes/documentloaders/Github/Github.ts +++ b/packages/components/nodes/documentloaders/Github/Github.ts @@ -20,7 +20,7 @@ class Github_DocumentLoaders implements INode { this.name = 'github' this.version = 2.0 this.type = 'Document' - this.icon = 'github.png' + this.icon = 'github.svg' this.category = 'Document Loaders' this.description = `Load data from a GitHub repository` this.baseClasses = [this.type] diff --git a/packages/components/nodes/documentloaders/Github/github.png b/packages/components/nodes/documentloaders/Github/github.png deleted file mode 100644 index e4400818..00000000 Binary files a/packages/components/nodes/documentloaders/Github/github.png and /dev/null differ diff --git a/packages/components/nodes/documentloaders/Github/github.svg b/packages/components/nodes/documentloaders/Github/github.svg new file mode 100644 index 00000000..01f228d1 --- /dev/null +++ b/packages/components/nodes/documentloaders/Github/github.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/packages/components/nodes/documentloaders/Json/json.svg b/packages/components/nodes/documentloaders/Json/json.svg index c27646e2..2581cd3b 100644 --- a/packages/components/nodes/documentloaders/Json/json.svg +++ b/packages/components/nodes/documentloaders/Json/json.svg @@ -1,7 +1,7 @@ - - - - - - - \ No newline at end of file + + + + + + + diff --git a/packages/components/nodes/documentloaders/Jsonlines/jsonlines.svg b/packages/components/nodes/documentloaders/Jsonlines/jsonlines.svg index f3686f0c..7b5882f6 100644 --- a/packages/components/nodes/documentloaders/Jsonlines/jsonlines.svg +++ b/packages/components/nodes/documentloaders/Jsonlines/jsonlines.svg @@ -1,16 +1,9 @@ - - - - - background - - - - - - - Layer 1 - JSON - Lines - - \ No newline at end of file + + + + + + + + + diff --git a/packages/components/nodes/documentloaders/Notion/NotionDB.ts b/packages/components/nodes/documentloaders/Notion/NotionDB.ts index 74879dd2..5c171c7f 100644 --- a/packages/components/nodes/documentloaders/Notion/NotionDB.ts +++ b/packages/components/nodes/documentloaders/Notion/NotionDB.ts @@ -20,7 +20,7 @@ class NotionDB_DocumentLoaders implements INode { this.name = 'notionDB' this.version = 1.0 this.type = 'Document' - this.icon = 'notion.png' + this.icon = 'notion-db.svg' this.category = 'Document Loaders' this.description = 'Load data from Notion Database (each row is a separate document with all properties as metadata)' this.baseClasses = [this.type] diff --git a/packages/components/nodes/documentloaders/Notion/NotionFolder.ts b/packages/components/nodes/documentloaders/Notion/NotionFolder.ts index 8b8254a4..7da8d4a0 100644 --- a/packages/components/nodes/documentloaders/Notion/NotionFolder.ts +++ b/packages/components/nodes/documentloaders/Notion/NotionFolder.ts @@ -18,7 +18,7 @@ class NotionFolder_DocumentLoaders implements INode { this.name = 'notionFolder' this.version = 1.0 this.type = 'Document' - this.icon = 'notion.png' + this.icon = 'notion-folder.svg' this.category = 'Document Loaders' this.description = 'Load data from the exported and unzipped Notion folder' this.baseClasses = [this.type] diff --git a/packages/components/nodes/documentloaders/Notion/NotionPage.ts b/packages/components/nodes/documentloaders/Notion/NotionPage.ts index b45067ab..1ea3e483 100644 --- a/packages/components/nodes/documentloaders/Notion/NotionPage.ts +++ b/packages/components/nodes/documentloaders/Notion/NotionPage.ts @@ -20,7 +20,7 @@ class NotionPage_DocumentLoaders implements INode { this.name = 'notionPage' this.version = 1.0 this.type = 'Document' - this.icon = 'notion.png' + this.icon = 'notion-page.svg' this.category = 'Document Loaders' this.description = 'Load data from Notion Page (including child pages all as separate documents)' this.baseClasses = [this.type] diff --git a/packages/components/nodes/documentloaders/Notion/notion-db.svg b/packages/components/nodes/documentloaders/Notion/notion-db.svg new file mode 100644 index 00000000..9a04380f --- /dev/null +++ b/packages/components/nodes/documentloaders/Notion/notion-db.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/components/nodes/documentloaders/Notion/notion-folder.svg b/packages/components/nodes/documentloaders/Notion/notion-folder.svg new file mode 100644 index 00000000..8fafe569 --- /dev/null +++ b/packages/components/nodes/documentloaders/Notion/notion-folder.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/components/nodes/documentloaders/Notion/notion-page.svg b/packages/components/nodes/documentloaders/Notion/notion-page.svg new file mode 100644 index 00000000..201dcd3b --- /dev/null +++ b/packages/components/nodes/documentloaders/Notion/notion-page.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/components/nodes/documentloaders/Notion/notion.png b/packages/components/nodes/documentloaders/Notion/notion.png deleted file mode 100644 index 39105167..00000000 Binary files a/packages/components/nodes/documentloaders/Notion/notion.png and /dev/null differ diff --git a/packages/components/nodes/documentloaders/Pdf/pdf.svg b/packages/components/nodes/documentloaders/Pdf/pdf.svg index 20af94f8..5042b227 100644 --- a/packages/components/nodes/documentloaders/Pdf/pdf.svg +++ b/packages/components/nodes/documentloaders/Pdf/pdf.svg @@ -1,7 +1,6 @@ - - - - - - - \ No newline at end of file + + + + + + diff --git a/packages/components/nodes/documentloaders/PlainText/plaintext.svg b/packages/components/nodes/documentloaders/PlainText/plaintext.svg index b9fec035..8f38ca6b 100644 --- a/packages/components/nodes/documentloaders/PlainText/plaintext.svg +++ b/packages/components/nodes/documentloaders/PlainText/plaintext.svg @@ -1,7 +1,4 @@ - - - - - - - \ No newline at end of file + + + + diff --git a/packages/components/nodes/documentloaders/Playwright/playwright.svg b/packages/components/nodes/documentloaders/Playwright/playwright.svg index 0992832d..bbfd8120 100644 --- a/packages/components/nodes/documentloaders/Playwright/playwright.svg +++ b/packages/components/nodes/documentloaders/Playwright/playwright.svg @@ -1,9 +1,9 @@ - - - - - - - - - \ No newline at end of file + + + + + + + + + diff --git a/packages/components/nodes/documentloaders/Puppeteer/puppeteer.svg b/packages/components/nodes/documentloaders/Puppeteer/puppeteer.svg index 8477fc52..0e394fb7 100644 --- a/packages/components/nodes/documentloaders/Puppeteer/puppeteer.svg +++ b/packages/components/nodes/documentloaders/Puppeteer/puppeteer.svg @@ -1,14 +1,7 @@ - - - - - - - - \ No newline at end of file + + + + + + + diff --git a/packages/components/nodes/documentloaders/S3File/s3.svg b/packages/components/nodes/documentloaders/S3File/s3.svg index cd203eaa..33948d2f 100644 --- a/packages/components/nodes/documentloaders/S3File/s3.svg +++ b/packages/components/nodes/documentloaders/S3File/s3.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + + diff --git a/packages/components/nodes/documentloaders/SearchApi/searchapi.svg b/packages/components/nodes/documentloaders/SearchApi/searchapi.svg index c44c29c4..0c566712 100644 --- a/packages/components/nodes/documentloaders/SearchApi/searchapi.svg +++ b/packages/components/nodes/documentloaders/SearchApi/searchapi.svg @@ -1 +1,8 @@ -0479_octopus_verti + + + + + + + + diff --git a/packages/components/nodes/documentloaders/SerpApi/SerpAPI.ts b/packages/components/nodes/documentloaders/SerpApi/SerpAPI.ts index fd482710..c46db6b0 100644 --- a/packages/components/nodes/documentloaders/SerpApi/SerpAPI.ts +++ b/packages/components/nodes/documentloaders/SerpApi/SerpAPI.ts @@ -20,7 +20,7 @@ class SerpAPI_DocumentLoaders implements INode { this.name = 'serpApi' this.version = 1.0 this.type = 'Document' - this.icon = 'serp.png' + this.icon = 'serp.svg' this.category = 'Document Loaders' this.description = 'Load and process data from web search results' this.baseClasses = [this.type] diff --git a/packages/components/nodes/documentloaders/SerpApi/serp.png b/packages/components/nodes/documentloaders/SerpApi/serp.png deleted file mode 100644 index 338aeaea..00000000 Binary files a/packages/components/nodes/documentloaders/SerpApi/serp.png and /dev/null differ diff --git a/packages/components/nodes/documentloaders/SerpApi/serp.svg b/packages/components/nodes/documentloaders/SerpApi/serp.svg new file mode 100644 index 00000000..04999b54 --- /dev/null +++ b/packages/components/nodes/documentloaders/SerpApi/serp.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/packages/components/nodes/documentloaders/Subtitles/subtitlesFile.svg b/packages/components/nodes/documentloaders/Subtitles/subtitlesFile.svg index a6ee925b..251f51e4 100644 --- a/packages/components/nodes/documentloaders/Subtitles/subtitlesFile.svg +++ b/packages/components/nodes/documentloaders/Subtitles/subtitlesFile.svg @@ -1 +1,6 @@ - \ No newline at end of file + + + + + + diff --git a/packages/components/nodes/documentloaders/Text/Text.ts b/packages/components/nodes/documentloaders/Text/Text.ts index 3f12e490..e41c5a9f 100644 --- a/packages/components/nodes/documentloaders/Text/Text.ts +++ b/packages/components/nodes/documentloaders/Text/Text.ts @@ -21,7 +21,7 @@ class Text_DocumentLoaders implements INode { this.name = 'textFile' this.version = 3.0 this.type = 'Document' - this.icon = 'textFile.svg' + this.icon = 'Txt.svg' this.category = 'Document Loaders' this.description = `Load data from text files` this.baseClasses = [this.type] diff --git a/packages/components/nodes/documentloaders/Text/Txt.svg b/packages/components/nodes/documentloaders/Text/Txt.svg new file mode 100644 index 00000000..e361c0c5 --- /dev/null +++ b/packages/components/nodes/documentloaders/Text/Txt.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/components/nodes/documentloaders/Text/textFile.svg b/packages/components/nodes/documentloaders/Text/textFile.svg deleted file mode 100644 index 200be563..00000000 --- a/packages/components/nodes/documentloaders/Text/textFile.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/packages/components/nodes/documentloaders/Unstructured/UnstructuredFile.ts b/packages/components/nodes/documentloaders/Unstructured/UnstructuredFile.ts index 3ee7ff73..d4de1ece 100644 --- a/packages/components/nodes/documentloaders/Unstructured/UnstructuredFile.ts +++ b/packages/components/nodes/documentloaders/Unstructured/UnstructuredFile.ts @@ -19,7 +19,7 @@ class UnstructuredFile_DocumentLoaders implements INode { this.name = 'unstructuredFileLoader' this.version = 1.0 this.type = 'Document' - this.icon = 'unstructured.png' + this.icon = 'unstructured-file.svg' this.category = 'Document Loaders' this.description = 'Use Unstructured.io to load data from a file path' this.baseClasses = [this.type] diff --git a/packages/components/nodes/documentloaders/Unstructured/UnstructuredFolder.ts b/packages/components/nodes/documentloaders/Unstructured/UnstructuredFolder.ts index c56ff023..a0e7ee6c 100644 --- a/packages/components/nodes/documentloaders/Unstructured/UnstructuredFolder.ts +++ b/packages/components/nodes/documentloaders/Unstructured/UnstructuredFolder.ts @@ -19,7 +19,7 @@ class UnstructuredFolder_DocumentLoaders implements INode { this.name = 'unstructuredFolderLoader' this.version = 1.0 this.type = 'Document' - this.icon = 'unstructured.png' + this.icon = 'unstructured-folder.svg' this.category = 'Document Loaders' this.description = 'Use Unstructured.io to load data from a folder' this.baseClasses = [this.type] diff --git a/packages/components/nodes/documentloaders/Unstructured/unstructured-file.svg b/packages/components/nodes/documentloaders/Unstructured/unstructured-file.svg new file mode 100644 index 00000000..88ec620a --- /dev/null +++ b/packages/components/nodes/documentloaders/Unstructured/unstructured-file.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/components/nodes/documentloaders/Unstructured/unstructured-folder.svg b/packages/components/nodes/documentloaders/Unstructured/unstructured-folder.svg new file mode 100644 index 00000000..8ffd51ae --- /dev/null +++ b/packages/components/nodes/documentloaders/Unstructured/unstructured-folder.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/components/nodes/documentloaders/Unstructured/unstructured.png b/packages/components/nodes/documentloaders/Unstructured/unstructured.png deleted file mode 100644 index 435219bf..00000000 Binary files a/packages/components/nodes/documentloaders/Unstructured/unstructured.png and /dev/null differ diff --git a/packages/components/nodes/documentloaders/VectorStoreToDocument/vectorretriever.svg b/packages/components/nodes/documentloaders/VectorStoreToDocument/vectorretriever.svg index 208a59f1..0c8cd296 100644 --- a/packages/components/nodes/documentloaders/VectorStoreToDocument/vectorretriever.svg +++ b/packages/components/nodes/documentloaders/VectorStoreToDocument/vectorretriever.svg @@ -1,7 +1,4 @@ - - - - - - - \ No newline at end of file + + + + diff --git a/packages/components/nodes/embeddings/AWSBedrockEmbedding/AWSBedrockEmbedding.ts b/packages/components/nodes/embeddings/AWSBedrockEmbedding/AWSBedrockEmbedding.ts index 8249d512..d7445c30 100644 --- a/packages/components/nodes/embeddings/AWSBedrockEmbedding/AWSBedrockEmbedding.ts +++ b/packages/components/nodes/embeddings/AWSBedrockEmbedding/AWSBedrockEmbedding.ts @@ -18,9 +18,9 @@ class AWSBedrockEmbedding_Embeddings implements INode { constructor() { this.label = 'AWS Bedrock Embeddings' this.name = 'AWSBedrockEmbeddings' - this.version = 2.0 + this.version = 3.0 this.type = 'AWSBedrockEmbeddings' - this.icon = 'awsBedrock.png' + this.icon = 'aws.svg' this.category = 'Embeddings' this.description = 'AWSBedrock embedding models to generate embeddings for a given text' this.baseClasses = [this.type, ...getBaseClasses(BedrockEmbeddings)] @@ -86,6 +86,13 @@ class AWSBedrockEmbedding_Embeddings implements INode { { label: 'cohere.embed-multilingual-v3', name: 'cohere.embed-multilingual-v3' } ], default: 'amazon.titan-embed-text-v1' + }, + { + label: 'Custom Model Name', + name: 'customModel', + description: 'If provided, will override model selected from Model Name option', + type: 'string', + optional: true } ] } @@ -93,9 +100,10 @@ class AWSBedrockEmbedding_Embeddings implements INode { async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const iRegion = nodeData.inputs?.region as string const iModel = nodeData.inputs?.model as string + const customModel = nodeData.inputs?.customModel as string const obj: BedrockEmbeddingsParams = { - model: iModel, + model: customModel ? customModel : iModel, region: iRegion } diff --git a/packages/components/nodes/embeddings/AWSBedrockEmbedding/aws.svg b/packages/components/nodes/embeddings/AWSBedrockEmbedding/aws.svg new file mode 100644 index 00000000..0e630a3b --- /dev/null +++ b/packages/components/nodes/embeddings/AWSBedrockEmbedding/aws.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/components/nodes/embeddings/AWSBedrockEmbedding/awsBedrock.png b/packages/components/nodes/embeddings/AWSBedrockEmbedding/awsBedrock.png deleted file mode 100644 index 483bc69a..00000000 Binary files a/packages/components/nodes/embeddings/AWSBedrockEmbedding/awsBedrock.png and /dev/null differ diff --git a/packages/components/nodes/embeddings/GoogleGenerativeAIEmbedding/GoogleGenerativeAIEmbedding.ts b/packages/components/nodes/embeddings/GoogleGenerativeAIEmbedding/GoogleGenerativeAIEmbedding.ts new file mode 100644 index 00000000..fa5cff45 --- /dev/null +++ b/packages/components/nodes/embeddings/GoogleGenerativeAIEmbedding/GoogleGenerativeAIEmbedding.ts @@ -0,0 +1,104 @@ +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' +import { GoogleGenerativeAIEmbeddings, GoogleGenerativeAIEmbeddingsParams } from '@langchain/google-genai' +import { TaskType } from '@google/generative-ai' + +class GoogleGenerativeAIEmbedding_Embeddings implements INode { + label: string + name: string + version: number + type: string + icon: string + category: string + description: string + baseClasses: string[] + inputs: INodeParams[] + credential: INodeParams + + constructor() { + this.label = 'GoogleGenerativeAI Embeddings' + this.name = 'googleGenerativeAiEmbeddings' + this.version = 1.0 + this.type = 'GoogleGenerativeAiEmbeddings' + this.icon = 'gemini.png' + this.category = 'Embeddings' + this.description = 'Google Generative API to generate embeddings for a given text' + this.baseClasses = [this.type, ...getBaseClasses(GoogleGenerativeAIEmbeddings)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['googleGenerativeAI'], + optional: false, + description: 'Google Generative AI credential.' + } + this.inputs = [ + { + label: 'Model Name', + name: 'modelName', + type: 'options', + options: [ + { + label: 'embedding-001', + name: 'embedding-001' + } + ], + default: 'embedding-001' + }, + { + label: 'Task Type', + name: 'tasktype', + type: 'options', + description: 'Type of task for which the embedding will be used', + options: [ + { label: 'TASK_TYPE_UNSPECIFIED', name: 'TASK_TYPE_UNSPECIFIED' }, + { label: 'RETRIEVAL_QUERY', name: 'RETRIEVAL_QUERY' }, + { label: 'RETRIEVAL_DOCUMENT', name: 'RETRIEVAL_DOCUMENT' }, + { label: 'SEMANTIC_SIMILARITY', name: 'SEMANTIC_SIMILARITY' }, + { label: 'CLASSIFICATION', name: 'CLASSIFICATION' }, + { label: 'CLUSTERING', name: 'CLUSTERING' } + ], + default: 'TASK_TYPE_UNSPECIFIED' + } + ] + } + + // eslint-disable-next-line unused-imports/no-unused-vars + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { + const modelName = nodeData.inputs?.modelName as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const apiKey = getCredentialParam('googleGenerativeAPIKey', credentialData, nodeData) + + let taskType: TaskType + switch (nodeData.inputs?.tasktype as string) { + case 'RETRIEVAL_QUERY': + taskType = TaskType.RETRIEVAL_QUERY + break + case 'RETRIEVAL_DOCUMENT': + taskType = TaskType.RETRIEVAL_DOCUMENT + break + case 'SEMANTIC_SIMILARITY': + taskType = TaskType.SEMANTIC_SIMILARITY + break + case 'CLASSIFICATION': + taskType = TaskType.CLASSIFICATION + break + case 'CLUSTERING': + taskType = TaskType.CLUSTERING + break + default: + taskType = TaskType.TASK_TYPE_UNSPECIFIED + break + } + const obj: GoogleGenerativeAIEmbeddingsParams = { + apiKey: apiKey, + modelName: modelName, + taskType: taskType + } + + const model = new GoogleGenerativeAIEmbeddings(obj) + return model + } +} + +module.exports = { nodeClass: GoogleGenerativeAIEmbedding_Embeddings } diff --git a/packages/components/nodes/embeddings/GoogleGenerativeAIEmbedding/gemini.png b/packages/components/nodes/embeddings/GoogleGenerativeAIEmbedding/gemini.png new file mode 100644 index 00000000..6c0d60f4 Binary files /dev/null and b/packages/components/nodes/embeddings/GoogleGenerativeAIEmbedding/gemini.png differ diff --git a/packages/components/nodes/embeddings/MistralEmbedding/MistralEmbedding.ts b/packages/components/nodes/embeddings/MistralEmbedding/MistralEmbedding.ts new file mode 100644 index 00000000..d0a0198c --- /dev/null +++ b/packages/components/nodes/embeddings/MistralEmbedding/MistralEmbedding.ts @@ -0,0 +1,95 @@ +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' +import { MistralAIEmbeddings, MistralAIEmbeddingsParams } from '@langchain/mistralai' + +class MistralEmbedding_Embeddings implements INode { + label: string + name: string + version: number + type: string + icon: string + category: string + description: string + baseClasses: string[] + inputs: INodeParams[] + credential: INodeParams + + constructor() { + this.label = 'MistralAI Embeddings' + this.name = 'mistralAI Embeddings' + this.version = 1.0 + this.type = 'MistralAIEmbeddings' + this.icon = 'mistralai.png' + this.category = 'Embeddings' + this.description = 'MistralAI API to generate embeddings for a given text' + this.baseClasses = [this.type, ...getBaseClasses(MistralAIEmbeddings)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['mistralAIApi'] + } + this.inputs = [ + { + label: 'Model Name', + name: 'modelName', + type: 'options', + options: [ + { + label: 'mistral-embed', + name: 'mistral-embed' + } + ], + default: 'mistral-embed' + }, + { + label: 'Batch Size', + name: 'batchSize', + type: 'number', + step: 1, + default: 512, + optional: true, + additionalParams: true + }, + { + label: 'Strip New Lines', + name: 'stripNewLines', + type: 'boolean', + default: true, + optional: true, + additionalParams: true + }, + { + label: 'Override Endpoint', + name: 'overrideEndpoint', + type: 'string', + optional: true, + additionalParams: true + } + ] + } + + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { + const modelName = nodeData.inputs?.modelName as string + const batchSize = nodeData.inputs?.batchSize as string + const stripNewLines = nodeData.inputs?.stripNewLines as boolean + const overrideEndpoint = nodeData.inputs?.overrideEndpoint as string + + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const apiKey = getCredentialParam('mistralAIAPIKey', credentialData, nodeData) + + const obj: MistralAIEmbeddingsParams = { + apiKey: apiKey, + modelName: modelName + } + + if (batchSize) obj.batchSize = parseInt(batchSize, 10) + if (stripNewLines) obj.stripNewLines = stripNewLines + if (overrideEndpoint) obj.endpoint = overrideEndpoint + + const model = new MistralAIEmbeddings(obj) + return model + } +} + +module.exports = { nodeClass: MistralEmbedding_Embeddings } diff --git a/packages/components/nodes/embeddings/MistralEmbedding/mistralai.png b/packages/components/nodes/embeddings/MistralEmbedding/mistralai.png new file mode 100644 index 00000000..1019f495 Binary files /dev/null and b/packages/components/nodes/embeddings/MistralEmbedding/mistralai.png differ diff --git a/packages/components/nodes/embeddings/OpenAIEmbedding/OpenAIEmbedding.ts b/packages/components/nodes/embeddings/OpenAIEmbedding/OpenAIEmbedding.ts index d21b6dca..b3d0045b 100644 --- a/packages/components/nodes/embeddings/OpenAIEmbedding/OpenAIEmbedding.ts +++ b/packages/components/nodes/embeddings/OpenAIEmbedding/OpenAIEmbedding.ts @@ -19,7 +19,7 @@ class OpenAIEmbedding_Embeddings implements INode { this.name = 'openAIEmbeddings' this.version = 1.0 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)] 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..5c20398a --- /dev/null +++ b/packages/components/nodes/embeddings/OpenAIEmbedding/openai.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/components/nodes/embeddings/OpenAIEmbeddingCustom/OpenAIEmbeddingCustom.ts b/packages/components/nodes/embeddings/OpenAIEmbeddingCustom/OpenAIEmbeddingCustom.ts index 185236b1..9bf87f6b 100644 --- a/packages/components/nodes/embeddings/OpenAIEmbeddingCustom/OpenAIEmbeddingCustom.ts +++ b/packages/components/nodes/embeddings/OpenAIEmbeddingCustom/OpenAIEmbeddingCustom.ts @@ -19,7 +19,7 @@ class OpenAIEmbeddingCustom_Embeddings implements INode { this.name = 'openAIEmbeddingsCustom' this.version = 1.0 this.type = 'OpenAIEmbeddingsCustom' - 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)] diff --git a/packages/components/nodes/embeddings/OpenAIEmbeddingCustom/openai.png b/packages/components/nodes/embeddings/OpenAIEmbeddingCustom/openai.png deleted file mode 100644 index de08a05b..00000000 Binary files a/packages/components/nodes/embeddings/OpenAIEmbeddingCustom/openai.png and /dev/null differ diff --git a/packages/components/nodes/embeddings/OpenAIEmbeddingCustom/openai.svg b/packages/components/nodes/embeddings/OpenAIEmbeddingCustom/openai.svg new file mode 100644 index 00000000..5c20398a --- /dev/null +++ b/packages/components/nodes/embeddings/OpenAIEmbeddingCustom/openai.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/components/nodes/llms/AWSBedrock/AWSBedrock.ts b/packages/components/nodes/llms/AWSBedrock/AWSBedrock.ts index 177a32ef..0fa417b4 100644 --- a/packages/components/nodes/llms/AWSBedrock/AWSBedrock.ts +++ b/packages/components/nodes/llms/AWSBedrock/AWSBedrock.ts @@ -27,9 +27,9 @@ class AWSBedrock_LLMs implements INode { constructor() { this.label = 'AWS Bedrock' this.name = 'awsBedrock' - this.version = 2.0 + this.version = 3.0 this.type = 'AWSBedrock' - this.icon = 'awsBedrock.png' + this.icon = 'aws.svg' this.category = 'LLMs' this.description = 'Wrapper around AWS Bedrock large language models' this.baseClasses = [this.type, ...getBaseClasses(Bedrock)] @@ -105,6 +105,13 @@ class AWSBedrock_LLMs implements INode { { label: 'ai21.j2-ultra', name: 'ai21.j2-ultra' } ] }, + { + label: 'Custom Model Name', + name: 'customModel', + description: 'If provided, will override model selected from Model Name option', + type: 'string', + optional: true + }, { label: 'Temperature', name: 'temperature', @@ -112,6 +119,7 @@ class AWSBedrock_LLMs implements INode { step: 0.1, description: 'Temperature parameter may not apply to certain model. Please check available model parameters', optional: true, + additionalParams: true, default: 0.7 }, { @@ -121,6 +129,7 @@ class AWSBedrock_LLMs implements INode { step: 10, description: 'Max Tokens parameter may not apply to certain model. Please check available model parameters', optional: true, + additionalParams: true, default: 200 } ] @@ -129,11 +138,12 @@ class AWSBedrock_LLMs implements INode { async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const iRegion = nodeData.inputs?.region as string const iModel = nodeData.inputs?.model as string + const customModel = nodeData.inputs?.customModel as string const iTemperature = nodeData.inputs?.temperature as string const iMax_tokens_to_sample = nodeData.inputs?.max_tokens_to_sample as string const cache = nodeData.inputs?.cache as BaseCache const obj: Partial & BaseLLMParams = { - model: iModel, + model: customModel ? customModel : iModel, region: iRegion, temperature: parseFloat(iTemperature), maxTokens: parseInt(iMax_tokens_to_sample, 10) diff --git a/packages/components/nodes/llms/AWSBedrock/aws.svg b/packages/components/nodes/llms/AWSBedrock/aws.svg new file mode 100644 index 00000000..0e630a3b --- /dev/null +++ b/packages/components/nodes/llms/AWSBedrock/aws.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/components/nodes/llms/AWSBedrock/awsBedrock.png b/packages/components/nodes/llms/AWSBedrock/awsBedrock.png deleted file mode 100644 index 483bc69a..00000000 Binary files a/packages/components/nodes/llms/AWSBedrock/awsBedrock.png and /dev/null differ diff --git a/packages/components/nodes/llms/OpenAI/OpenAI.ts b/packages/components/nodes/llms/OpenAI/OpenAI.ts index 9109dd40..f2a2a85f 100644 --- a/packages/components/nodes/llms/OpenAI/OpenAI.ts +++ b/packages/components/nodes/llms/OpenAI/OpenAI.ts @@ -21,7 +21,7 @@ class OpenAI_LLMs implements INode { this.name = 'openAI' this.version = 3.0 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..5c20398a --- /dev/null +++ b/packages/components/nodes/llms/OpenAI/openai.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/components/nodes/llms/Replicate/replicate.svg b/packages/components/nodes/llms/Replicate/replicate.svg index 2e46453f..a341b880 100644 --- a/packages/components/nodes/llms/Replicate/replicate.svg +++ b/packages/components/nodes/llms/Replicate/replicate.svg @@ -1,7 +1,6 @@ - \ No newline at end of file + + + + + + diff --git a/packages/components/nodes/memory/BufferMemory/memory.svg b/packages/components/nodes/memory/BufferMemory/memory.svg index ca8e17da..d60f5df4 100644 --- a/packages/components/nodes/memory/BufferMemory/memory.svg +++ b/packages/components/nodes/memory/BufferMemory/memory.svg @@ -1,8 +1,16 @@ - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + diff --git a/packages/components/nodes/memory/BufferWindowMemory/memory.svg b/packages/components/nodes/memory/BufferWindowMemory/memory.svg index ca8e17da..224f9158 100644 --- a/packages/components/nodes/memory/BufferWindowMemory/memory.svg +++ b/packages/components/nodes/memory/BufferWindowMemory/memory.svg @@ -1,8 +1,19 @@ - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + diff --git a/packages/components/nodes/memory/ConversationSummaryMemory/memory.svg b/packages/components/nodes/memory/ConversationSummaryMemory/memory.svg index ca8e17da..c7aadc96 100644 --- a/packages/components/nodes/memory/ConversationSummaryMemory/memory.svg +++ b/packages/components/nodes/memory/ConversationSummaryMemory/memory.svg @@ -1,8 +1,19 @@ - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + diff --git a/packages/components/nodes/memory/DynamoDb/dynamodb.svg b/packages/components/nodes/memory/DynamoDb/dynamodb.svg index f2798350..66f070b1 100644 --- a/packages/components/nodes/memory/DynamoDb/dynamodb.svg +++ b/packages/components/nodes/memory/DynamoDb/dynamodb.svg @@ -1,18 +1,15 @@ - - - - Icon-Architecture/16/Arch_Amazon-DynamoDB_16 - Created with Sketch. - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + diff --git a/packages/components/nodes/memory/MongoDBMemory/MongoDBMemory.ts b/packages/components/nodes/memory/MongoDBMemory/MongoDBMemory.ts index 76cb7e31..b654a5b2 100644 --- a/packages/components/nodes/memory/MongoDBMemory/MongoDBMemory.ts +++ b/packages/components/nodes/memory/MongoDBMemory/MongoDBMemory.ts @@ -30,7 +30,7 @@ class MongoDB_Memory implements INode { this.name = 'MongoDBAtlasChatMemory' this.version = 1.0 this.type = 'MongoDBAtlasChatMemory' - this.icon = 'mongodb.png' + this.icon = 'mongodb.svg' this.category = 'Memory' this.description = 'Stores the conversation in MongoDB Atlas' this.baseClasses = [this.type, ...getBaseClasses(BufferMemory)] diff --git a/packages/components/nodes/memory/MongoDBMemory/mongodb.png b/packages/components/nodes/memory/MongoDBMemory/mongodb.png deleted file mode 100644 index 5586fe0a..00000000 Binary files a/packages/components/nodes/memory/MongoDBMemory/mongodb.png and /dev/null differ diff --git a/packages/components/nodes/memory/MongoDBMemory/mongodb.svg b/packages/components/nodes/memory/MongoDBMemory/mongodb.svg new file mode 100644 index 00000000..49c5f05a --- /dev/null +++ b/packages/components/nodes/memory/MongoDBMemory/mongodb.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts b/packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts index 9cdbcd5c..fc4a06dc 100644 --- a/packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts +++ b/packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts @@ -22,7 +22,7 @@ class MotorMemory_Memory implements INode { this.name = 'motorheadMemory' this.version = 1.0 this.type = 'MotorheadMemory' - this.icon = 'motorhead.png' + this.icon = 'motorhead.svg' this.category = 'Memory' this.description = 'Use Motorhead Memory to store chat conversations' this.baseClasses = [this.type, ...getBaseClasses(MotorheadMemory)] diff --git a/packages/components/nodes/memory/MotorheadMemory/motorhead.png b/packages/components/nodes/memory/MotorheadMemory/motorhead.png deleted file mode 100644 index e1dfbde0..00000000 Binary files a/packages/components/nodes/memory/MotorheadMemory/motorhead.png and /dev/null differ diff --git a/packages/components/nodes/memory/MotorheadMemory/motorhead.svg b/packages/components/nodes/memory/MotorheadMemory/motorhead.svg new file mode 100644 index 00000000..55ca8c7d --- /dev/null +++ b/packages/components/nodes/memory/MotorheadMemory/motorhead.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/components/nodes/memory/RedisBackedChatMemory/RedisBackedChatMemory.ts b/packages/components/nodes/memory/RedisBackedChatMemory/RedisBackedChatMemory.ts index 7fe447ad..d6ec9a11 100644 --- a/packages/components/nodes/memory/RedisBackedChatMemory/RedisBackedChatMemory.ts +++ b/packages/components/nodes/memory/RedisBackedChatMemory/RedisBackedChatMemory.ts @@ -57,6 +57,14 @@ class RedisBackedChatMemory_Memory implements INode { type: 'string', default: 'chat_history', additionalParams: true + }, + { + label: 'Window Size', + name: 'windowSize', + type: 'number', + description: 'Window of size k to surface the last k back-and-forth to use as memory.', + additionalParams: true, + optional: true } ] } @@ -89,6 +97,7 @@ const initalizeRedis = async (nodeData: INodeData, options: ICommonObject): Prom const sessionId = nodeData.inputs?.sessionId as string const sessionTTL = nodeData.inputs?.sessionTTL as number const memoryKey = nodeData.inputs?.memoryKey as string + const windowSize = nodeData.inputs?.windowSize as number const chatId = options?.chatId as string let isSessionIdUsingChatMessageId = false @@ -103,12 +112,16 @@ const initalizeRedis = async (nodeData: INodeData, options: ICommonObject): Prom const password = getCredentialParam('redisCachePwd', credentialData, nodeData) const portStr = getCredentialParam('redisCachePort', credentialData, nodeData) const host = getCredentialParam('redisCacheHost', credentialData, nodeData) + const sslEnabled = getCredentialParam('redisCacheSslEnabled', credentialData, nodeData) + + const tlsOptions = sslEnabled === true ? { tls: { rejectUnauthorized: false } } : {} client = new Redis({ port: portStr ? parseInt(portStr) : 6379, host, username, - password + password, + ...tlsOptions }) } else { client = new Redis(redisUrl) @@ -129,7 +142,7 @@ const initalizeRedis = async (nodeData: INodeData, options: ICommonObject): Prom const redisChatMessageHistory = new RedisChatMessageHistory(obj) redisChatMessageHistory.getMessages = async (): Promise => { - const rawStoredMessages = await client.lrange((redisChatMessageHistory as any).sessionId, 0, -1) + const rawStoredMessages = await client.lrange((redisChatMessageHistory as any).sessionId, windowSize ? -windowSize : 0, -1) const orderedMessages = rawStoredMessages.reverse().map((message) => JSON.parse(message)) return orderedMessages.map(mapStoredMessageToChatMessage) } diff --git a/packages/components/nodes/memory/UpstashRedisBackedChatMemory/upstash.svg b/packages/components/nodes/memory/UpstashRedisBackedChatMemory/upstash.svg index a0fb96a7..582d151a 100644 --- a/packages/components/nodes/memory/UpstashRedisBackedChatMemory/upstash.svg +++ b/packages/components/nodes/memory/UpstashRedisBackedChatMemory/upstash.svg @@ -1,12 +1,6 @@ - - - upstash - - - - - - - - + + + + + diff --git a/packages/components/nodes/memory/ZepMemory/ZepMemory.ts b/packages/components/nodes/memory/ZepMemory/ZepMemory.ts index e72a6704..ea52cb0b 100644 --- a/packages/components/nodes/memory/ZepMemory/ZepMemory.ts +++ b/packages/components/nodes/memory/ZepMemory/ZepMemory.ts @@ -21,7 +21,7 @@ class ZepMemory_Memory implements INode { this.name = 'ZepMemory' this.version = 2.0 this.type = 'ZepMemory' - this.icon = 'zep.png' + this.icon = 'zep.svg' this.category = 'Memory' this.description = 'Summarizes the conversation and stores the memory in zep server' this.baseClasses = [this.type, ...getBaseClasses(ZepMemory)] @@ -178,21 +178,21 @@ class ZepMemoryExtended extends ZepMemory { async loadMemoryVariables(values: InputValues, overrideSessionId = ''): Promise { if (overrideSessionId) { - super.sessionId = overrideSessionId + this.sessionId = overrideSessionId } return super.loadMemoryVariables({ ...values, lastN: this.lastN }) } async saveContext(inputValues: InputValues, outputValues: OutputValues, overrideSessionId = ''): Promise { if (overrideSessionId) { - super.sessionId = overrideSessionId + this.sessionId = overrideSessionId } return super.saveContext(inputValues, outputValues) } async clear(overrideSessionId = ''): Promise { if (overrideSessionId) { - super.sessionId = overrideSessionId + this.sessionId = overrideSessionId } return super.clear() } diff --git a/packages/components/nodes/memory/ZepMemory/zep.png b/packages/components/nodes/memory/ZepMemory/zep.png deleted file mode 100644 index 2fdb2382..00000000 Binary files a/packages/components/nodes/memory/ZepMemory/zep.png and /dev/null differ diff --git a/packages/components/nodes/memory/ZepMemory/zep.svg b/packages/components/nodes/memory/ZepMemory/zep.svg new file mode 100644 index 00000000..6cbbaad2 --- /dev/null +++ b/packages/components/nodes/memory/ZepMemory/zep.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/packages/components/nodes/moderation/OpenAIModeration/OpenAIModeration.ts b/packages/components/nodes/moderation/OpenAIModeration/OpenAIModeration.ts index 85b27907..8f780605 100644 --- a/packages/components/nodes/moderation/OpenAIModeration/OpenAIModeration.ts +++ b/packages/components/nodes/moderation/OpenAIModeration/OpenAIModeration.ts @@ -20,7 +20,7 @@ class OpenAIModeration implements INode { this.name = 'inputModerationOpenAI' this.version = 1.0 this.type = 'Moderation' - this.icon = 'openai.png' + this.icon = 'openai.svg' this.category = 'Moderation' this.description = 'Check whether content complies with OpenAI usage policies.' this.baseClasses = [this.type, ...getBaseClasses(Moderation)] diff --git a/packages/components/nodes/moderation/OpenAIModeration/openai.png b/packages/components/nodes/moderation/OpenAIModeration/openai.png deleted file mode 100644 index de08a05b..00000000 Binary files a/packages/components/nodes/moderation/OpenAIModeration/openai.png and /dev/null differ diff --git a/packages/components/nodes/moderation/OpenAIModeration/openai.svg b/packages/components/nodes/moderation/OpenAIModeration/openai.svg new file mode 100644 index 00000000..e288e6bd --- /dev/null +++ b/packages/components/nodes/moderation/OpenAIModeration/openai.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/components/nodes/moderation/SimplePromptModeration/SimplePromptModeration.ts b/packages/components/nodes/moderation/SimplePromptModeration/SimplePromptModeration.ts index bf5a32f6..d98c4867 100644 --- a/packages/components/nodes/moderation/SimplePromptModeration/SimplePromptModeration.ts +++ b/packages/components/nodes/moderation/SimplePromptModeration/SimplePromptModeration.ts @@ -19,7 +19,7 @@ class SimplePromptModeration implements INode { this.name = 'inputModerationSimple' this.version = 1.0 this.type = 'Moderation' - this.icon = 'simple_moderation.png' + this.icon = 'moderation.svg' this.category = 'Moderation' this.description = 'Check whether input consists of any text from Deny list, and prevent being sent to LLM' this.baseClasses = [this.type, ...getBaseClasses(Moderation)] diff --git a/packages/components/nodes/moderation/SimplePromptModeration/moderation.svg b/packages/components/nodes/moderation/SimplePromptModeration/moderation.svg new file mode 100644 index 00000000..77bc3a1c --- /dev/null +++ b/packages/components/nodes/moderation/SimplePromptModeration/moderation.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/components/nodes/moderation/SimplePromptModeration/simple_moderation.png b/packages/components/nodes/moderation/SimplePromptModeration/simple_moderation.png deleted file mode 100644 index 47d78cb6..00000000 Binary files a/packages/components/nodes/moderation/SimplePromptModeration/simple_moderation.png and /dev/null differ diff --git a/packages/components/nodes/outputparsers/CSVListOutputParser/CSVListOutputParser.ts b/packages/components/nodes/outputparsers/CSVListOutputParser/CSVListOutputParser.ts index 8758d4f7..7b3e7e67 100644 --- a/packages/components/nodes/outputparsers/CSVListOutputParser/CSVListOutputParser.ts +++ b/packages/components/nodes/outputparsers/CSVListOutputParser/CSVListOutputParser.ts @@ -21,7 +21,7 @@ class CSVListOutputParser implements INode { this.version = 1.0 this.type = 'CSVListOutputParser' this.description = 'Parse the output of an LLM call as a comma-separated list of values' - this.icon = 'csv.png' + this.icon = 'csv.svg' this.category = CATEGORY this.baseClasses = [this.type, ...getBaseClasses(BaseOutputParser)] this.inputs = [ diff --git a/packages/components/nodes/outputparsers/CSVListOutputParser/csv.png b/packages/components/nodes/outputparsers/CSVListOutputParser/csv.png deleted file mode 100644 index 41b84e16..00000000 Binary files a/packages/components/nodes/outputparsers/CSVListOutputParser/csv.png and /dev/null differ diff --git a/packages/components/nodes/outputparsers/CSVListOutputParser/csv.svg b/packages/components/nodes/outputparsers/CSVListOutputParser/csv.svg new file mode 100644 index 00000000..e23791b6 --- /dev/null +++ b/packages/components/nodes/outputparsers/CSVListOutputParser/csv.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/components/nodes/outputparsers/CustomListOutputParser/CustomListOutputParser.ts b/packages/components/nodes/outputparsers/CustomListOutputParser/CustomListOutputParser.ts index 06523afb..d420a88d 100644 --- a/packages/components/nodes/outputparsers/CustomListOutputParser/CustomListOutputParser.ts +++ b/packages/components/nodes/outputparsers/CustomListOutputParser/CustomListOutputParser.ts @@ -21,7 +21,7 @@ class CustomListOutputParser implements INode { this.version = 1.0 this.type = 'CustomListOutputParser' this.description = 'Parse the output of an LLM call as a list of values.' - this.icon = 'list.png' + this.icon = 'list.svg' this.category = CATEGORY this.baseClasses = [this.type, ...getBaseClasses(BaseOutputParser)] this.inputs = [ diff --git a/packages/components/nodes/outputparsers/CustomListOutputParser/list.png b/packages/components/nodes/outputparsers/CustomListOutputParser/list.png deleted file mode 100644 index acb4e5d6..00000000 Binary files a/packages/components/nodes/outputparsers/CustomListOutputParser/list.png and /dev/null differ diff --git a/packages/components/nodes/outputparsers/CustomListOutputParser/list.svg b/packages/components/nodes/outputparsers/CustomListOutputParser/list.svg new file mode 100644 index 00000000..c7dad9a9 --- /dev/null +++ b/packages/components/nodes/outputparsers/CustomListOutputParser/list.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/components/nodes/outputparsers/StructuredOutputParser/StructuredOutputParser.ts b/packages/components/nodes/outputparsers/StructuredOutputParser/StructuredOutputParser.ts index 10a5f0bb..fc28fd1c 100644 --- a/packages/components/nodes/outputparsers/StructuredOutputParser/StructuredOutputParser.ts +++ b/packages/components/nodes/outputparsers/StructuredOutputParser/StructuredOutputParser.ts @@ -22,7 +22,7 @@ class StructuredOutputParser implements INode { this.version = 1.0 this.type = 'StructuredOutputParser' this.description = 'Parse the output of an LLM call into a given (JSON) structure.' - this.icon = 'structure.png' + this.icon = 'structure.svg' this.category = CATEGORY this.baseClasses = [this.type, ...getBaseClasses(BaseOutputParser)] this.inputs = [ diff --git a/packages/components/nodes/outputparsers/StructuredOutputParser/structure.png b/packages/components/nodes/outputparsers/StructuredOutputParser/structure.png deleted file mode 100644 index c56b2dd7..00000000 Binary files a/packages/components/nodes/outputparsers/StructuredOutputParser/structure.png and /dev/null differ diff --git a/packages/components/nodes/outputparsers/StructuredOutputParser/structure.svg b/packages/components/nodes/outputparsers/StructuredOutputParser/structure.svg new file mode 100644 index 00000000..3875982d --- /dev/null +++ b/packages/components/nodes/outputparsers/StructuredOutputParser/structure.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/components/nodes/prompts/ChatPromptTemplate/prompt.svg b/packages/components/nodes/prompts/ChatPromptTemplate/prompt.svg index 7e486118..3f666d94 100644 --- a/packages/components/nodes/prompts/ChatPromptTemplate/prompt.svg +++ b/packages/components/nodes/prompts/ChatPromptTemplate/prompt.svg @@ -1,6 +1,5 @@ - - - - - - \ No newline at end of file + + + + + diff --git a/packages/components/nodes/prompts/FewShotPromptTemplate/prompt.svg b/packages/components/nodes/prompts/FewShotPromptTemplate/prompt.svg index 7e486118..1484fcb2 100644 --- a/packages/components/nodes/prompts/FewShotPromptTemplate/prompt.svg +++ b/packages/components/nodes/prompts/FewShotPromptTemplate/prompt.svg @@ -1,6 +1,6 @@ - - - - - - \ No newline at end of file + + + + + + diff --git a/packages/components/nodes/prompts/PromptTemplate/prompt.svg b/packages/components/nodes/prompts/PromptTemplate/prompt.svg index 7e486118..1484fcb2 100644 --- a/packages/components/nodes/prompts/PromptTemplate/prompt.svg +++ b/packages/components/nodes/prompts/PromptTemplate/prompt.svg @@ -1,6 +1,6 @@ - - - - - - \ No newline at end of file + + + + + + diff --git a/packages/components/nodes/retrievers/HydeRetriever/hyderetriever.svg b/packages/components/nodes/retrievers/HydeRetriever/hyderetriever.svg index da3a9f20..322939e4 100644 --- a/packages/components/nodes/retrievers/HydeRetriever/hyderetriever.svg +++ b/packages/components/nodes/retrievers/HydeRetriever/hyderetriever.svg @@ -1,9 +1,4 @@ - - - - - - - - - \ No newline at end of file + + + + diff --git a/packages/components/nodes/retrievers/PromptRetriever/promptretriever.svg b/packages/components/nodes/retrievers/PromptRetriever/promptretriever.svg index db48e8a5..f32ffa7b 100644 --- a/packages/components/nodes/retrievers/PromptRetriever/promptretriever.svg +++ b/packages/components/nodes/retrievers/PromptRetriever/promptretriever.svg @@ -1,8 +1,5 @@ - - - - - - - - \ No newline at end of file + + + + + diff --git a/packages/components/nodes/retrievers/SimilarityThresholdRetriever/similaritythreshold.svg b/packages/components/nodes/retrievers/SimilarityThresholdRetriever/similaritythreshold.svg index 6b918fd8..e82ea3f9 100644 --- a/packages/components/nodes/retrievers/SimilarityThresholdRetriever/similaritythreshold.svg +++ b/packages/components/nodes/retrievers/SimilarityThresholdRetriever/similaritythreshold.svg @@ -1,5 +1,4 @@ - - - - - \ No newline at end of file + + + + diff --git a/packages/components/nodes/retrievers/VectorStoreRetriever/vectorretriever.svg b/packages/components/nodes/retrievers/VectorStoreRetriever/vectorretriever.svg index da3a9f20..9d453432 100644 --- a/packages/components/nodes/retrievers/VectorStoreRetriever/vectorretriever.svg +++ b/packages/components/nodes/retrievers/VectorStoreRetriever/vectorretriever.svg @@ -1,9 +1,4 @@ - - - - - - - - - \ No newline at end of file + + + + diff --git a/packages/components/nodes/textsplitters/CharacterTextSplitter/textsplitter.svg b/packages/components/nodes/textsplitters/CharacterTextSplitter/textsplitter.svg index 73145e2d..5fb03c92 100644 --- a/packages/components/nodes/textsplitters/CharacterTextSplitter/textsplitter.svg +++ b/packages/components/nodes/textsplitters/CharacterTextSplitter/textsplitter.svg @@ -1,7 +1,5 @@ - - - - - - - \ No newline at end of file + + + + + diff --git a/packages/components/nodes/textsplitters/CodeTextSplitter/codeTextSplitter.svg b/packages/components/nodes/textsplitters/CodeTextSplitter/codeTextSplitter.svg index d3b3d188..9d74c891 100644 --- a/packages/components/nodes/textsplitters/CodeTextSplitter/codeTextSplitter.svg +++ b/packages/components/nodes/textsplitters/CodeTextSplitter/codeTextSplitter.svg @@ -1,8 +1,5 @@ - - - - - - - - \ No newline at end of file + + + + + diff --git a/packages/components/nodes/textsplitters/HtmlToMarkdownTextSplitter/htmlToMarkdownTextSplitter.svg b/packages/components/nodes/textsplitters/HtmlToMarkdownTextSplitter/htmlToMarkdownTextSplitter.svg index f7d45d60..b62d20dd 100644 --- a/packages/components/nodes/textsplitters/HtmlToMarkdownTextSplitter/htmlToMarkdownTextSplitter.svg +++ b/packages/components/nodes/textsplitters/HtmlToMarkdownTextSplitter/htmlToMarkdownTextSplitter.svg @@ -1,6 +1,5 @@ - - - - - - \ No newline at end of file + + + + + diff --git a/packages/components/nodes/textsplitters/MarkdownTextSplitter/markdownTextSplitter.svg b/packages/components/nodes/textsplitters/MarkdownTextSplitter/markdownTextSplitter.svg index f7d45d60..b62d20dd 100644 --- a/packages/components/nodes/textsplitters/MarkdownTextSplitter/markdownTextSplitter.svg +++ b/packages/components/nodes/textsplitters/MarkdownTextSplitter/markdownTextSplitter.svg @@ -1,6 +1,5 @@ - - - - - - \ No newline at end of file + + + + + diff --git a/packages/components/nodes/textsplitters/RecursiveCharacterTextSplitter/textsplitter.svg b/packages/components/nodes/textsplitters/RecursiveCharacterTextSplitter/textsplitter.svg index 73145e2d..5fb03c92 100644 --- a/packages/components/nodes/textsplitters/RecursiveCharacterTextSplitter/textsplitter.svg +++ b/packages/components/nodes/textsplitters/RecursiveCharacterTextSplitter/textsplitter.svg @@ -1,7 +1,5 @@ - - - - - - - \ No newline at end of file + + + + + diff --git a/packages/components/nodes/textsplitters/TokenTextSplitter/tiktoken.svg b/packages/components/nodes/textsplitters/TokenTextSplitter/tiktoken.svg index 833cfae1..c7dbe973 100644 --- a/packages/components/nodes/textsplitters/TokenTextSplitter/tiktoken.svg +++ b/packages/components/nodes/textsplitters/TokenTextSplitter/tiktoken.svg @@ -1,7 +1,5 @@ - - - - - - - \ No newline at end of file + + + + + diff --git a/packages/components/nodes/tools/AIPlugin/aiplugin.svg b/packages/components/nodes/tools/AIPlugin/aiplugin.svg index e617e45c..a48cb717 100644 --- a/packages/components/nodes/tools/AIPlugin/aiplugin.svg +++ b/packages/components/nodes/tools/AIPlugin/aiplugin.svg @@ -1,7 +1,6 @@ - - - - - - - \ No newline at end of file + + + + + + diff --git a/packages/components/nodes/tools/BraveSearchAPI/brave.svg b/packages/components/nodes/tools/BraveSearchAPI/brave.svg index 0c0c0e86..b1e23357 100644 --- a/packages/components/nodes/tools/BraveSearchAPI/brave.svg +++ b/packages/components/nodes/tools/BraveSearchAPI/brave.svg @@ -1 +1,8 @@ - \ No newline at end of file + + + + + + + + diff --git a/packages/components/nodes/tools/Calculator/calculator.svg b/packages/components/nodes/tools/Calculator/calculator.svg index 6fa49e15..a0614326 100644 --- a/packages/components/nodes/tools/Calculator/calculator.svg +++ b/packages/components/nodes/tools/Calculator/calculator.svg @@ -1,11 +1,10 @@ - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + diff --git a/packages/components/nodes/tools/ChainTool/chaintool.svg b/packages/components/nodes/tools/ChainTool/chaintool.svg index ab76749b..58b1cb13 100644 --- a/packages/components/nodes/tools/ChainTool/chaintool.svg +++ b/packages/components/nodes/tools/ChainTool/chaintool.svg @@ -1,8 +1,4 @@ - - - - - - - - \ No newline at end of file + + + + diff --git a/packages/components/nodes/tools/CustomTool/core.ts b/packages/components/nodes/tools/CustomTool/core.ts index 8bae726c..7e76e37f 100644 --- a/packages/components/nodes/tools/CustomTool/core.ts +++ b/packages/components/nodes/tools/CustomTool/core.ts @@ -2,37 +2,7 @@ import { z } from 'zod' import { CallbackManagerForToolRun } from 'langchain/callbacks' import { StructuredTool, ToolParams } from 'langchain/tools' import { NodeVM } from 'vm2' - -/* - * List of dependencies allowed to be import in vm2 - */ -const availableDependencies = [ - '@dqbd/tiktoken', - '@getzep/zep-js', - '@huggingface/inference', - '@pinecone-database/pinecone', - '@supabase/supabase-js', - 'axios', - 'cheerio', - 'chromadb', - 'cohere-ai', - 'd3-dsv', - 'form-data', - 'graphql', - 'html-to-text', - 'langchain', - 'linkifyjs', - 'mammoth', - 'moment', - 'node-fetch', - 'pdf-parse', - 'pdfjs-dist', - 'playwright', - 'puppeteer', - 'srt-parser-2', - 'typeorm', - 'weaviate-ts-client' -] +import { availableDependencies } from '../../../src/utils' export interface BaseDynamicToolInput extends ToolParams { name: string diff --git a/packages/components/nodes/tools/CustomTool/customtool.svg b/packages/components/nodes/tools/CustomTool/customtool.svg index c5bd0fbc..6c1977d2 100644 --- a/packages/components/nodes/tools/CustomTool/customtool.svg +++ b/packages/components/nodes/tools/CustomTool/customtool.svg @@ -1,4 +1,3 @@ - - - - \ No newline at end of file + + + diff --git a/packages/components/nodes/tools/GoogleSearchAPI/GoogleSearchAPI.ts b/packages/components/nodes/tools/GoogleSearchAPI/GoogleSearchAPI.ts index 29ebae8b..78fe8e73 100644 --- a/packages/components/nodes/tools/GoogleSearchAPI/GoogleSearchAPI.ts +++ b/packages/components/nodes/tools/GoogleSearchAPI/GoogleSearchAPI.ts @@ -19,7 +19,7 @@ class GoogleCustomSearchAPI_Tools implements INode { this.name = 'googleCustomSearch' this.version = 1.0 this.type = 'GoogleCustomSearchAPI' - this.icon = 'google.png' + this.icon = 'google.svg' this.category = 'Tools' this.description = 'Wrapper around Google Custom Search API - a real-time API to access Google search results' this.inputs = [] diff --git a/packages/components/nodes/tools/GoogleSearchAPI/google.png b/packages/components/nodes/tools/GoogleSearchAPI/google.png deleted file mode 100644 index c7cd4ca1..00000000 Binary files a/packages/components/nodes/tools/GoogleSearchAPI/google.png and /dev/null differ diff --git a/packages/components/nodes/tools/GoogleSearchAPI/google.svg b/packages/components/nodes/tools/GoogleSearchAPI/google.svg new file mode 100644 index 00000000..b4f76f2c --- /dev/null +++ b/packages/components/nodes/tools/GoogleSearchAPI/google.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts b/packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts index d1bf3891..1dc0705b 100644 --- a/packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts +++ b/packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts @@ -22,7 +22,7 @@ class OpenAPIToolkit_Tools implements INode { this.name = 'openAPIToolkit' this.version = 1.0 this.type = 'OpenAPIToolkit' - this.icon = 'openapi.png' + this.icon = 'openapi.svg' this.category = 'Tools' this.description = 'Load OpenAPI specification' this.credential = { diff --git a/packages/components/nodes/tools/OpenAPIToolkit/openapi.png b/packages/components/nodes/tools/OpenAPIToolkit/openapi.png deleted file mode 100644 index 457c2e40..00000000 Binary files a/packages/components/nodes/tools/OpenAPIToolkit/openapi.png and /dev/null differ diff --git a/packages/components/nodes/tools/OpenAPIToolkit/openapi.svg b/packages/components/nodes/tools/OpenAPIToolkit/openapi.svg new file mode 100644 index 00000000..0f623b94 --- /dev/null +++ b/packages/components/nodes/tools/OpenAPIToolkit/openapi.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/components/nodes/tools/ReadFile/readfile.svg b/packages/components/nodes/tools/ReadFile/readfile.svg index 3a57a762..c7cba0ef 100644 --- a/packages/components/nodes/tools/ReadFile/readfile.svg +++ b/packages/components/nodes/tools/ReadFile/readfile.svg @@ -1,6 +1,4 @@ - - - - - - \ No newline at end of file + + + + diff --git a/packages/components/nodes/tools/RequestsGet/requestsget.svg b/packages/components/nodes/tools/RequestsGet/requestsget.svg index 03777e7c..d92c5b51 100644 --- a/packages/components/nodes/tools/RequestsGet/requestsget.svg +++ b/packages/components/nodes/tools/RequestsGet/requestsget.svg @@ -1,8 +1,6 @@ - - - - - - - - \ No newline at end of file + + + + + + diff --git a/packages/components/nodes/tools/RequestsPost/requestspost.svg b/packages/components/nodes/tools/RequestsPost/requestspost.svg index 2bea6e96..477b1baf 100644 --- a/packages/components/nodes/tools/RequestsPost/requestspost.svg +++ b/packages/components/nodes/tools/RequestsPost/requestspost.svg @@ -1,6 +1,7 @@ - - - - - - \ No newline at end of file + + + + + + + diff --git a/packages/components/nodes/tools/RetrieverTool/RetrieverTool.ts b/packages/components/nodes/tools/RetrieverTool/RetrieverTool.ts index 6217ca6e..cc74a015 100644 --- a/packages/components/nodes/tools/RetrieverTool/RetrieverTool.ts +++ b/packages/components/nodes/tools/RetrieverTool/RetrieverTool.ts @@ -21,7 +21,7 @@ class Retriever_Tools implements INode { this.name = 'retrieverTool' this.version = 1.0 this.type = 'RetrieverTool' - this.icon = 'retriever-tool.png' + this.icon = 'retrievertool.svg' this.category = 'Tools' this.description = 'Use a retriever as allowed tool for agent' this.baseClasses = [this.type, 'DynamicTool', ...getBaseClasses(DynamicTool)] diff --git a/packages/components/nodes/tools/RetrieverTool/retriever-tool.png b/packages/components/nodes/tools/RetrieverTool/retriever-tool.png deleted file mode 100644 index 4814d007..00000000 Binary files a/packages/components/nodes/tools/RetrieverTool/retriever-tool.png and /dev/null differ diff --git a/packages/components/nodes/tools/RetrieverTool/retrievertool.svg b/packages/components/nodes/tools/RetrieverTool/retrievertool.svg new file mode 100644 index 00000000..c25a32c8 --- /dev/null +++ b/packages/components/nodes/tools/RetrieverTool/retrievertool.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/components/nodes/tools/SearchApi/searchapi.svg b/packages/components/nodes/tools/SearchApi/searchapi.svg index c44c29c4..0c566712 100644 --- a/packages/components/nodes/tools/SearchApi/searchapi.svg +++ b/packages/components/nodes/tools/SearchApi/searchapi.svg @@ -1 +1,8 @@ -0479_octopus_verti + + + + + + + + diff --git a/packages/components/nodes/tools/SerpAPI/SerpAPI.ts b/packages/components/nodes/tools/SerpAPI/SerpAPI.ts index b7230c85..184dc1c4 100644 --- a/packages/components/nodes/tools/SerpAPI/SerpAPI.ts +++ b/packages/components/nodes/tools/SerpAPI/SerpAPI.ts @@ -19,7 +19,7 @@ class SerpAPI_Tools implements INode { this.name = 'serpAPI' this.version = 1.0 this.type = 'SerpAPI' - this.icon = 'serp.png' + this.icon = 'serp.svg' this.category = 'Tools' this.description = 'Wrapper around SerpAPI - a real-time API to access Google search results' this.inputs = [] diff --git a/packages/components/nodes/tools/SerpAPI/serp.png b/packages/components/nodes/tools/SerpAPI/serp.png deleted file mode 100644 index 338aeaea..00000000 Binary files a/packages/components/nodes/tools/SerpAPI/serp.png and /dev/null differ diff --git a/packages/components/nodes/tools/SerpAPI/serp.svg b/packages/components/nodes/tools/SerpAPI/serp.svg new file mode 100644 index 00000000..04999b54 --- /dev/null +++ b/packages/components/nodes/tools/SerpAPI/serp.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/packages/components/nodes/tools/Serper/Serper.ts b/packages/components/nodes/tools/Serper/Serper.ts index 1facdb3d..2e67a61d 100644 --- a/packages/components/nodes/tools/Serper/Serper.ts +++ b/packages/components/nodes/tools/Serper/Serper.ts @@ -19,7 +19,7 @@ class Serper_Tools implements INode { this.name = 'serper' this.version = 1.0 this.type = 'Serper' - this.icon = 'serper.png' + this.icon = 'serper.svg' this.category = 'Tools' this.description = 'Wrapper around Serper.dev - Google Search API' this.inputs = [] diff --git a/packages/components/nodes/tools/Serper/serper.png b/packages/components/nodes/tools/Serper/serper.png deleted file mode 100644 index 0b094037..00000000 Binary files a/packages/components/nodes/tools/Serper/serper.png and /dev/null differ diff --git a/packages/components/nodes/tools/Serper/serper.svg b/packages/components/nodes/tools/Serper/serper.svg new file mode 100644 index 00000000..819f1888 --- /dev/null +++ b/packages/components/nodes/tools/Serper/serper.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/components/nodes/tools/WebBrowser/webBrowser.svg b/packages/components/nodes/tools/WebBrowser/webBrowser.svg index 01eea4f2..d9b0d629 100644 --- a/packages/components/nodes/tools/WebBrowser/webBrowser.svg +++ b/packages/components/nodes/tools/WebBrowser/webBrowser.svg @@ -1,12 +1,9 @@ - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + diff --git a/packages/components/nodes/tools/WriteFile/writefile.svg b/packages/components/nodes/tools/WriteFile/writefile.svg index 72500bf6..0df04ea4 100644 --- a/packages/components/nodes/tools/WriteFile/writefile.svg +++ b/packages/components/nodes/tools/WriteFile/writefile.svg @@ -1,6 +1,4 @@ - - - - - - \ No newline at end of file + + + + diff --git a/packages/components/nodes/utilities/CustomFunction/CustomFunction.ts b/packages/components/nodes/utilities/CustomFunction/CustomFunction.ts new file mode 100644 index 00000000..b358b24b --- /dev/null +++ b/packages/components/nodes/utilities/CustomFunction/CustomFunction.ts @@ -0,0 +1,124 @@ +import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' +import { NodeVM } from 'vm2' +import { availableDependencies, handleEscapeCharacters } from '../../../src/utils' + +class CustomFunction_Utilities implements INode { + label: string + name: string + version: number + description: string + type: string + icon: string + category: string + baseClasses: string[] + inputs: INodeParams[] + outputs: INodeOutputsValue[] + + constructor() { + this.label = 'Custom JS Function' + this.name = 'customFunction' + this.version = 1.0 + this.type = 'CustomFunction' + this.icon = 'customfunction.svg' + this.category = 'Utilities' + this.description = `Execute custom javascript function` + this.baseClasses = [this.type, 'Utilities'] + this.inputs = [ + { + label: 'Input Variables', + name: 'functionInputVariables', + description: 'Input variables can be used in the function with prefix $. For example: $var', + type: 'json', + optional: true, + acceptVariable: true, + list: true + }, + { + label: 'Function Name', + name: 'functionName', + type: 'string', + optional: true, + placeholder: 'My Function' + }, + { + label: 'Javascript Function', + name: 'javascriptFunction', + type: 'code' + } + ] + this.outputs = [ + { + label: 'Output', + name: 'output', + baseClasses: ['string', 'number', 'boolean', 'json', 'array'] + } + ] + } + + async init(nodeData: INodeData, input: string): Promise { + const javascriptFunction = nodeData.inputs?.javascriptFunction as string + const functionInputVariablesRaw = nodeData.inputs?.functionInputVariables + + let inputVars: ICommonObject = {} + if (functionInputVariablesRaw) { + try { + inputVars = + typeof functionInputVariablesRaw === 'object' ? functionInputVariablesRaw : JSON.parse(functionInputVariablesRaw) + } catch (exception) { + throw new Error("Invalid JSON in the PromptTemplate's promptValues: " + exception) + } + } + + let sandbox: any = { $input: input } + + if (Object.keys(inputVars).length) { + for (const item in inputVars) { + sandbox[`$${item}`] = inputVars[item] + } + } + + const defaultAllowBuiltInDep = [ + 'assert', + 'buffer', + 'crypto', + 'events', + 'http', + 'https', + 'net', + 'path', + 'querystring', + 'timers', + 'tls', + 'url', + 'zlib' + ] + + const builtinDeps = process.env.TOOL_FUNCTION_BUILTIN_DEP + ? defaultAllowBuiltInDep.concat(process.env.TOOL_FUNCTION_BUILTIN_DEP.split(',')) + : defaultAllowBuiltInDep + const externalDeps = process.env.TOOL_FUNCTION_EXTERNAL_DEP ? process.env.TOOL_FUNCTION_EXTERNAL_DEP.split(',') : [] + const deps = availableDependencies.concat(externalDeps) + + const nodeVMOptions = { + console: 'inherit', + sandbox, + require: { + external: { modules: deps }, + builtin: builtinDeps + } + } as any + + const vm = new NodeVM(nodeVMOptions) + try { + const response = await vm.run(`module.exports = async function() {${javascriptFunction}}()`, __dirname) + if (typeof response === 'string') { + return handleEscapeCharacters(response, false) + } + return response + } catch (e) { + throw new Error(e) + } + } +} + +module.exports = { nodeClass: CustomFunction_Utilities } diff --git a/packages/components/nodes/utilities/CustomFunction/customfunction.svg b/packages/components/nodes/utilities/CustomFunction/customfunction.svg new file mode 100644 index 00000000..506f3248 --- /dev/null +++ b/packages/components/nodes/utilities/CustomFunction/customfunction.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/components/nodes/utilities/GetVariable/GetVariable.ts b/packages/components/nodes/utilities/GetVariable/GetVariable.ts new file mode 100644 index 00000000..dde5a2d9 --- /dev/null +++ b/packages/components/nodes/utilities/GetVariable/GetVariable.ts @@ -0,0 +1,52 @@ +import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' + +class GetVariable_Utilities implements INode { + label: string + name: string + version: number + description: string + type: string + icon: string + category: string + baseClasses: string[] + inputs: INodeParams[] + outputs: INodeOutputsValue[] + + constructor() { + this.label = 'Get Variable' + this.name = 'getVariable' + this.version = 1.0 + this.type = 'GetVariable' + this.icon = 'getvar.svg' + this.category = 'Utilities' + this.description = `Get variable that was saved using Set Variable node` + this.baseClasses = [this.type, 'Utilities'] + this.inputs = [ + { + label: 'Variable Name', + name: 'variableName', + type: 'string', + placeholder: 'var1' + } + ] + this.outputs = [ + { + label: 'Output', + name: 'output', + baseClasses: ['string', 'number', 'boolean', 'json', 'array'] + } + ] + } + + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { + const variableName = nodeData.inputs?.variableName as string + const dynamicVars = options.dynamicVariables as Record + + if (Object.prototype.hasOwnProperty.call(dynamicVars, variableName)) { + return dynamicVars[variableName] + } + return undefined + } +} + +module.exports = { nodeClass: GetVariable_Utilities } diff --git a/packages/components/nodes/utilities/GetVariable/getvar.svg b/packages/components/nodes/utilities/GetVariable/getvar.svg new file mode 100644 index 00000000..0528c977 --- /dev/null +++ b/packages/components/nodes/utilities/GetVariable/getvar.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/components/nodes/utilities/IfElseFunction/IfElseFunction.ts b/packages/components/nodes/utilities/IfElseFunction/IfElseFunction.ts new file mode 100644 index 00000000..862521eb --- /dev/null +++ b/packages/components/nodes/utilities/IfElseFunction/IfElseFunction.ts @@ -0,0 +1,143 @@ +import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' +import { NodeVM } from 'vm2' +import { availableDependencies } from '../../../src/utils' + +class IfElseFunction_Utilities implements INode { + label: string + name: string + version: number + description: string + type: string + icon: string + category: string + baseClasses: string[] + inputs: INodeParams[] + outputs: INodeOutputsValue[] + + constructor() { + this.label = 'IfElse Function' + this.name = 'ifElseFunction' + this.version = 1.0 + this.type = 'IfElseFunction' + this.icon = 'ifelsefunction.svg' + this.category = 'Utilities' + this.description = `Split flows based on If Else javascript functions` + this.baseClasses = [this.type, 'Utilities'] + this.inputs = [ + { + label: 'Input Variables', + name: 'functionInputVariables', + description: 'Input variables can be used in the function with prefix $. For example: $var', + type: 'json', + optional: true, + acceptVariable: true, + list: true + }, + { + label: 'IfElse Name', + name: 'functionName', + type: 'string', + optional: true, + placeholder: 'If Condition Match' + }, + { + label: 'If Function', + name: 'ifFunction', + description: 'Function must return a value', + type: 'code', + rows: 2, + default: `if ("hello" == "hello") { + return true; +}` + }, + { + label: 'Else Function', + name: 'elseFunction', + description: 'Function must return a value', + type: 'code', + rows: 2, + default: `return false;` + } + ] + this.outputs = [ + { + label: 'True', + name: 'returnTrue', + baseClasses: ['string', 'number', 'boolean', 'json', 'array'] + }, + { + label: 'False', + name: 'returnFalse', + baseClasses: ['string', 'number', 'boolean', 'json', 'array'] + } + ] + } + + async init(nodeData: INodeData, input: string): Promise { + const ifFunction = nodeData.inputs?.ifFunction as string + const elseFunction = nodeData.inputs?.elseFunction as string + const functionInputVariablesRaw = nodeData.inputs?.functionInputVariables + + let inputVars: ICommonObject = {} + if (functionInputVariablesRaw) { + try { + inputVars = + typeof functionInputVariablesRaw === 'object' ? functionInputVariablesRaw : JSON.parse(functionInputVariablesRaw) + } catch (exception) { + throw new Error("Invalid JSON in the PromptTemplate's promptValues: " + exception) + } + } + + let sandbox: any = { $input: input } + + if (Object.keys(inputVars).length) { + for (const item in inputVars) { + sandbox[`$${item}`] = inputVars[item] + } + } + + const defaultAllowBuiltInDep = [ + 'assert', + 'buffer', + 'crypto', + 'events', + 'http', + 'https', + 'net', + 'path', + 'querystring', + 'timers', + 'tls', + 'url', + 'zlib' + ] + + const builtinDeps = process.env.TOOL_FUNCTION_BUILTIN_DEP + ? defaultAllowBuiltInDep.concat(process.env.TOOL_FUNCTION_BUILTIN_DEP.split(',')) + : defaultAllowBuiltInDep + const externalDeps = process.env.TOOL_FUNCTION_EXTERNAL_DEP ? process.env.TOOL_FUNCTION_EXTERNAL_DEP.split(',') : [] + const deps = availableDependencies.concat(externalDeps) + + const nodeVMOptions = { + console: 'inherit', + sandbox, + require: { + external: { modules: deps }, + builtin: builtinDeps + } + } as any + + const vm = new NodeVM(nodeVMOptions) + try { + const responseTrue = await vm.run(`module.exports = async function() {${ifFunction}}()`, __dirname) + if (responseTrue) return { output: responseTrue, type: true } + + const responseFalse = await vm.run(`module.exports = async function() {${elseFunction}}()`, __dirname) + return { output: responseFalse, type: false } + } catch (e) { + throw new Error(e) + } + } +} + +module.exports = { nodeClass: IfElseFunction_Utilities } diff --git a/packages/components/nodes/utilities/IfElseFunction/ifelsefunction.svg b/packages/components/nodes/utilities/IfElseFunction/ifelsefunction.svg new file mode 100644 index 00000000..f5dd5979 --- /dev/null +++ b/packages/components/nodes/utilities/IfElseFunction/ifelsefunction.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/components/nodes/utilities/SetVariable/SetVariable.ts b/packages/components/nodes/utilities/SetVariable/SetVariable.ts new file mode 100644 index 00000000..8542668c --- /dev/null +++ b/packages/components/nodes/utilities/SetVariable/SetVariable.ts @@ -0,0 +1,56 @@ +import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' + +class SetVariable_Utilities implements INode { + label: string + name: string + version: number + description: string + type: string + icon: string + category: string + baseClasses: string[] + inputs: INodeParams[] + outputs: INodeOutputsValue[] + + constructor() { + this.label = 'Set Variable' + this.name = 'setVariable' + this.version = 1.0 + this.type = 'SetVariable' + this.icon = 'setvar.svg' + this.category = 'Utilities' + this.description = `Set variable which can be retrieved at a later stage. Variable is only available during runtime.` + this.baseClasses = [this.type, 'Utilities'] + this.inputs = [ + { + label: 'Input', + name: 'input', + type: 'string | number | boolean | json | array', + optional: true, + list: true + }, + { + label: 'Variable Name', + name: 'variableName', + type: 'string', + placeholder: 'var1' + } + ] + this.outputs = [ + { + label: 'Output', + name: 'output', + baseClasses: ['string', 'number', 'boolean', 'json', 'array'] + } + ] + } + + async init(nodeData: INodeData): Promise { + const inputRaw = nodeData.inputs?.input + const variableName = nodeData.inputs?.variableName as string + + return { output: inputRaw, dynamicVariables: { [variableName]: inputRaw } } + } +} + +module.exports = { nodeClass: SetVariable_Utilities } diff --git a/packages/components/nodes/utilities/SetVariable/setvar.svg b/packages/components/nodes/utilities/SetVariable/setvar.svg new file mode 100644 index 00000000..a763c4b3 --- /dev/null +++ b/packages/components/nodes/utilities/SetVariable/setvar.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/components/nodes/vectorstores/Elasticsearch/Elasticsearch.ts b/packages/components/nodes/vectorstores/Elasticsearch/Elasticsearch.ts index 5f3cf206..04c90c6b 100644 --- a/packages/components/nodes/vectorstores/Elasticsearch/Elasticsearch.ts +++ b/packages/components/nodes/vectorstores/Elasticsearch/Elasticsearch.ts @@ -183,13 +183,26 @@ const prepareConnectionOptions = ( } else if (cloudId) { let username = getCredentialParam('username', credentialData, nodeData) let password = getCredentialParam('password', credentialData, nodeData) - elasticSearchClientOptions = { - cloud: { - id: cloudId - }, - auth: { - username: username, - password: password + if (cloudId.startsWith('http')) { + elasticSearchClientOptions = { + node: cloudId, + auth: { + username: username, + password: password + }, + tls: { + rejectUnauthorized: false + } + } + } else { + elasticSearchClientOptions = { + cloud: { + id: cloudId + }, + auth: { + username: username, + password: password + } } } } diff --git a/packages/components/nodes/vectorstores/Faiss/faiss.svg b/packages/components/nodes/vectorstores/Faiss/faiss.svg index 5fbe9832..d56ad86b 100644 --- a/packages/components/nodes/vectorstores/Faiss/faiss.svg +++ b/packages/components/nodes/vectorstores/Faiss/faiss.svg @@ -1,10 +1,9 @@ - - - - - - - - - - \ No newline at end of file + + + + + + + + + diff --git a/packages/components/nodes/vectorstores/InMemory/memory.svg b/packages/components/nodes/vectorstores/InMemory/memory.svg index e7f97c87..4e0d9bcb 100644 --- a/packages/components/nodes/vectorstores/InMemory/memory.svg +++ b/packages/components/nodes/vectorstores/InMemory/memory.svg @@ -1,7 +1,19 @@ - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + diff --git a/packages/components/nodes/vectorstores/MongoDBAtlas/MongoDBAtlas.ts b/packages/components/nodes/vectorstores/MongoDBAtlas/MongoDBAtlas.ts index a0699f6b..9bc23f10 100644 --- a/packages/components/nodes/vectorstores/MongoDBAtlas/MongoDBAtlas.ts +++ b/packages/components/nodes/vectorstores/MongoDBAtlas/MongoDBAtlas.ts @@ -26,7 +26,7 @@ class MongoDBAtlas_VectorStores implements INode { this.version = 1.0 this.description = `Upsert embedded data and perform similarity search upon query using MongoDB Atlas, a managed cloud mongodb database` this.type = 'MongoDB Atlas' - this.icon = 'mongodb.png' + this.icon = 'mongodb.svg' this.category = 'Vector Stores' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.badge = 'NEW' diff --git a/packages/components/nodes/vectorstores/MongoDBAtlas/MongoDBSearchBase.ts b/packages/components/nodes/vectorstores/MongoDBAtlas/MongoDBSearchBase.ts index 95930e4a..9866f6a9 100644 --- a/packages/components/nodes/vectorstores/MongoDBAtlas/MongoDBSearchBase.ts +++ b/packages/components/nodes/vectorstores/MongoDBAtlas/MongoDBSearchBase.ts @@ -31,7 +31,7 @@ export abstract class MongoDBSearchBase { protected constructor() { this.type = 'MongoDB Atlas' - this.icon = 'mongodb.png' + this.icon = 'mongodb.svg' this.category = 'Vector Stores' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.badge = 'DEPRECATING' diff --git a/packages/components/nodes/vectorstores/MongoDBAtlas/mongodb.png b/packages/components/nodes/vectorstores/MongoDBAtlas/mongodb.png deleted file mode 100644 index 5586fe0a..00000000 Binary files a/packages/components/nodes/vectorstores/MongoDBAtlas/mongodb.png and /dev/null differ diff --git a/packages/components/nodes/vectorstores/MongoDBAtlas/mongodb.svg b/packages/components/nodes/vectorstores/MongoDBAtlas/mongodb.svg new file mode 100644 index 00000000..49c5f05a --- /dev/null +++ b/packages/components/nodes/vectorstores/MongoDBAtlas/mongodb.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/components/nodes/vectorstores/OpenSearch/OpenSearch.ts b/packages/components/nodes/vectorstores/OpenSearch/OpenSearch.ts index e3e18ce1..6be8977d 100644 --- a/packages/components/nodes/vectorstores/OpenSearch/OpenSearch.ts +++ b/packages/components/nodes/vectorstores/OpenSearch/OpenSearch.ts @@ -24,7 +24,7 @@ class OpenSearch_VectorStores implements INode { this.name = 'openSearch' this.version = 1.0 this.type = 'OpenSearch' - this.icon = 'opensearch.png' + this.icon = 'opensearch.svg' this.category = 'Vector Stores' this.description = `Upsert embedded data and perform similarity search upon query using OpenSearch, an open-source, all-in-one vector database` this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] diff --git a/packages/components/nodes/vectorstores/OpenSearch/OpenSearch_Upsert.ts b/packages/components/nodes/vectorstores/OpenSearch/OpenSearch_Upsert.ts index 2eb47316..e5512df8 100644 --- a/packages/components/nodes/vectorstores/OpenSearch/OpenSearch_Upsert.ts +++ b/packages/components/nodes/vectorstores/OpenSearch/OpenSearch_Upsert.ts @@ -24,7 +24,7 @@ class OpenSearchUpsert_VectorStores implements INode { this.name = 'openSearchUpsertDocument' this.version = 1.0 this.type = 'OpenSearch' - this.icon = 'opensearch.png' + this.icon = 'opensearch.svg' this.category = 'Vector Stores' this.description = 'Upsert documents to OpenSearch' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] diff --git a/packages/components/nodes/vectorstores/OpenSearch/OpenSearch_existing.ts b/packages/components/nodes/vectorstores/OpenSearch/OpenSearch_existing.ts index a012a2e5..b4765a9a 100644 --- a/packages/components/nodes/vectorstores/OpenSearch/OpenSearch_existing.ts +++ b/packages/components/nodes/vectorstores/OpenSearch/OpenSearch_existing.ts @@ -22,7 +22,7 @@ class OpenSearch_Existing_VectorStores implements INode { this.name = 'openSearchExistingIndex' this.version = 1.0 this.type = 'OpenSearch' - this.icon = 'opensearch.png' + this.icon = 'opensearch.svg' this.category = 'Vector Stores' this.description = 'Load existing index from OpenSearch (i.e: Document has been upserted)' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] diff --git a/packages/components/nodes/vectorstores/OpenSearch/opensearch.png b/packages/components/nodes/vectorstores/OpenSearch/opensearch.png deleted file mode 100644 index 3fdcfd3f..00000000 Binary files a/packages/components/nodes/vectorstores/OpenSearch/opensearch.png and /dev/null differ diff --git a/packages/components/nodes/vectorstores/OpenSearch/opensearch.svg b/packages/components/nodes/vectorstores/OpenSearch/opensearch.svg new file mode 100644 index 00000000..6363d52d --- /dev/null +++ b/packages/components/nodes/vectorstores/OpenSearch/opensearch.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/components/nodes/vectorstores/Pinecone/Pinecone.ts b/packages/components/nodes/vectorstores/Pinecone/Pinecone.ts index 4ece4720..4e6967bc 100644 --- a/packages/components/nodes/vectorstores/Pinecone/Pinecone.ts +++ b/packages/components/nodes/vectorstores/Pinecone/Pinecone.ts @@ -25,7 +25,7 @@ class Pinecone_VectorStores implements INode { this.name = 'pinecone' this.version = 1.0 this.type = 'Pinecone' - this.icon = 'pinecone.png' + this.icon = 'pinecone.svg' this.category = 'Vector Stores' this.description = `Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database` this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] diff --git a/packages/components/nodes/vectorstores/Pinecone/Pinecone_Existing.ts b/packages/components/nodes/vectorstores/Pinecone/Pinecone_Existing.ts index ee2db071..9eea70de 100644 --- a/packages/components/nodes/vectorstores/Pinecone/Pinecone_Existing.ts +++ b/packages/components/nodes/vectorstores/Pinecone/Pinecone_Existing.ts @@ -23,7 +23,7 @@ class Pinecone_Existing_VectorStores implements INode { this.name = 'pineconeExistingIndex' this.version = 1.0 this.type = 'Pinecone' - this.icon = 'pinecone.png' + this.icon = 'pinecone.svg' this.category = 'Vector Stores' this.description = 'Load existing index from Pinecone (i.e: Document has been upserted)' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] diff --git a/packages/components/nodes/vectorstores/Pinecone/Pinecone_Upsert.ts b/packages/components/nodes/vectorstores/Pinecone/Pinecone_Upsert.ts index 0c63ce7b..cb54e6e9 100644 --- a/packages/components/nodes/vectorstores/Pinecone/Pinecone_Upsert.ts +++ b/packages/components/nodes/vectorstores/Pinecone/Pinecone_Upsert.ts @@ -25,7 +25,7 @@ class PineconeUpsert_VectorStores implements INode { this.name = 'pineconeUpsert' this.version = 1.0 this.type = 'Pinecone' - this.icon = 'pinecone.png' + this.icon = 'pinecone.svg' this.category = 'Vector Stores' this.description = 'Upsert documents to Pinecone' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] diff --git a/packages/components/nodes/vectorstores/Pinecone/pinecone.png b/packages/components/nodes/vectorstores/Pinecone/pinecone.png deleted file mode 100644 index 1ae189fd..00000000 Binary files a/packages/components/nodes/vectorstores/Pinecone/pinecone.png and /dev/null differ diff --git a/packages/components/nodes/vectorstores/Pinecone/pinecone.svg b/packages/components/nodes/vectorstores/Pinecone/pinecone.svg new file mode 100644 index 00000000..ca047054 --- /dev/null +++ b/packages/components/nodes/vectorstores/Pinecone/pinecone.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/packages/components/nodes/vectorstores/Zep/Zep.ts b/packages/components/nodes/vectorstores/Zep/Zep.ts index 21c885b4..ebb13c64 100644 --- a/packages/components/nodes/vectorstores/Zep/Zep.ts +++ b/packages/components/nodes/vectorstores/Zep/Zep.ts @@ -25,7 +25,7 @@ class Zep_VectorStores implements INode { this.name = 'zep' this.version = 1.0 this.type = 'Zep' - this.icon = 'zep.png' + this.icon = 'zep.svg' this.category = 'Vector Stores' this.description = 'Upsert embedded data and perform similarity search upon query using Zep, a fast and scalable building block for LLM apps' diff --git a/packages/components/nodes/vectorstores/Zep/Zep_Existing.ts b/packages/components/nodes/vectorstores/Zep/Zep_Existing.ts index 5e9d7e1f..e6dbd252 100644 --- a/packages/components/nodes/vectorstores/Zep/Zep_Existing.ts +++ b/packages/components/nodes/vectorstores/Zep/Zep_Existing.ts @@ -24,7 +24,7 @@ class Zep_Existing_VectorStores implements INode { this.name = 'zepExistingIndex' this.version = 1.0 this.type = 'Zep' - this.icon = 'zep.png' + this.icon = 'zep.svg' this.category = 'Vector Stores' this.description = 'Load existing index from Zep (i.e: Document has been upserted)' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] diff --git a/packages/components/nodes/vectorstores/Zep/Zep_Upsert.ts b/packages/components/nodes/vectorstores/Zep/Zep_Upsert.ts index 40b08cbd..0b2e003a 100644 --- a/packages/components/nodes/vectorstores/Zep/Zep_Upsert.ts +++ b/packages/components/nodes/vectorstores/Zep/Zep_Upsert.ts @@ -24,7 +24,7 @@ class Zep_Upsert_VectorStores implements INode { this.name = 'zepUpsert' this.version = 1.0 this.type = 'Zep' - this.icon = 'zep.png' + this.icon = 'zep.svg' this.category = 'Vector Stores' this.description = 'Upsert documents to Zep' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] diff --git a/packages/components/nodes/vectorstores/Zep/zep.png b/packages/components/nodes/vectorstores/Zep/zep.png deleted file mode 100644 index 2fdb2382..00000000 Binary files a/packages/components/nodes/vectorstores/Zep/zep.png and /dev/null differ diff --git a/packages/components/nodes/vectorstores/Zep/zep.svg b/packages/components/nodes/vectorstores/Zep/zep.svg new file mode 100644 index 00000000..6cbbaad2 --- /dev/null +++ b/packages/components/nodes/vectorstores/Zep/zep.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/packages/components/package.json b/packages/components/package.json index 1874ca10..8dd53ce2 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "flowise-components", - "version": "1.4.6", + "version": "1.4.8", "description": "Flowiseai Components", "main": "dist/src/index", "types": "dist/src/index.d.ts", @@ -26,6 +26,8 @@ "@gomomento/sdk-core": "^1.51.1", "@google-ai/generativelanguage": "^0.2.1", "@huggingface/inference": "^2.6.1", + "@langchain/google-genai": "^0.0.3", + "@langchain/mistralai": "^0.0.3", "@notionhq/client": "^2.2.8", "@opensearch-project/opensearch": "^1.2.0", "@pinecone-database/pinecone": "^1.1.1", diff --git a/packages/components/src/utils.ts b/packages/components/src/utils.ts index 404f7c75..239b13ca 100644 --- a/packages/components/src/utils.ts +++ b/packages/components/src/utils.ts @@ -12,6 +12,63 @@ import { AIMessage, HumanMessage } from 'langchain/schema' export const numberOrExpressionRegex = '^(\\d+\\.?\\d*|{{.*}})$' //return true if string consists only numbers OR expression {{}} export const notEmptyRegex = '(.|\\s)*\\S(.|\\s)*' //return true if string is not empty or blank +/* + * List of dependencies allowed to be import in vm2 + */ +export const availableDependencies = [ + '@aws-sdk/client-bedrock-runtime', + '@aws-sdk/client-dynamodb', + '@aws-sdk/client-s3', + '@elastic/elasticsearch', + '@dqbd/tiktoken', + '@getzep/zep-js', + '@gomomento/sdk', + '@gomomento/sdk-core', + '@google-ai/generativelanguage', + '@huggingface/inference', + '@notionhq/client', + '@opensearch-project/opensearch', + '@pinecone-database/pinecone', + '@qdrant/js-client-rest', + '@supabase/supabase-js', + '@upstash/redis', + '@zilliz/milvus2-sdk-node', + 'apify-client', + 'axios', + 'cheerio', + 'chromadb', + 'cohere-ai', + 'd3-dsv', + 'faiss-node', + 'form-data', + 'google-auth-library', + 'graphql', + 'html-to-text', + 'ioredis', + 'langchain', + 'langfuse', + 'langsmith', + 'linkifyjs', + 'llmonitor', + 'mammoth', + 'moment', + 'mongodb', + 'mysql2', + 'node-fetch', + 'node-html-markdown', + 'notion-to-md', + 'openai', + 'pdf-parse', + 'pdfjs-dist', + 'pg', + 'playwright', + 'puppeteer', + 'redis', + 'replicate', + 'srt-parser-2', + 'typeorm', + 'weaviate-ts-client' +] /** * Get base classes of components diff --git a/packages/server/marketplaces/chatflows/IfElse.json b/packages/server/marketplaces/chatflows/IfElse.json new file mode 100644 index 00000000..690d3ce5 --- /dev/null +++ b/packages/server/marketplaces/chatflows/IfElse.json @@ -0,0 +1,1156 @@ +{ + "description": "Split flows based on if else condition", + "badge": "new", + "nodes": [ + { + "width": 300, + "height": 511, + "id": "promptTemplate_0", + "position": { + "x": 792.9464838535649, + "y": 527.1718536712464 + }, + "type": "customNode", + "data": { + "id": "promptTemplate_0", + "label": "Prompt Template", + "version": 1, + "name": "promptTemplate", + "type": "PromptTemplate", + "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"], + "category": "Prompts", + "description": "Schema to represent a basic prompt for an LLM", + "inputParams": [ + { + "label": "Template", + "name": "template", + "type": "string", + "rows": 4, + "placeholder": "What is a good name for a company that makes {product}?", + "id": "promptTemplate_0-input-template-string" + }, + { + "label": "Format Prompt Values", + "name": "promptValues", + "type": "json", + "optional": true, + "acceptVariable": true, + "list": true, + "id": "promptTemplate_0-input-promptValues-json" + } + ], + "inputAnchors": [], + "inputs": { + "template": "You are an AI who performs one task based on the following objective: {objective}.\nRespond with how you would complete this task:", + "promptValues": "{\"objective\":\"{{question}}\"}" + }, + "outputAnchors": [ + { + "id": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", + "name": "promptTemplate", + "label": "PromptTemplate", + "type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 792.9464838535649, + "y": 527.1718536712464 + }, + "dragging": false + }, + { + "width": 300, + "height": 511, + "id": "promptTemplate_1", + "position": { + "x": 1995.1328578238122, + "y": -14.648035759690174 + }, + "type": "customNode", + "data": { + "id": "promptTemplate_1", + "label": "Prompt Template", + "version": 1, + "name": "promptTemplate", + "type": "PromptTemplate", + "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"], + "category": "Prompts", + "description": "Schema to represent a basic prompt for an LLM", + "inputParams": [ + { + "label": "Template", + "name": "template", + "type": "string", + "rows": 4, + "placeholder": "What is a good name for a company that makes {product}?", + "id": "promptTemplate_1-input-template-string" + }, + { + "label": "Format Prompt Values", + "name": "promptValues", + "type": "json", + "optional": true, + "acceptVariable": true, + "list": true, + "id": "promptTemplate_1-input-promptValues-json" + } + ], + "inputAnchors": [], + "inputs": { + "template": "You are a task creation AI that uses the result of an execution agent to create new tasks with the following objective: {objective}.\nThe last completed task has the result: {result}.\nBased on the result, create new tasks to be completed by the AI system that do not overlap with result.\nReturn the tasks as an array.", + "promptValues": "{\"objective\":\"{{question}}\",\"result\":\"{{ifElseFunction_0.data.instance}}\"}" + }, + "outputAnchors": [ + { + "id": "promptTemplate_1-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", + "name": "promptTemplate", + "label": "PromptTemplate", + "type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate" + } + ], + "outputs": {}, + "selected": false + }, + "positionAbsolute": { + "x": 1995.1328578238122, + "y": -14.648035759690174 + }, + "selected": false, + "dragging": false + }, + { + "width": 300, + "height": 574, + "id": "openAI_1", + "position": { + "x": 791.6102007244282, + "y": -83.71386876566092 + }, + "type": "customNode", + "data": { + "id": "openAI_1", + "label": "OpenAI", + "version": 3, + "name": "openAI", + "type": "OpenAI", + "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"], + "category": "LLMs", + "description": "Wrapper around OpenAI large language models", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "openAI_1-input-credential-credential" + }, + { + "label": "Model Name", + "name": "modelName", + "type": "options", + "options": [ + { + "label": "gpt-3.5-turbo-instruct", + "name": "gpt-3.5-turbo-instruct" + }, + { + "label": "babbage-002", + "name": "babbage-002" + }, + { + "label": "davinci-002", + "name": "davinci-002" + } + ], + "default": "gpt-3.5-turbo-instruct", + "optional": true, + "id": "openAI_1-input-modelName-options" + }, + { + "label": "Temperature", + "name": "temperature", + "type": "number", + "default": 0.7, + "optional": true, + "id": "openAI_1-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-topP-number" + }, + { + "label": "Best Of", + "name": "bestOf", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-bestOf-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-presencePenalty-number" + }, + { + "label": "Batch Size", + "name": "batchSize", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-batchSize-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-timeout-number" + }, + { + "label": "BasePath", + "name": "basepath", + "type": "string", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-basepath-string" + } + ], + "inputAnchors": [ + { + "label": "Cache", + "name": "cache", + "type": "BaseCache", + "optional": true, + "id": "openAI_1-input-cache-BaseCache" + } + ], + "inputs": { + "modelName": "gpt-3.5-turbo-instruct", + "temperature": 0.7, + "maxTokens": "", + "topP": "", + "bestOf": "", + "frequencyPenalty": "", + "presencePenalty": "", + "batchSize": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", + "name": "openAI", + "label": "OpenAI", + "type": "OpenAI | BaseLLM | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 791.6102007244282, + "y": -83.71386876566092 + }, + "dragging": false + }, + { + "width": 300, + "height": 574, + "id": "openAI_2", + "position": { + "x": 2340.5995455075863, + "y": -310.7609446553905 + }, + "type": "customNode", + "data": { + "id": "openAI_2", + "label": "OpenAI", + "version": 3, + "name": "openAI", + "type": "OpenAI", + "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"], + "category": "LLMs", + "description": "Wrapper around OpenAI large language models", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "openAI_2-input-credential-credential" + }, + { + "label": "Model Name", + "name": "modelName", + "type": "options", + "options": [ + { + "label": "gpt-3.5-turbo-instruct", + "name": "gpt-3.5-turbo-instruct" + }, + { + "label": "babbage-002", + "name": "babbage-002" + }, + { + "label": "davinci-002", + "name": "davinci-002" + } + ], + "default": "gpt-3.5-turbo-instruct", + "optional": true, + "id": "openAI_2-input-modelName-options" + }, + { + "label": "Temperature", + "name": "temperature", + "type": "number", + "default": 0.7, + "optional": true, + "id": "openAI_2-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-topP-number" + }, + { + "label": "Best Of", + "name": "bestOf", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-bestOf-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-presencePenalty-number" + }, + { + "label": "Batch Size", + "name": "batchSize", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-batchSize-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-timeout-number" + }, + { + "label": "BasePath", + "name": "basepath", + "type": "string", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-basepath-string" + } + ], + "inputAnchors": [ + { + "label": "Cache", + "name": "cache", + "type": "BaseCache", + "optional": true, + "id": "openAI_2-input-cache-BaseCache" + } + ], + "inputs": { + "modelName": "gpt-3.5-turbo-instruct", + "temperature": 0.7, + "maxTokens": "", + "topP": "", + "bestOf": "", + "frequencyPenalty": "", + "presencePenalty": "", + "batchSize": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "openAI_2-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", + "name": "openAI", + "label": "OpenAI", + "type": "OpenAI | BaseLLM | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 2340.5995455075863, + "y": -310.7609446553905 + }, + "dragging": false + }, + { + "width": 300, + "height": 456, + "id": "llmChain_0", + "position": { + "x": 1183.0899727188096, + "y": 385.0159960992951 + }, + "type": "customNode", + "data": { + "id": "llmChain_0", + "label": "LLM Chain", + "version": 3, + "name": "llmChain", + "type": "LLMChain", + "baseClasses": ["LLMChain", "BaseChain", "Runnable"], + "category": "Chains", + "description": "Chain to run queries against LLMs", + "inputParams": [ + { + "label": "Chain Name", + "name": "chainName", + "type": "string", + "placeholder": "Name Your Chain", + "optional": true, + "id": "llmChain_0-input-chainName-string" + } + ], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "llmChain_0-input-model-BaseLanguageModel" + }, + { + "label": "Prompt", + "name": "prompt", + "type": "BasePromptTemplate", + "id": "llmChain_0-input-prompt-BasePromptTemplate" + }, + { + "label": "Output Parser", + "name": "outputParser", + "type": "BaseLLMOutputParser", + "optional": true, + "id": "llmChain_0-input-outputParser-BaseLLMOutputParser" + } + ], + "inputs": { + "model": "{{openAI_1.data.instance}}", + "prompt": "{{promptTemplate_0.data.instance}}", + "outputParser": "", + "chainName": "FirstChain" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "llmChain_0-output-llmChain-LLMChain|BaseChain|Runnable", + "name": "llmChain", + "label": "LLM Chain", + "type": "LLMChain | BaseChain | Runnable" + }, + { + "id": "llmChain_0-output-outputPrediction-string|json", + "name": "outputPrediction", + "label": "Output Prediction", + "type": "string | json" + } + ], + "default": "llmChain" + } + ], + "outputs": { + "output": "outputPrediction" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1183.0899727188096, + "y": 385.0159960992951 + }, + "dragging": false + }, + { + "width": 300, + "height": 456, + "id": "llmChain_1", + "position": { + "x": 2773.675809586143, + "y": 114.39482869328754 + }, + "type": "customNode", + "data": { + "id": "llmChain_1", + "label": "LLM Chain", + "version": 3, + "name": "llmChain", + "type": "LLMChain", + "baseClasses": ["LLMChain", "BaseChain", "Runnable"], + "category": "Chains", + "description": "Chain to run queries against LLMs", + "inputParams": [ + { + "label": "Chain Name", + "name": "chainName", + "type": "string", + "placeholder": "Name Your Chain", + "optional": true, + "id": "llmChain_1-input-chainName-string" + } + ], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "llmChain_1-input-model-BaseLanguageModel" + }, + { + "label": "Prompt", + "name": "prompt", + "type": "BasePromptTemplate", + "id": "llmChain_1-input-prompt-BasePromptTemplate" + }, + { + "label": "Output Parser", + "name": "outputParser", + "type": "BaseLLMOutputParser", + "optional": true, + "id": "llmChain_1-input-outputParser-BaseLLMOutputParser" + } + ], + "inputs": { + "model": "{{openAI_2.data.instance}}", + "prompt": "{{promptTemplate_1.data.instance}}", + "outputParser": "", + "chainName": "LastChain" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "llmChain_1-output-llmChain-LLMChain|BaseChain|Runnable", + "name": "llmChain", + "label": "LLM Chain", + "type": "LLMChain | BaseChain | Runnable" + }, + { + "id": "llmChain_1-output-outputPrediction-string|json", + "name": "outputPrediction", + "label": "Output Prediction", + "type": "string | json" + } + ], + "default": "llmChain" + } + ], + "outputs": { + "output": "llmChain" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 2773.675809586143, + "y": 114.39482869328754 + }, + "dragging": false + }, + { + "width": 300, + "height": 511, + "id": "promptTemplate_2", + "position": { + "x": 1992.5456174373144, + "y": 675.5277193898106 + }, + "type": "customNode", + "data": { + "id": "promptTemplate_2", + "label": "Prompt Template", + "version": 1, + "name": "promptTemplate", + "type": "PromptTemplate", + "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"], + "category": "Prompts", + "description": "Schema to represent a basic prompt for an LLM", + "inputParams": [ + { + "label": "Template", + "name": "template", + "type": "string", + "rows": 4, + "placeholder": "What is a good name for a company that makes {product}?", + "id": "promptTemplate_2-input-template-string" + }, + { + "label": "Format Prompt Values", + "name": "promptValues", + "type": "json", + "optional": true, + "acceptVariable": true, + "list": true, + "id": "promptTemplate_2-input-promptValues-json" + } + ], + "inputAnchors": [], + "inputs": { + "template": "Politely say \"I'm not able to answer the query\"", + "promptValues": "{\"objective\":\"{{question}}\",\"result\":\"\"}" + }, + "outputAnchors": [ + { + "id": "promptTemplate_2-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", + "name": "promptTemplate", + "label": "PromptTemplate", + "type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate" + } + ], + "outputs": {}, + "selected": false + }, + "positionAbsolute": { + "x": 1992.5456174373144, + "y": 675.5277193898106 + }, + "selected": false, + "dragging": false + }, + { + "width": 300, + "height": 507, + "id": "llmChain_2", + "position": { + "x": 2830.477603228176, + "y": 907.9116984679802 + }, + "type": "customNode", + "data": { + "id": "llmChain_2", + "label": "LLM Chain", + "version": 3, + "name": "llmChain", + "type": "LLMChain", + "baseClasses": ["LLMChain", "BaseChain", "Runnable"], + "category": "Chains", + "description": "Chain to run queries against LLMs", + "inputParams": [ + { + "label": "Chain Name", + "name": "chainName", + "type": "string", + "placeholder": "Name Your Chain", + "optional": true, + "id": "llmChain_2-input-chainName-string" + } + ], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "llmChain_2-input-model-BaseLanguageModel" + }, + { + "label": "Prompt", + "name": "prompt", + "type": "BasePromptTemplate", + "id": "llmChain_2-input-prompt-BasePromptTemplate" + }, + { + "label": "Output Parser", + "name": "outputParser", + "type": "BaseLLMOutputParser", + "optional": true, + "id": "llmChain_2-input-outputParser-BaseLLMOutputParser" + }, + { + "label": "Input Moderation", + "description": "Detect text that could generate harmful output and prevent it from being sent to the language model", + "name": "inputModeration", + "type": "Moderation", + "optional": true, + "list": true, + "id": "llmChain_2-input-inputModeration-Moderation" + } + ], + "inputs": { + "model": "{{chatOpenAI_0.data.instance}}", + "prompt": "{{promptTemplate_2.data.instance}}", + "outputParser": "", + "inputModeration": "", + "chainName": "FallbackChain" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "llmChain_2-output-llmChain-LLMChain|BaseChain|Runnable", + "name": "llmChain", + "label": "LLM Chain", + "type": "LLMChain | BaseChain | Runnable" + }, + { + "id": "llmChain_2-output-outputPrediction-string|json", + "name": "outputPrediction", + "label": "Output Prediction", + "type": "string | json" + } + ], + "default": "llmChain" + } + ], + "outputs": { + "output": "llmChain" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 2830.477603228176, + "y": 907.9116984679802 + }, + "dragging": false + }, + { + "width": 300, + "height": 755, + "id": "ifElseFunction_0", + "position": { + "x": 1590.6560099561739, + "y": 265.36655719326177 + }, + "type": "customNode", + "data": { + "id": "ifElseFunction_0", + "label": "IfElse Function", + "version": 1, + "name": "ifElseFunction", + "type": "IfElseFunction", + "baseClasses": ["IfElseFunction", "Utilities"], + "category": "Utilities", + "description": "Split flows based on If Else javascript functions", + "inputParams": [ + { + "label": "Input Variables", + "name": "functionInputVariables", + "description": "Input variables can be used in the function with prefix $. For example: $var", + "type": "json", + "optional": true, + "acceptVariable": true, + "list": true, + "id": "ifElseFunction_0-input-functionInputVariables-json" + }, + { + "label": "IfElse Name", + "name": "functionName", + "type": "string", + "optional": true, + "placeholder": "If Condition Match", + "id": "ifElseFunction_0-input-functionName-string" + }, + { + "label": "If Function", + "name": "ifFunction", + "description": "Function must return a value", + "type": "code", + "rows": 2, + "default": "if (\"hello\" == \"hello\") {\n return true;\n}", + "id": "ifElseFunction_0-input-ifFunction-code" + }, + { + "label": "Else Function", + "name": "elseFunction", + "description": "Function must return a value", + "type": "code", + "rows": 2, + "default": "return false;", + "id": "ifElseFunction_0-input-elseFunction-code" + } + ], + "inputAnchors": [], + "inputs": { + "functionInputVariables": "{\"task\":\"{{llmChain_0.data.instance}}\"}", + "functionName": "If Condition Match", + "ifFunction": "if (\"hello\" == \"21\") {\n return $task;\n}", + "elseFunction": "return false;" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "ifElseFunction_0-output-returnTrue-string|number|boolean|json|array", + "name": "returnTrue", + "label": "True", + "type": "string | number | boolean | json | array" + }, + { + "id": "ifElseFunction_0-output-returnFalse-string|number|boolean|json|array", + "name": "returnFalse", + "label": "False", + "type": "string | number | boolean | json | array" + } + ], + "default": "returnTrue" + } + ], + "outputs": { + "output": "returnTrue" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1590.6560099561739, + "y": 265.36655719326177 + }, + "dragging": false + }, + { + "width": 300, + "height": 574, + "id": "chatOpenAI_0", + "position": { + "x": 2373.5711587130127, + "y": 487.8533802540226 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_0", + "label": "ChatOpenAI", + "version": 2, + "name": "chatOpenAI", + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "Runnable"], + "category": "Chat Models", + "description": "Wrapper around OpenAI large language models that use the Chat endpoint", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_0-input-credential-credential" + }, + { + "label": "Model Name", + "name": "modelName", + "type": "options", + "options": [ + { + "label": "gpt-4", + "name": "gpt-4" + }, + { + "label": "gpt-4-1106-preview", + "name": "gpt-4-1106-preview" + }, + { + "label": "gpt-4-vision-preview", + "name": "gpt-4-vision-preview" + }, + { + "label": "gpt-4-0613", + "name": "gpt-4-0613" + }, + { + "label": "gpt-4-32k", + "name": "gpt-4-32k" + }, + { + "label": "gpt-4-32k-0613", + "name": "gpt-4-32k-0613" + }, + { + "label": "gpt-3.5-turbo", + "name": "gpt-3.5-turbo" + }, + { + "label": "gpt-3.5-turbo-1106", + "name": "gpt-3.5-turbo-1106" + }, + { + "label": "gpt-3.5-turbo-0613", + "name": "gpt-3.5-turbo-0613" + }, + { + "label": "gpt-3.5-turbo-16k", + "name": "gpt-3.5-turbo-16k" + }, + { + "label": "gpt-3.5-turbo-16k-0613", + "name": "gpt-3.5-turbo-16k-0613" + } + ], + "default": "gpt-3.5-turbo", + "optional": true, + "id": "chatOpenAI_0-input-modelName-options" + }, + { + "label": "Temperature", + "name": "temperature", + "type": "number", + "step": 0.1, + "default": 0.9, + "optional": true, + "id": "chatOpenAI_0-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "step": 1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "step": 0.1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "step": 0.1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "step": 0.1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "step": 1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-timeout-number" + }, + { + "label": "BasePath", + "name": "basepath", + "type": "string", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-basepath-string" + }, + { + "label": "BaseOptions", + "name": "baseOptions", + "type": "json", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-baseOptions-json" + } + ], + "inputAnchors": [ + { + "label": "Cache", + "name": "cache", + "type": "BaseCache", + "optional": true, + "id": "chatOpenAI_0-input-cache-BaseCache" + } + ], + "inputs": { + "cache": "", + "modelName": "gpt-3.5-turbo", + "temperature": 0.9, + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "", + "baseOptions": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 2373.5711587130127, + "y": 487.8533802540226 + }, + "dragging": false + } + ], + "edges": [ + { + "source": "openAI_1", + "sourceHandle": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", + "target": "llmChain_0", + "targetHandle": "llmChain_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "openAI_1-openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel-llmChain_0-llmChain_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, + { + "source": "promptTemplate_0", + "sourceHandle": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", + "target": "llmChain_0", + "targetHandle": "llmChain_0-input-prompt-BasePromptTemplate", + "type": "buttonedge", + "id": "promptTemplate_0-promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate-llmChain_0-llmChain_0-input-prompt-BasePromptTemplate", + "data": { + "label": "" + } + }, + { + "source": "promptTemplate_1", + "sourceHandle": "promptTemplate_1-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", + "target": "llmChain_1", + "targetHandle": "llmChain_1-input-prompt-BasePromptTemplate", + "type": "buttonedge", + "id": "promptTemplate_1-promptTemplate_1-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate-llmChain_1-llmChain_1-input-prompt-BasePromptTemplate", + "data": { + "label": "" + } + }, + { + "source": "openAI_2", + "sourceHandle": "openAI_2-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", + "target": "llmChain_1", + "targetHandle": "llmChain_1-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "openAI_2-openAI_2-output-openAI-OpenAI|BaseLLM|BaseLanguageModel-llmChain_1-llmChain_1-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, + { + "source": "promptTemplate_2", + "sourceHandle": "promptTemplate_2-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", + "target": "llmChain_2", + "targetHandle": "llmChain_2-input-prompt-BasePromptTemplate", + "type": "buttonedge", + "id": "promptTemplate_2-promptTemplate_2-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate-llmChain_2-llmChain_2-input-prompt-BasePromptTemplate" + }, + { + "source": "llmChain_0", + "sourceHandle": "llmChain_0-output-outputPrediction-string|json", + "target": "ifElseFunction_0", + "targetHandle": "ifElseFunction_0-input-functionInputVariables-json", + "type": "buttonedge", + "id": "llmChain_0-llmChain_0-output-outputPrediction-string|json-ifElseFunction_0-ifElseFunction_0-input-functionInputVariables-json" + }, + { + "source": "ifElseFunction_0", + "sourceHandle": "ifElseFunction_0-output-returnFalse-string|number|boolean|json|array", + "target": "promptTemplate_2", + "targetHandle": "promptTemplate_2-input-promptValues-json", + "type": "buttonedge", + "id": "ifElseFunction_0-ifElseFunction_0-output-returnFalse-string|number|boolean|json|array-promptTemplate_2-promptTemplate_2-input-promptValues-json" + }, + { + "source": "ifElseFunction_0", + "sourceHandle": "ifElseFunction_0-output-returnTrue-string|number|boolean|json|array", + "target": "promptTemplate_1", + "targetHandle": "promptTemplate_1-input-promptValues-json", + "type": "buttonedge", + "id": "ifElseFunction_0-ifElseFunction_0-output-returnTrue-string|number|boolean|json|array-promptTemplate_1-promptTemplate_1-input-promptValues-json" + }, + { + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable", + "target": "llmChain_2", + "targetHandle": "llmChain_2-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-llmChain_2-llmChain_2-input-model-BaseLanguageModel" + } + ] +} diff --git a/packages/server/marketplaces/chatflows/SQL Prompt.json b/packages/server/marketplaces/chatflows/SQL Prompt.json new file mode 100644 index 00000000..ad08fed8 --- /dev/null +++ b/packages/server/marketplaces/chatflows/SQL Prompt.json @@ -0,0 +1,1712 @@ +{ + "description": "Manually construct prompts to query a SQL database", + "badge": "new", + "nodes": [ + { + "width": 300, + "height": 511, + "id": "promptTemplate_0", + "position": { + "x": 384.84394025989127, + "y": 61.21205260943492 + }, + "type": "customNode", + "data": { + "id": "promptTemplate_0", + "label": "Prompt Template", + "version": 1, + "name": "promptTemplate", + "type": "PromptTemplate", + "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate", "Runnable"], + "category": "Prompts", + "description": "Schema to represent a basic prompt for an LLM", + "inputParams": [ + { + "label": "Template", + "name": "template", + "type": "string", + "rows": 4, + "placeholder": "What is a good name for a company that makes {product}?", + "id": "promptTemplate_0-input-template-string" + }, + { + "label": "Format Prompt Values", + "name": "promptValues", + "type": "json", + "optional": true, + "acceptVariable": true, + "list": true, + "id": "promptTemplate_0-input-promptValues-json" + } + ], + "inputAnchors": [], + "inputs": { + "template": "Based on the provided SQL table schema and question below, return a SQL SELECT ALL query that would answer the user's question. For example: SELECT * FROM table WHERE id = '1'.\n------------\nSCHEMA: {schema}\n------------\nQUESTION: {question}\n------------\nSQL QUERY:", + "promptValues": "{\"schema\":\"{{setVariable_0.data.instance}}\",\"question\":\"{{question}}\"}" + }, + "outputAnchors": [ + { + "id": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable", + "name": "promptTemplate", + "label": "PromptTemplate", + "type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate | Runnable" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 384.84394025989127, + "y": 61.21205260943492 + }, + "dragging": false + }, + { + "width": 300, + "height": 507, + "id": "llmChain_0", + "position": { + "x": 770.4559230968546, + "y": -127.11351409346554 + }, + "type": "customNode", + "data": { + "id": "llmChain_0", + "label": "LLM Chain", + "version": 3, + "name": "llmChain", + "type": "LLMChain", + "baseClasses": ["LLMChain", "BaseChain", "Runnable"], + "category": "Chains", + "description": "Chain to run queries against LLMs", + "inputParams": [ + { + "label": "Chain Name", + "name": "chainName", + "type": "string", + "placeholder": "Name Your Chain", + "optional": true, + "id": "llmChain_0-input-chainName-string" + } + ], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "llmChain_0-input-model-BaseLanguageModel" + }, + { + "label": "Prompt", + "name": "prompt", + "type": "BasePromptTemplate", + "id": "llmChain_0-input-prompt-BasePromptTemplate" + }, + { + "label": "Output Parser", + "name": "outputParser", + "type": "BaseLLMOutputParser", + "optional": true, + "id": "llmChain_0-input-outputParser-BaseLLMOutputParser" + }, + { + "label": "Input Moderation", + "description": "Detect text that could generate harmful output and prevent it from being sent to the language model", + "name": "inputModeration", + "type": "Moderation", + "optional": true, + "list": true, + "id": "llmChain_0-input-inputModeration-Moderation" + } + ], + "inputs": { + "model": "{{chatOpenAI_0.data.instance}}", + "prompt": "{{promptTemplate_0.data.instance}}", + "outputParser": "", + "inputModeration": "", + "chainName": "SQL Query Chain" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "llmChain_0-output-llmChain-LLMChain|BaseChain|Runnable", + "name": "llmChain", + "label": "LLM Chain", + "type": "LLMChain | BaseChain | Runnable" + }, + { + "id": "llmChain_0-output-outputPrediction-string|json", + "name": "outputPrediction", + "label": "Output Prediction", + "type": "string | json" + } + ], + "default": "llmChain" + } + ], + "outputs": { + "output": "outputPrediction" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 770.4559230968546, + "y": -127.11351409346554 + }, + "dragging": false + }, + { + "width": 300, + "height": 574, + "id": "chatOpenAI_0", + "position": { + "x": 372.72389181000057, + "y": -561.0744498265477 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_0", + "label": "ChatOpenAI", + "version": 2, + "name": "chatOpenAI", + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "Runnable"], + "category": "Chat Models", + "description": "Wrapper around OpenAI large language models that use the Chat endpoint", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_0-input-credential-credential" + }, + { + "label": "Model Name", + "name": "modelName", + "type": "options", + "options": [ + { + "label": "gpt-4", + "name": "gpt-4" + }, + { + "label": "gpt-4-1106-preview", + "name": "gpt-4-1106-preview" + }, + { + "label": "gpt-4-vision-preview", + "name": "gpt-4-vision-preview" + }, + { + "label": "gpt-4-0613", + "name": "gpt-4-0613" + }, + { + "label": "gpt-4-32k", + "name": "gpt-4-32k" + }, + { + "label": "gpt-4-32k-0613", + "name": "gpt-4-32k-0613" + }, + { + "label": "gpt-3.5-turbo", + "name": "gpt-3.5-turbo" + }, + { + "label": "gpt-3.5-turbo-1106", + "name": "gpt-3.5-turbo-1106" + }, + { + "label": "gpt-3.5-turbo-0613", + "name": "gpt-3.5-turbo-0613" + }, + { + "label": "gpt-3.5-turbo-16k", + "name": "gpt-3.5-turbo-16k" + }, + { + "label": "gpt-3.5-turbo-16k-0613", + "name": "gpt-3.5-turbo-16k-0613" + } + ], + "default": "gpt-3.5-turbo", + "optional": true, + "id": "chatOpenAI_0-input-modelName-options" + }, + { + "label": "Temperature", + "name": "temperature", + "type": "number", + "step": 0.1, + "default": 0.9, + "optional": true, + "id": "chatOpenAI_0-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "step": 1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "step": 0.1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "step": 0.1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "step": 0.1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "step": 1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-timeout-number" + }, + { + "label": "BasePath", + "name": "basepath", + "type": "string", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-basepath-string" + }, + { + "label": "BaseOptions", + "name": "baseOptions", + "type": "json", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-baseOptions-json" + } + ], + "inputAnchors": [ + { + "label": "Cache", + "name": "cache", + "type": "BaseCache", + "optional": true, + "id": "chatOpenAI_0-input-cache-BaseCache" + } + ], + "inputs": { + "cache": "", + "modelName": "gpt-3.5-turbo-16k", + "temperature": "0", + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "", + "baseOptions": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 372.72389181000057, + "y": -561.0744498265477 + }, + "dragging": false + }, + { + "width": 300, + "height": 574, + "id": "chatOpenAI_1", + "position": { + "x": 2636.1598769864936, + "y": -653.0025971757484 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_1", + "label": "ChatOpenAI", + "version": 2, + "name": "chatOpenAI", + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "Runnable"], + "category": "Chat Models", + "description": "Wrapper around OpenAI large language models that use the Chat endpoint", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_1-input-credential-credential" + }, + { + "label": "Model Name", + "name": "modelName", + "type": "options", + "options": [ + { + "label": "gpt-4", + "name": "gpt-4" + }, + { + "label": "gpt-4-1106-preview", + "name": "gpt-4-1106-preview" + }, + { + "label": "gpt-4-vision-preview", + "name": "gpt-4-vision-preview" + }, + { + "label": "gpt-4-0613", + "name": "gpt-4-0613" + }, + { + "label": "gpt-4-32k", + "name": "gpt-4-32k" + }, + { + "label": "gpt-4-32k-0613", + "name": "gpt-4-32k-0613" + }, + { + "label": "gpt-3.5-turbo", + "name": "gpt-3.5-turbo" + }, + { + "label": "gpt-3.5-turbo-1106", + "name": "gpt-3.5-turbo-1106" + }, + { + "label": "gpt-3.5-turbo-0613", + "name": "gpt-3.5-turbo-0613" + }, + { + "label": "gpt-3.5-turbo-16k", + "name": "gpt-3.5-turbo-16k" + }, + { + "label": "gpt-3.5-turbo-16k-0613", + "name": "gpt-3.5-turbo-16k-0613" + } + ], + "default": "gpt-3.5-turbo", + "optional": true, + "id": "chatOpenAI_1-input-modelName-options" + }, + { + "label": "Temperature", + "name": "temperature", + "type": "number", + "step": 0.1, + "default": 0.9, + "optional": true, + "id": "chatOpenAI_1-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "step": 1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "step": 0.1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "step": 0.1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "step": 0.1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "step": 1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-timeout-number" + }, + { + "label": "BasePath", + "name": "basepath", + "type": "string", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-basepath-string" + }, + { + "label": "BaseOptions", + "name": "baseOptions", + "type": "json", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-baseOptions-json" + } + ], + "inputAnchors": [ + { + "label": "Cache", + "name": "cache", + "type": "BaseCache", + "optional": true, + "id": "chatOpenAI_1-input-cache-BaseCache" + } + ], + "inputs": { + "cache": "", + "modelName": "gpt-3.5-turbo-16k", + "temperature": "0", + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "", + "baseOptions": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 2636.1598769864936, + "y": -653.0025971757484 + }, + "dragging": false + }, + { + "width": 300, + "height": 507, + "id": "llmChain_1", + "position": { + "x": 3089.9937691022837, + "y": -109.24001734925716 + }, + "type": "customNode", + "data": { + "id": "llmChain_1", + "label": "LLM Chain", + "version": 3, + "name": "llmChain", + "type": "LLMChain", + "baseClasses": ["LLMChain", "BaseChain", "Runnable"], + "category": "Chains", + "description": "Chain to run queries against LLMs", + "inputParams": [ + { + "label": "Chain Name", + "name": "chainName", + "type": "string", + "placeholder": "Name Your Chain", + "optional": true, + "id": "llmChain_1-input-chainName-string" + } + ], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "llmChain_1-input-model-BaseLanguageModel" + }, + { + "label": "Prompt", + "name": "prompt", + "type": "BasePromptTemplate", + "id": "llmChain_1-input-prompt-BasePromptTemplate" + }, + { + "label": "Output Parser", + "name": "outputParser", + "type": "BaseLLMOutputParser", + "optional": true, + "id": "llmChain_1-input-outputParser-BaseLLMOutputParser" + }, + { + "label": "Input Moderation", + "description": "Detect text that could generate harmful output and prevent it from being sent to the language model", + "name": "inputModeration", + "type": "Moderation", + "optional": true, + "list": true, + "id": "llmChain_1-input-inputModeration-Moderation" + } + ], + "inputs": { + "model": "{{chatOpenAI_1.data.instance}}", + "prompt": "{{promptTemplate_1.data.instance}}", + "outputParser": "", + "inputModeration": "", + "chainName": "Final Chain" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "llmChain_1-output-llmChain-LLMChain|BaseChain|Runnable", + "name": "llmChain", + "label": "LLM Chain", + "type": "LLMChain | BaseChain | Runnable" + }, + { + "id": "llmChain_1-output-outputPrediction-string|json", + "name": "outputPrediction", + "label": "Output Prediction", + "type": "string | json" + } + ], + "default": "llmChain" + } + ], + "outputs": { + "output": "llmChain" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 3089.9937691022837, + "y": -109.24001734925716 + }, + "dragging": false + }, + { + "width": 300, + "height": 669, + "id": "customFunction_2", + "position": { + "x": -395.18079694059173, + "y": -222.8935573325382 + }, + "type": "customNode", + "data": { + "id": "customFunction_2", + "label": "Custom JS Function", + "version": 1, + "name": "customFunction", + "type": "CustomFunction", + "baseClasses": ["CustomFunction", "Utilities"], + "category": "Utilities", + "description": "Execute custom javascript function", + "inputParams": [ + { + "label": "Input Variables", + "name": "functionInputVariables", + "description": "Input variables can be used in the function with prefix $. For example: $var", + "type": "json", + "optional": true, + "acceptVariable": true, + "list": true, + "id": "customFunction_2-input-functionInputVariables-json" + }, + { + "label": "Function Name", + "name": "functionName", + "type": "string", + "placeholder": "My Function", + "id": "customFunction_2-input-functionName-string" + }, + { + "label": "Javascript Function", + "name": "javascriptFunction", + "type": "code", + "id": "customFunction_2-input-javascriptFunction-code" + } + ], + "inputAnchors": [], + "inputs": { + "functionInputVariables": "", + "functionName": "Get SQL Schema Prompt", + "javascriptFunction": "const HOST = 'singlestore-host.com';\nconst USER = 'admin';\nconst PASSWORD = 'mypassword';\nconst DATABASE = 'mydb';\nconst TABLE = 'samples';\nconst mysql = require('mysql2/promise');\n\nlet sqlSchemaPrompt;\n\n/**\n * Ideal prompt contains schema info and examples\n * Follows best practices as specified form https://arxiv.org/abs/2204.00498\n * =========================================\n * CREATE TABLE samples (firstName varchar NOT NULL, lastName varchar)\n * SELECT * FROM samples LIMIT 3\n * firstName lastName\n * Stephen Tyler\n * Jack McGinnis\n * Steven Repici\n * =========================================\n*/\nfunction getSQLPrompt() {\n return new Promise(async (resolve, reject) => {\n try {\n const singleStoreConnection = mysql.createPool({\n host: HOST,\n user: USER,\n password: PASSWORD,\n database: DATABASE,\n });\n \n // Get schema info\n const [schemaInfo] = await singleStoreConnection.execute(\n `SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = \"${TABLE}\"`\n );\n \n const createColumns = [];\n const columnNames = [];\n \n for (const schemaData of schemaInfo) {\n columnNames.push(`${schemaData['COLUMN_NAME']}`);\n createColumns.push(`${schemaData['COLUMN_NAME']} ${schemaData['COLUMN_TYPE']} ${schemaData['IS_NULLABLE'] === 'NO' ? 'NOT NULL' : ''}`);\n }\n \n const sqlCreateTableQuery = `CREATE TABLE samples (${createColumns.join(', ')})`;\n const sqlSelectTableQuery = `SELECT * FROM samples LIMIT 3`;\n \n // Get first 3 rows\n const [rows] = await singleStoreConnection.execute(\n sqlSelectTableQuery,\n );\n \n const allValues = [];\n for (const row of rows) {\n const rowValues = [];\n for (const colName in row) {\n rowValues.push(row[colName]);\n }\n allValues.push(rowValues.join(' '));\n }\n \n sqlSchemaPrompt = sqlCreateTableQuery + '\\n' + sqlSelectTableQuery + '\\n' + columnNames.join(' ') + '\\n' + allValues.join('\\n');\n \n resolve();\n } catch (e) {\n console.error(e);\n return reject(e);\n }\n });\n}\n\nasync function main() {\n await getSQLPrompt();\n}\n\nawait main();\n\nreturn sqlSchemaPrompt;" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "customFunction_2-output-output-string|number|boolean|json|array", + "name": "output", + "label": "Output", + "type": "string | number | boolean | json | array" + } + ], + "default": "output" + } + ], + "outputs": { + "output": "output" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": -395.18079694059173, + "y": -222.8935573325382 + }, + "dragging": false + }, + { + "width": 300, + "height": 669, + "id": "customFunction_1", + "position": { + "x": 1887.4670208331604, + "y": -275.95340782935716 + }, + "type": "customNode", + "data": { + "id": "customFunction_1", + "label": "Custom JS Function", + "version": 1, + "name": "customFunction", + "type": "CustomFunction", + "baseClasses": ["CustomFunction", "Utilities"], + "category": "Utilities", + "description": "Execute custom javascript function", + "inputParams": [ + { + "label": "Input Variables", + "name": "functionInputVariables", + "description": "Input variables can be used in the function with prefix $. For example: $var", + "type": "json", + "optional": true, + "acceptVariable": true, + "list": true, + "id": "customFunction_1-input-functionInputVariables-json" + }, + { + "label": "Function Name", + "name": "functionName", + "type": "string", + "placeholder": "My Function", + "id": "customFunction_1-input-functionName-string" + }, + { + "label": "Javascript Function", + "name": "javascriptFunction", + "type": "code", + "id": "customFunction_1-input-javascriptFunction-code" + } + ], + "inputAnchors": [], + "inputs": { + "functionInputVariables": "{\"sqlQuery\":\"{{setVariable_1.data.instance}}\"}", + "functionName": "Run SQL Query", + "javascriptFunction": "const HOST = 'singlestore-host.com';\nconst USER = 'admin';\nconst PASSWORD = 'mypassword';\nconst DATABASE = 'mydb';\nconst TABLE = 'samples';\nconst mysql = require('mysql2/promise');\n\nlet result;\n\nfunction getSQLResult() {\n return new Promise(async (resolve, reject) => {\n try {\n const singleStoreConnection = mysql.createPool({\n host: HOST,\n user: USER,\n password: PASSWORD,\n database: DATABASE,\n });\n \n const [rows] = await singleStoreConnection.execute(\n $sqlQuery\n );\n \n result = JSON.stringify(rows)\n \n resolve();\n } catch (e) {\n console.error(e);\n return reject(e);\n }\n });\n}\n\nasync function main() {\n await getSQLResult();\n}\n\nawait main();\n\nreturn result;" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "customFunction_1-output-output-string|number|boolean|json|array", + "name": "output", + "label": "Output", + "type": "string | number | boolean | json | array" + } + ], + "default": "output" + } + ], + "outputs": { + "output": "output" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1887.4670208331604, + "y": -275.95340782935716 + }, + "dragging": false + }, + { + "width": 300, + "height": 511, + "id": "promptTemplate_1", + "position": { + "x": 2638.3935631956588, + "y": -18.55855423639423 + }, + "type": "customNode", + "data": { + "id": "promptTemplate_1", + "label": "Prompt Template", + "version": 1, + "name": "promptTemplate", + "type": "PromptTemplate", + "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate", "Runnable"], + "category": "Prompts", + "description": "Schema to represent a basic prompt for an LLM", + "inputParams": [ + { + "label": "Template", + "name": "template", + "type": "string", + "rows": 4, + "placeholder": "What is a good name for a company that makes {product}?", + "id": "promptTemplate_1-input-template-string" + }, + { + "label": "Format Prompt Values", + "name": "promptValues", + "type": "json", + "optional": true, + "acceptVariable": true, + "list": true, + "id": "promptTemplate_1-input-promptValues-json" + } + ], + "inputAnchors": [], + "inputs": { + "template": "Based on the table schema below, question, SQL query, and SQL response, write a natural language response, be details as possible:\n------------\nSCHEMA: {schema}\n------------\nQUESTION: {question}\n------------\nSQL QUERY: {sqlQuery}\n------------\nSQL RESPONSE: {sqlResponse}\n------------\nNATURAL LANGUAGE RESPONSE:", + "promptValues": "{\"schema\":\"{{getVariable_0.data.instance}}\",\"question\":\"{{question}}\",\"sqlResponse\":\"{{customFunction_1.data.instance}}\",\"sqlQuery\":\"{{getVariable_1.data.instance}}\"}" + }, + "outputAnchors": [ + { + "id": "promptTemplate_1-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable", + "name": "promptTemplate", + "label": "PromptTemplate", + "type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate | Runnable" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "dragging": false, + "positionAbsolute": { + "x": 2638.3935631956588, + "y": -18.55855423639423 + } + }, + { + "width": 300, + "height": 355, + "id": "setVariable_0", + "position": { + "x": 18.689175061831122, + "y": -62.81166351070223 + }, + "type": "customNode", + "data": { + "id": "setVariable_0", + "label": "Set Variable", + "version": 1, + "name": "setVariable", + "type": "SetVariable", + "baseClasses": ["SetVariable", "Utilities"], + "category": "Utilities", + "description": "Set variable which can be retrieved at a later stage. Variable is only available during runtime.", + "inputParams": [ + { + "label": "Variable Name", + "name": "variableName", + "type": "string", + "placeholder": "var1", + "id": "setVariable_0-input-variableName-string" + } + ], + "inputAnchors": [ + { + "label": "Input", + "name": "input", + "type": "string | number | boolean | json | array", + "optional": true, + "list": true, + "id": "setVariable_0-input-input-string | number | boolean | json | array" + } + ], + "inputs": { + "input": ["{{customFunction_2.data.instance}}"], + "variableName": "schemaPrompt" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "setVariable_0-output-output-string|number|boolean|json|array", + "name": "output", + "label": "Output", + "type": "string | number | boolean | json | array" + } + ], + "default": "output" + } + ], + "outputs": { + "output": "output" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 18.689175061831122, + "y": -62.81166351070223 + }, + "dragging": false + }, + { + "width": 300, + "height": 304, + "id": "getVariable_0", + "position": { + "x": 2248.4540716891547, + "y": -47.21232652005119 + }, + "type": "customNode", + "data": { + "id": "getVariable_0", + "label": "Get Variable", + "version": 1, + "name": "getVariable", + "type": "GetVariable", + "baseClasses": ["GetVariable", "Utilities"], + "category": "Utilities", + "description": "Get variable that was saved using Set Variable node", + "inputParams": [ + { + "label": "Variable Name", + "name": "variableName", + "type": "string", + "placeholder": "var1", + "id": "getVariable_0-input-variableName-string" + } + ], + "inputAnchors": [], + "inputs": { + "variableName": "schemaPrompt" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "getVariable_0-output-output-string|number|boolean|json|array", + "name": "output", + "label": "Output", + "type": "string | number | boolean | json | array" + } + ], + "default": "output" + } + ], + "outputs": { + "output": "output" + }, + "selected": false + }, + "positionAbsolute": { + "x": 2248.4540716891547, + "y": -47.21232652005119 + }, + "selected": false, + "dragging": false + }, + { + "width": 300, + "height": 304, + "id": "getVariable_1", + "position": { + "x": 2256.0258940322105, + "y": 437.4363694364632 + }, + "type": "customNode", + "data": { + "id": "getVariable_1", + "label": "Get Variable", + "version": 1, + "name": "getVariable", + "type": "GetVariable", + "baseClasses": ["GetVariable", "Utilities"], + "category": "Utilities", + "description": "Get variable that was saved using Set Variable node", + "inputParams": [ + { + "label": "Variable Name", + "name": "variableName", + "type": "string", + "placeholder": "var1", + "id": "getVariable_1-input-variableName-string" + } + ], + "inputAnchors": [], + "inputs": { + "variableName": "sqlQuery" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "getVariable_1-output-output-string|number|boolean|json|array", + "name": "output", + "label": "Output", + "type": "string | number | boolean | json | array" + } + ], + "default": "output" + } + ], + "outputs": { + "output": "output" + }, + "selected": false + }, + "positionAbsolute": { + "x": 2256.0258940322105, + "y": 437.4363694364632 + }, + "selected": false, + "dragging": false + }, + { + "width": 300, + "height": 355, + "id": "setVariable_1", + "position": { + "x": 1516.338224315744, + "y": -133.6986023683283 + }, + "type": "customNode", + "data": { + "id": "setVariable_1", + "label": "Set Variable", + "version": 1, + "name": "setVariable", + "type": "SetVariable", + "baseClasses": ["SetVariable", "Utilities"], + "category": "Utilities", + "description": "Set variable which can be retrieved at a later stage. Variable is only available during runtime.", + "inputParams": [ + { + "label": "Variable Name", + "name": "variableName", + "type": "string", + "placeholder": "var1", + "id": "setVariable_1-input-variableName-string" + } + ], + "inputAnchors": [ + { + "label": "Input", + "name": "input", + "type": "string | number | boolean | json | array", + "optional": true, + "list": true, + "id": "setVariable_1-input-input-string | number | boolean | json | array" + } + ], + "inputs": { + "input": ["{{ifElseFunction_0.data.instance}}"], + "variableName": "sqlQuery" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "setVariable_1-output-output-string|number|boolean|json|array", + "name": "output", + "label": "Output", + "type": "string | number | boolean | json | array" + } + ], + "default": "output" + } + ], + "outputs": { + "output": "output" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1516.338224315744, + "y": -133.6986023683283 + }, + "dragging": false + }, + { + "width": 300, + "height": 755, + "id": "ifElseFunction_0", + "position": { + "x": 1147.8020838770517, + "y": -237.39478763322148 + }, + "type": "customNode", + "data": { + "id": "ifElseFunction_0", + "label": "IfElse Function", + "version": 1, + "name": "ifElseFunction", + "type": "IfElseFunction", + "baseClasses": ["IfElseFunction", "Utilities"], + "category": "Utilities", + "description": "Split flows based on If Else javascript functions", + "inputParams": [ + { + "label": "Input Variables", + "name": "functionInputVariables", + "description": "Input variables can be used in the function with prefix $. For example: $var", + "type": "json", + "optional": true, + "acceptVariable": true, + "list": true, + "id": "ifElseFunction_0-input-functionInputVariables-json" + }, + { + "label": "IfElse Name", + "name": "functionName", + "type": "string", + "optional": true, + "placeholder": "If Condition Match", + "id": "ifElseFunction_0-input-functionName-string" + }, + { + "label": "If Function", + "name": "ifFunction", + "description": "Function must return a value", + "type": "code", + "rows": 2, + "default": "if (\"hello\" == \"hello\") {\n return true;\n}", + "id": "ifElseFunction_0-input-ifFunction-code" + }, + { + "label": "Else Function", + "name": "elseFunction", + "description": "Function must return a value", + "type": "code", + "rows": 2, + "default": "return false;", + "id": "ifElseFunction_0-input-elseFunction-code" + } + ], + "inputAnchors": [], + "inputs": { + "functionInputVariables": "{\"sqlQuery\":\"{{llmChain_0.data.instance}}\"}", + "functionName": "IF SQL Query contains SELECT and WHERE", + "ifFunction": "const sqlQuery = $sqlQuery.trim();\n\nif (sqlQuery.includes(\"SELECT\") && sqlQuery.includes(\"WHERE\")) {\n return sqlQuery;\n}", + "elseFunction": "return $sqlQuery;" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "ifElseFunction_0-output-returnTrue-string|number|boolean|json|array", + "name": "returnTrue", + "label": "True", + "type": "string | number | boolean | json | array" + }, + { + "id": "ifElseFunction_0-output-returnFalse-string|number|boolean|json|array", + "name": "returnFalse", + "label": "False", + "type": "string | number | boolean | json | array" + } + ], + "default": "returnTrue" + } + ], + "outputs": { + "output": "returnTrue" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1147.8020838770517, + "y": -237.39478763322148 + }, + "dragging": false + }, + { + "width": 300, + "height": 511, + "id": "promptTemplate_2", + "position": { + "x": 1530.0647779039386, + "y": 944.9904482583751 + }, + "type": "customNode", + "data": { + "id": "promptTemplate_2", + "label": "Prompt Template", + "version": 1, + "name": "promptTemplate", + "type": "PromptTemplate", + "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate", "Runnable"], + "category": "Prompts", + "description": "Schema to represent a basic prompt for an LLM", + "inputParams": [ + { + "label": "Template", + "name": "template", + "type": "string", + "rows": 4, + "placeholder": "What is a good name for a company that makes {product}?", + "id": "promptTemplate_2-input-template-string" + }, + { + "label": "Format Prompt Values", + "name": "promptValues", + "type": "json", + "optional": true, + "acceptVariable": true, + "list": true, + "id": "promptTemplate_2-input-promptValues-json" + } + ], + "inputAnchors": [], + "inputs": { + "template": "Politely say \"I'm not able to answer query\"", + "promptValues": "{\"schema\":\"{{setVariable_0.data.instance}}\",\"question\":\"{{question}}\"}" + }, + "outputAnchors": [ + { + "id": "promptTemplate_2-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable", + "name": "promptTemplate", + "label": "PromptTemplate", + "type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate | Runnable" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1530.0647779039386, + "y": 944.9904482583751 + }, + "dragging": false + }, + { + "width": 300, + "height": 574, + "id": "chatOpenAI_2", + "position": { + "x": 1537.0307928738125, + "y": 330.7727229610632 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_2", + "label": "ChatOpenAI", + "version": 2, + "name": "chatOpenAI", + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "Runnable"], + "category": "Chat Models", + "description": "Wrapper around OpenAI large language models that use the Chat endpoint", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_2-input-credential-credential" + }, + { + "label": "Model Name", + "name": "modelName", + "type": "options", + "options": [ + { + "label": "gpt-4", + "name": "gpt-4" + }, + { + "label": "gpt-4-1106-preview", + "name": "gpt-4-1106-preview" + }, + { + "label": "gpt-4-vision-preview", + "name": "gpt-4-vision-preview" + }, + { + "label": "gpt-4-0613", + "name": "gpt-4-0613" + }, + { + "label": "gpt-4-32k", + "name": "gpt-4-32k" + }, + { + "label": "gpt-4-32k-0613", + "name": "gpt-4-32k-0613" + }, + { + "label": "gpt-3.5-turbo", + "name": "gpt-3.5-turbo" + }, + { + "label": "gpt-3.5-turbo-1106", + "name": "gpt-3.5-turbo-1106" + }, + { + "label": "gpt-3.5-turbo-0613", + "name": "gpt-3.5-turbo-0613" + }, + { + "label": "gpt-3.5-turbo-16k", + "name": "gpt-3.5-turbo-16k" + }, + { + "label": "gpt-3.5-turbo-16k-0613", + "name": "gpt-3.5-turbo-16k-0613" + } + ], + "default": "gpt-3.5-turbo", + "optional": true, + "id": "chatOpenAI_2-input-modelName-options" + }, + { + "label": "Temperature", + "name": "temperature", + "type": "number", + "step": 0.1, + "default": 0.9, + "optional": true, + "id": "chatOpenAI_2-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "step": 1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_2-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "step": 0.1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_2-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "step": 0.1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_2-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "step": 0.1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_2-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "step": 1, + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_2-input-timeout-number" + }, + { + "label": "BasePath", + "name": "basepath", + "type": "string", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_2-input-basepath-string" + }, + { + "label": "BaseOptions", + "name": "baseOptions", + "type": "json", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_2-input-baseOptions-json" + } + ], + "inputAnchors": [ + { + "label": "Cache", + "name": "cache", + "type": "BaseCache", + "optional": true, + "id": "chatOpenAI_2-input-cache-BaseCache" + } + ], + "inputs": { + "cache": "", + "modelName": "gpt-3.5-turbo-16k", + "temperature": "0.7", + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "", + "baseOptions": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1537.0307928738125, + "y": 330.7727229610632 + }, + "dragging": false + }, + { + "width": 300, + "height": 507, + "id": "llmChain_2", + "position": { + "x": 2077.2866807477812, + "y": 958.6594167386253 + }, + "type": "customNode", + "data": { + "id": "llmChain_2", + "label": "LLM Chain", + "version": 3, + "name": "llmChain", + "type": "LLMChain", + "baseClasses": ["LLMChain", "BaseChain", "Runnable"], + "category": "Chains", + "description": "Chain to run queries against LLMs", + "inputParams": [ + { + "label": "Chain Name", + "name": "chainName", + "type": "string", + "placeholder": "Name Your Chain", + "optional": true, + "id": "llmChain_2-input-chainName-string" + } + ], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "llmChain_2-input-model-BaseLanguageModel" + }, + { + "label": "Prompt", + "name": "prompt", + "type": "BasePromptTemplate", + "id": "llmChain_2-input-prompt-BasePromptTemplate" + }, + { + "label": "Output Parser", + "name": "outputParser", + "type": "BaseLLMOutputParser", + "optional": true, + "id": "llmChain_2-input-outputParser-BaseLLMOutputParser" + }, + { + "label": "Input Moderation", + "description": "Detect text that could generate harmful output and prevent it from being sent to the language model", + "name": "inputModeration", + "type": "Moderation", + "optional": true, + "list": true, + "id": "llmChain_2-input-inputModeration-Moderation" + } + ], + "inputs": { + "model": "{{chatOpenAI_2.data.instance}}", + "prompt": "{{promptTemplate_2.data.instance}}", + "outputParser": "", + "inputModeration": "", + "chainName": "Fallback Chain" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "llmChain_2-output-llmChain-LLMChain|BaseChain|Runnable", + "name": "llmChain", + "label": "LLM Chain", + "type": "LLMChain | BaseChain | Runnable" + }, + { + "id": "llmChain_2-output-outputPrediction-string|json", + "name": "outputPrediction", + "label": "Output Prediction", + "type": "string | json" + } + ], + "default": "llmChain" + } + ], + "outputs": { + "output": "llmChain" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 2077.2866807477812, + "y": 958.6594167386253 + }, + "dragging": false + } + ], + "edges": [ + { + "source": "promptTemplate_0", + "sourceHandle": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable", + "target": "llmChain_0", + "targetHandle": "llmChain_0-input-prompt-BasePromptTemplate", + "type": "buttonedge", + "id": "promptTemplate_0-promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable-llmChain_0-llmChain_0-input-prompt-BasePromptTemplate", + "data": { + "label": "" + } + }, + { + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable", + "target": "llmChain_0", + "targetHandle": "llmChain_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-llmChain_0-llmChain_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, + { + "source": "chatOpenAI_1", + "sourceHandle": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable", + "target": "llmChain_1", + "targetHandle": "llmChain_1-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_1-chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-llmChain_1-llmChain_1-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, + { + "source": "customFunction_1", + "sourceHandle": "customFunction_1-output-output-string|number|boolean|json|array", + "target": "promptTemplate_1", + "targetHandle": "promptTemplate_1-input-promptValues-json", + "type": "buttonedge", + "id": "customFunction_1-customFunction_1-output-output-string|number|boolean|json|array-promptTemplate_1-promptTemplate_1-input-promptValues-json", + "data": { + "label": "" + } + }, + { + "source": "promptTemplate_1", + "sourceHandle": "promptTemplate_1-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable", + "target": "llmChain_1", + "targetHandle": "llmChain_1-input-prompt-BasePromptTemplate", + "type": "buttonedge", + "id": "promptTemplate_1-promptTemplate_1-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable-llmChain_1-llmChain_1-input-prompt-BasePromptTemplate", + "data": { + "label": "" + } + }, + { + "source": "customFunction_2", + "sourceHandle": "customFunction_2-output-output-string|number|boolean|json|array", + "target": "setVariable_0", + "targetHandle": "setVariable_0-input-input-string | number | boolean | json | array", + "type": "buttonedge", + "id": "customFunction_2-customFunction_2-output-output-string|number|boolean|json|array-setVariable_0-setVariable_0-input-input-string | number | boolean | json | array", + "data": { + "label": "" + } + }, + { + "source": "setVariable_0", + "sourceHandle": "setVariable_0-output-output-string|number|boolean|json|array", + "target": "promptTemplate_0", + "targetHandle": "promptTemplate_0-input-promptValues-json", + "type": "buttonedge", + "id": "setVariable_0-setVariable_0-output-output-string|number|boolean|json|array-promptTemplate_0-promptTemplate_0-input-promptValues-json", + "data": { + "label": "" + } + }, + { + "source": "getVariable_0", + "sourceHandle": "getVariable_0-output-output-string|number|boolean|json|array", + "target": "promptTemplate_1", + "targetHandle": "promptTemplate_1-input-promptValues-json", + "type": "buttonedge", + "id": "getVariable_0-getVariable_0-output-output-string|number|boolean|json|array-promptTemplate_1-promptTemplate_1-input-promptValues-json", + "data": { + "label": "" + } + }, + { + "source": "getVariable_1", + "sourceHandle": "getVariable_1-output-output-string|number|boolean|json|array", + "target": "promptTemplate_1", + "targetHandle": "promptTemplate_1-input-promptValues-json", + "type": "buttonedge", + "id": "getVariable_1-getVariable_1-output-output-string|number|boolean|json|array-promptTemplate_1-promptTemplate_1-input-promptValues-json", + "data": { + "label": "" + } + }, + { + "source": "setVariable_1", + "sourceHandle": "setVariable_1-output-output-string|number|boolean|json|array", + "target": "customFunction_1", + "targetHandle": "customFunction_1-input-functionInputVariables-json", + "type": "buttonedge", + "id": "setVariable_1-setVariable_1-output-output-string|number|boolean|json|array-customFunction_1-customFunction_1-input-functionInputVariables-json", + "data": { + "label": "" + } + }, + { + "source": "llmChain_0", + "sourceHandle": "llmChain_0-output-outputPrediction-string|json", + "target": "ifElseFunction_0", + "targetHandle": "ifElseFunction_0-input-functionInputVariables-json", + "type": "buttonedge", + "id": "llmChain_0-llmChain_0-output-outputPrediction-string|json-ifElseFunction_0-ifElseFunction_0-input-functionInputVariables-json" + }, + { + "source": "ifElseFunction_0", + "sourceHandle": "ifElseFunction_0-output-returnTrue-string|number|boolean|json|array", + "target": "setVariable_1", + "targetHandle": "setVariable_1-input-input-string | number | boolean | json | array", + "type": "buttonedge", + "id": "ifElseFunction_0-ifElseFunction_0-output-returnTrue-string|number|boolean|json|array-setVariable_1-setVariable_1-input-input-string | number | boolean | json | array" + }, + { + "source": "ifElseFunction_0", + "sourceHandle": "ifElseFunction_0-output-returnFalse-string|number|boolean|json|array", + "target": "promptTemplate_2", + "targetHandle": "promptTemplate_2-input-promptValues-json", + "type": "buttonedge", + "id": "ifElseFunction_0-ifElseFunction_0-output-returnFalse-string|number|boolean|json|array-promptTemplate_2-promptTemplate_2-input-promptValues-json" + }, + { + "source": "chatOpenAI_2", + "sourceHandle": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable", + "target": "llmChain_2", + "targetHandle": "llmChain_2-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_2-chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-llmChain_2-llmChain_2-input-model-BaseLanguageModel" + }, + { + "source": "promptTemplate_2", + "sourceHandle": "promptTemplate_2-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable", + "target": "llmChain_2", + "targetHandle": "llmChain_2-input-prompt-BasePromptTemplate", + "type": "buttonedge", + "id": "promptTemplate_2-promptTemplate_2-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable-llmChain_2-llmChain_2-input-prompt-BasePromptTemplate" + } + ] +} diff --git a/packages/server/package.json b/packages/server/package.json index ab1f6149..9e29eec5 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "flowise", - "version": "1.4.5", + "version": "1.4.6", "description": "Flowiseai Server", "main": "dist/index", "types": "dist/index.d.ts", diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index cd964bed..99fcba70 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -20,13 +20,14 @@ import { ICredentialReturnResponse, chatType, IChatMessage, - IReactFlowEdge + IReactFlowEdge, + IDepthQueue } from './Interface' import { getNodeModulesPackagePath, getStartingNodes, buildLangchain, - getEndingNode, + getEndingNodes, constructGraphs, resolveVariables, isStartNodeDependOnInput, @@ -56,7 +57,7 @@ import { Tool } from './database/entities/Tool' import { Assistant } from './database/entities/Assistant' import { ChatflowPool } from './ChatflowPool' import { CachePool } from './CachePool' -import { ICommonObject, IMessage, INodeOptionsValue } from 'flowise-components' +import { ICommonObject, IMessage, INodeOptionsValue, handleEscapeCharacters } from 'flowise-components' import { createRateLimiter, getRateLimiter, initializeRateLimiter } from './utils/rateLimit' import { addAPIKey, compareKeys, deleteAPIKey, getApiKey, getAPIKeys, updateAPIKey } from './utils/apiKey' import { sanitizeMiddleware } from './utils/XSS' @@ -283,6 +284,29 @@ export class App { } }) + // execute custom function node + this.app.post('/api/v1/node-custom-function', async (req: Request, res: Response) => { + const body = req.body + const nodeData = { inputs: body } + if (Object.prototype.hasOwnProperty.call(this.nodesPool.componentNodes, 'customFunction')) { + try { + const nodeInstanceFilePath = this.nodesPool.componentNodes['customFunction'].filePath as string + const nodeModule = await import(nodeInstanceFilePath) + const newNodeInstance = new nodeModule.nodeClass() + + const returnData = await newNodeInstance.init(nodeData) + const result = typeof returnData === 'string' ? handleEscapeCharacters(returnData, true) : returnData + + return res.json(result) + } catch (error) { + return res.status(500).send(`Error running custom function: ${error}`) + } + } else { + res.status(404).send(`Node customFunction not found`) + return + } + }) + // ---------------------------------------- // Chatflows // ---------------------------------------- @@ -411,19 +435,24 @@ export class App { const edges = parsedFlowData.edges const { graph, nodeDependencies } = constructGraphs(nodes, edges) - const endingNodeId = getEndingNode(nodeDependencies, graph) - if (!endingNodeId) return res.status(500).send(`Ending node ${endingNodeId} not found`) + const endingNodeIds = getEndingNodes(nodeDependencies, graph) + if (!endingNodeIds.length) return res.status(500).send(`Ending nodes not found`) - const endingNodeData = nodes.find((nd) => nd.id === endingNodeId)?.data - if (!endingNodeData) return res.status(500).send(`Ending node ${endingNodeId} data not found`) + const endingNodes = nodes.filter((nd) => endingNodeIds.includes(nd.id)) - if (endingNodeData && endingNodeData.category !== 'Chains' && endingNodeData.category !== 'Agents') { - return res.status(500).send(`Ending node must be either a Chain or Agent`) + let isStreaming = false + for (const endingNode of endingNodes) { + const endingNodeData = endingNode.data + if (!endingNodeData) return res.status(500).send(`Ending node ${endingNode.id} data not found`) + + if (endingNodeData && endingNodeData.category !== 'Chains' && endingNodeData.category !== 'Agents') { + return res.status(500).send(`Ending node must be either a Chain or Agent`) + } + + isStreaming = isFlowValidForStream(nodes, endingNodeData) } - const obj = { - isStreaming: isFlowValidForStream(nodes, endingNodeData) - } + const obj = { isStreaming } return res.json(obj) }) @@ -1480,48 +1509,65 @@ export class App { /*** Get Ending Node with Directed Graph ***/ const { graph, nodeDependencies } = constructGraphs(nodes, edges) const directedGraph = graph - const endingNodeId = getEndingNode(nodeDependencies, directedGraph) - if (!endingNodeId) return res.status(500).send(`Ending node ${endingNodeId} not found`) + const endingNodeIds = getEndingNodes(nodeDependencies, directedGraph) + if (!endingNodeIds.length) return res.status(500).send(`Ending nodes not found`) - const endingNodeData = nodes.find((nd) => nd.id === endingNodeId)?.data - if (!endingNodeData) return res.status(500).send(`Ending node ${endingNodeId} data not found`) + const endingNodes = nodes.filter((nd) => endingNodeIds.includes(nd.id)) + for (const endingNode of endingNodes) { + const endingNodeData = endingNode.data + if (!endingNodeData) return res.status(500).send(`Ending node ${endingNode.id} data not found`) - if (endingNodeData && endingNodeData.category !== 'Chains' && endingNodeData.category !== 'Agents' && !isUpsert) { - return res.status(500).send(`Ending node must be either a Chain or Agent`) + if (endingNodeData && endingNodeData.category !== 'Chains' && endingNodeData.category !== 'Agents') { + return res.status(500).send(`Ending node must be either a Chain or Agent`) + } + + if ( + endingNodeData.outputs && + Object.keys(endingNodeData.outputs).length && + !Object.values(endingNodeData.outputs).includes(endingNodeData.name) && + !isUpsert + ) { + return res + .status(500) + .send( + `Output of ${endingNodeData.label} (${endingNodeData.id}) must be ${endingNodeData.label}, can't be an Output Prediction` + ) + } + + isStreamValid = isFlowValidForStream(nodes, endingNodeData) } - if ( - endingNodeData.outputs && - Object.keys(endingNodeData.outputs).length && - !Object.values(endingNodeData.outputs).includes(endingNodeData.name) && - !isUpsert - ) { - return res - .status(500) - .send( - `Output of ${endingNodeData.label} (${endingNodeData.id}) must be ${endingNodeData.label}, can't be an Output Prediction` - ) - } - - isStreamValid = isFlowValidForStream(nodes, endingNodeData) - let chatHistory: IMessage[] | string = incomingInput.history - if ( - endingNodeData.inputs?.memory && - !incomingInput.history && - (incomingInput.chatId || incomingInput.overrideConfig?.sessionId) - ) { - const memoryNodeId = endingNodeData.inputs?.memory.split('.')[0].replace('{{', '') - const memoryNode = nodes.find((node) => node.data.id === memoryNodeId) - if (memoryNode) { - chatHistory = await replaceChatHistory(memoryNode, incomingInput, this.AppDataSource, databaseEntities, logger) + + // When {{chat_history}} is used in Prompt Template, fetch the chat conversations from memory + for (const endingNode of endingNodes) { + const endingNodeData = endingNode.data + if (!endingNodeData.inputs?.memory) continue + if ( + endingNodeData.inputs?.memory && + !incomingInput.history && + (incomingInput.chatId || incomingInput.overrideConfig?.sessionId) + ) { + const memoryNodeId = endingNodeData.inputs?.memory.split('.')[0].replace('{{', '') + const memoryNode = nodes.find((node) => node.data.id === memoryNodeId) + if (memoryNode) { + chatHistory = await replaceChatHistory(memoryNode, incomingInput, this.AppDataSource, databaseEntities, logger) + } } } - /*** Get Starting Nodes with Non-Directed Graph ***/ - const constructedObj = constructGraphs(nodes, edges, true) + /*** Get Starting Nodes with Reversed Graph ***/ + const constructedObj = constructGraphs(nodes, edges, { isReversed: true }) const nonDirectedGraph = constructedObj.graph - const { startingNodeIds, depthQueue } = getStartingNodes(nonDirectedGraph, endingNodeId) + let startingNodeIds: string[] = [] + let depthQueue: IDepthQueue = {} + for (const endingNodeId of endingNodeIds) { + const res = getStartingNodes(nonDirectedGraph, endingNodeId) + startingNodeIds.push(...res.startingNodeIds) + depthQueue = Object.assign(depthQueue, res.depthQueue) + } + startingNodeIds = [...new Set(startingNodeIds)] + const startingNodes = nodes.filter((nd) => startingNodeIds.includes(nd.id)) logger.debug(`[server]: Start building chatflow ${chatflowid}`) @@ -1529,6 +1575,7 @@ export class App { const reactFlowNodes = await buildLangchain( startingNodeIds, nodes, + edges, graph, depthQueue, this.nodesPool.componentNodes, @@ -1542,13 +1589,18 @@ export class App { isUpsert, incomingInput.stopNodeId ) + + // If request is upsert, stop here if (isUpsert) { this.chatflowPool.add(chatflowid, undefined, startingNodes, incomingInput?.overrideConfig) return res.status(201).send('Successfully Upserted') } - const nodeToExecute = reactFlowNodes.find((node: IReactFlowNode) => node.id === endingNodeId) - if (!nodeToExecute) return res.status(404).send(`Node ${endingNodeId} not found`) + const nodeToExecute = + endingNodeIds.length === 1 + ? reactFlowNodes.find((node: IReactFlowNode) => endingNodeIds[0] === node.id) + : reactFlowNodes[reactFlowNodes.length - 1] + if (!nodeToExecute) return res.status(404).send(`Node not found`) if (incomingInput.overrideConfig) { nodeToExecute.data = replaceInputsWithConfig(nodeToExecute.data, incomingInput.overrideConfig) diff --git a/packages/server/src/utils/index.ts b/packages/server/src/utils/index.ts index d3575388..213b3e8c 100644 --- a/packages/server/src/utils/index.ts +++ b/packages/server/src/utils/index.ts @@ -97,9 +97,13 @@ export const getNodeModulesPackagePath = (packageName: string): string => { * Construct graph and node dependencies score * @param {IReactFlowNode[]} reactFlowNodes * @param {IReactFlowEdge[]} reactFlowEdges - * @param {boolean} isNondirected + * @param {{ isNonDirected?: boolean, isReversed?: boolean }} options */ -export const constructGraphs = (reactFlowNodes: IReactFlowNode[], reactFlowEdges: IReactFlowEdge[], isNondirected = false) => { +export const constructGraphs = ( + reactFlowNodes: IReactFlowNode[], + reactFlowEdges: IReactFlowEdge[], + options?: { isNonDirected?: boolean; isReversed?: boolean } +) => { const nodeDependencies = {} as INodeDependencies const graph = {} as INodeDirectedGraph @@ -109,6 +113,23 @@ export const constructGraphs = (reactFlowNodes: IReactFlowNode[], reactFlowEdges graph[nodeId] = [] } + if (options && options.isReversed) { + for (let i = 0; i < reactFlowEdges.length; i += 1) { + const source = reactFlowEdges[i].source + const target = reactFlowEdges[i].target + + if (Object.prototype.hasOwnProperty.call(graph, target)) { + graph[target].push(source) + } else { + graph[target] = [source] + } + + nodeDependencies[target] += 1 + } + + return { graph, nodeDependencies } + } + for (let i = 0; i < reactFlowEdges.length; i += 1) { const source = reactFlowEdges[i].source const target = reactFlowEdges[i].target @@ -119,7 +140,7 @@ export const constructGraphs = (reactFlowNodes: IReactFlowNode[], reactFlowEdges graph[source] = [target] } - if (isNondirected) { + if (options && options.isNonDirected) { if (Object.prototype.hasOwnProperty.call(graph, target)) { graph[target].push(source) } else { @@ -181,21 +202,49 @@ export const getStartingNodes = (graph: INodeDirectedGraph, endNodeId: string) = return { startingNodeIds, depthQueue: depthQueueReversed } } +/** + * Get all connected nodes from startnode + * @param {INodeDependencies} graph + * @param {string} startNodeId + */ +export const getAllConnectedNodes = (graph: INodeDirectedGraph, startNodeId: string) => { + const visited = new Set() + const queue: Array<[string]> = [[startNodeId]] + + while (queue.length > 0) { + const [currentNode] = queue.shift()! + + if (visited.has(currentNode)) { + continue + } + + visited.add(currentNode) + + for (const neighbor of graph[currentNode]) { + if (!visited.has(neighbor)) { + queue.push([neighbor]) + } + } + } + + return [...visited] +} + /** * Get ending node and check if flow is valid * @param {INodeDependencies} nodeDependencies * @param {INodeDirectedGraph} graph */ -export const getEndingNode = (nodeDependencies: INodeDependencies, graph: INodeDirectedGraph) => { - let endingNodeId = '' +export const getEndingNodes = (nodeDependencies: INodeDependencies, graph: INodeDirectedGraph) => { + const endingNodeIds: string[] = [] Object.keys(graph).forEach((nodeId) => { if (Object.keys(nodeDependencies).length === 1) { - endingNodeId = nodeId + endingNodeIds.push(nodeId) } else if (!graph[nodeId].length && nodeDependencies[nodeId] > 0) { - endingNodeId = nodeId + endingNodeIds.push(nodeId) } }) - return endingNodeId + return endingNodeIds } /** @@ -215,6 +264,7 @@ export const getEndingNode = (nodeDependencies: INodeDependencies, graph: INodeD export const buildLangchain = async ( startingNodeIds: string[], reactFlowNodes: IReactFlowNode[], + reactFlowEdges: IReactFlowEdge[], graph: INodeDirectedGraph, depthQueue: IDepthQueue, componentNodes: IComponentNodes, @@ -233,6 +283,8 @@ export const buildLangchain = async ( // Create a Queue and add our initial node in it const nodeQueue = [] as INodeQueue[] const exploredNode = {} as IExploredNode + const dynamicVariables = {} as Record + let ignoreNodeIds: string[] = [] // In the case of infinite loop, only max 3 loops will be executed const maxLoop = 3 @@ -269,20 +321,59 @@ export const buildLangchain = async ( appDataSource, databaseEntities, logger, - cachePool + cachePool, + dynamicVariables }) logger.debug(`[server]: Finished upserting ${reactFlowNode.data.label} (${reactFlowNode.data.id})`) break } else { logger.debug(`[server]: Initializing ${reactFlowNode.data.label} (${reactFlowNode.data.id})`) - flowNodes[nodeIndex].data.instance = await newNodeInstance.init(reactFlowNodeData, question, { + let outputResult = await newNodeInstance.init(reactFlowNodeData, question, { chatId, chatflowid, appDataSource, databaseEntities, logger, - cachePool + cachePool, + dynamicVariables }) + + // Save dynamic variables + if (reactFlowNode.data.name === 'setVariable') { + const dynamicVars = outputResult?.dynamicVariables ?? {} + + for (const variableKey in dynamicVars) { + dynamicVariables[variableKey] = dynamicVars[variableKey] + } + + outputResult = outputResult?.output + } + + // Determine which nodes to route next when it comes to ifElse + if (reactFlowNode.data.name === 'ifElseFunction' && typeof outputResult === 'object') { + let sourceHandle = '' + if (outputResult.type === true) { + sourceHandle = `${nodeId}-output-returnFalse-string|number|boolean|json|array` + } else if (outputResult.type === false) { + sourceHandle = `${nodeId}-output-returnTrue-string|number|boolean|json|array` + } + + const ifElseEdge = reactFlowEdges.find((edg) => edg.source === nodeId && edg.sourceHandle === sourceHandle) + if (ifElseEdge) { + const { graph } = constructGraphs( + reactFlowNodes, + reactFlowEdges.filter((edg) => !(edg.source === nodeId && edg.sourceHandle === sourceHandle)), + { isNonDirected: true } + ) + ignoreNodeIds.push(ifElseEdge.target, ...getAllConnectedNodes(graph, ifElseEdge.target)) + ignoreNodeIds = [...new Set(ignoreNodeIds)] + } + + outputResult = outputResult?.output + } + + flowNodes[nodeIndex].data.instance = outputResult + logger.debug(`[server]: Finished initializing ${reactFlowNode.data.label} (${reactFlowNode.data.id})`) } } catch (e: any) { @@ -290,7 +381,7 @@ export const buildLangchain = async ( throw new Error(e) } - const neighbourNodeIds = graph[nodeId] + let neighbourNodeIds = graph[nodeId] const nextDepth = depth + 1 // Find other nodes that are on the same depth level @@ -301,9 +392,11 @@ export const buildLangchain = async ( neighbourNodeIds.push(id) } + neighbourNodeIds = neighbourNodeIds.filter((neigh) => !ignoreNodeIds.includes(neigh)) + for (let i = 0; i < neighbourNodeIds.length; i += 1) { const neighNodeId = neighbourNodeIds[i] - + if (ignoreNodeIds.includes(neighNodeId)) continue // If nodeId has been seen, cycle detected if (Object.prototype.hasOwnProperty.call(exploredNode, neighNodeId)) { const { remainingLoop, lastSeenDepth } = exploredNode[neighNodeId] @@ -321,6 +414,12 @@ export const buildLangchain = async ( nodeQueue.push({ nodeId: neighNodeId, depth: nextDepth }) } } + + // Move end node to last + if (!neighbourNodeIds.length) { + const index = flowNodes.findIndex((nd) => nd.data.id === nodeId) + flowNodes.push(flowNodes.splice(index, 1)[0]) + } } return flowNodes } @@ -713,6 +812,7 @@ export const findAvailableConfigs = (reactFlowNodes: IReactFlowNode[], component /** * Check to see if flow valid for stream + * TODO: perform check from component level. i.e: set streaming on component, and check here * @param {IReactFlowNode[]} reactFlowNodes * @param {INodeData} endingNodeData * @returns {boolean} diff --git a/packages/ui/package.json b/packages/ui/package.json index 7a739978..3cacf752 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "flowise-ui", - "version": "1.4.3", + "version": "1.4.4", "license": "SEE LICENSE IN LICENSE.md", "homepage": "https://flowiseai.com", "author": { @@ -8,13 +8,20 @@ "email": "henryheng@flowiseai.com" }, "dependencies": { + "@codemirror/lang-javascript": "^6.2.1", + "@codemirror/lang-json": "^6.0.1", + "@codemirror/view": "^6.22.3", "@emotion/cache": "^11.4.0", "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", "@mui/icons-material": "^5.0.3", - "@mui/material": "^5.11.12", + "@mui/lab": "^5.0.0-alpha.156", + "@mui/material": "^5.15.0", "@mui/x-data-grid": "^6.8.0", "@tabler/icons": "^1.39.1", + "@uiw/codemirror-theme-sublime": "^4.21.21", + "@uiw/codemirror-theme-vscode": "^4.21.21", + "@uiw/react-codemirror": "^4.21.21", "clsx": "^1.1.1", "flowise-embed": "*", "flowise-embed-react": "*", @@ -26,7 +33,6 @@ "lodash": "^4.17.21", "moment": "^2.29.3", "notistack": "^2.0.4", - "prismjs": "^1.28.0", "prop-types": "^15.7.2", "react": "^18.2.0", "react-code-blocks": "^0.0.9-0", @@ -39,7 +45,6 @@ "react-redux": "^8.0.5", "react-router": "~6.3.0", "react-router-dom": "~6.3.0", - "react-simple-code-editor": "^0.11.2", "react-syntax-highlighter": "^15.5.0", "reactflow": "^11.5.6", "redux": "^4.0.5", diff --git a/packages/ui/src/api/nodes.js b/packages/ui/src/api/nodes.js index 7eb4c351..3b7eacc5 100644 --- a/packages/ui/src/api/nodes.js +++ b/packages/ui/src/api/nodes.js @@ -4,7 +4,10 @@ const getAllNodes = () => client.get('/nodes') const getSpecificNode = (name) => client.get(`/nodes/${name}`) +const executeCustomFunctionNode = (body) => client.post(`/node-custom-function`, body) + export default { getAllNodes, - getSpecificNode + getSpecificNode, + executeCustomFunctionNode } diff --git a/packages/ui/src/assets/images/langfuse.svg b/packages/ui/src/assets/images/langfuse.svg new file mode 100644 index 00000000..50b6bd74 --- /dev/null +++ b/packages/ui/src/assets/images/langfuse.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/ui/src/assets/images/lunary.svg b/packages/ui/src/assets/images/lunary.svg new file mode 100644 index 00000000..1528de5a --- /dev/null +++ b/packages/ui/src/assets/images/lunary.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/ui/src/ui-component/dialog/AnalyseFlowDialog.js b/packages/ui/src/ui-component/dialog/AnalyseFlowDialog.js index dd6bb8ab..fe753957 100644 --- a/packages/ui/src/ui-component/dialog/AnalyseFlowDialog.js +++ b/packages/ui/src/ui-component/dialog/AnalyseFlowDialog.js @@ -30,8 +30,8 @@ import { SwitchInput } from 'ui-component/switch/Switch' import { Input } from 'ui-component/input/Input' import { StyledButton } from 'ui-component/button/StyledButton' import langsmithPNG from 'assets/images/langchain.png' -import langfusePNG from 'assets/images/langfuse.png' -import llmonitorPNG from 'assets/images/llmonitor.png' +import langfuseSVG from 'assets/images/langfuse.svg' +import llmonitorSVG from 'assets/images/lunary.svg' // store import { HIDE_CANVAS_DIALOG, SHOW_CANVAS_DIALOG } from 'store/actions' @@ -72,7 +72,7 @@ const analyticProviders = [ { label: 'LangFuse', name: 'langFuse', - icon: langfusePNG, + icon: langfuseSVG, url: 'https://langfuse.com', inputs: [ { @@ -99,7 +99,7 @@ const analyticProviders = [ { label: 'LLMonitor', name: 'llmonitor', - icon: llmonitorPNG, + icon: llmonitorSVG, url: 'https://llmonitor.com', inputs: [ { diff --git a/packages/ui/src/ui-component/dialog/ExpandTextDialog.js b/packages/ui/src/ui-component/dialog/ExpandTextDialog.js index 2a4ec4f5..0ef70e29 100644 --- a/packages/ui/src/ui-component/dialog/ExpandTextDialog.js +++ b/packages/ui/src/ui-component/dialog/ExpandTextDialog.js @@ -2,14 +2,24 @@ import { createPortal } from 'react-dom' import { useState, useEffect } from 'react' import { useSelector, useDispatch } from 'react-redux' import PropTypes from 'prop-types' +import PerfectScrollbar from 'react-perfect-scrollbar' + +// MUI import { Button, Dialog, DialogActions, DialogContent, Typography } from '@mui/material' import { useTheme } from '@mui/material/styles' -import PerfectScrollbar from 'react-perfect-scrollbar' +import { LoadingButton } from '@mui/lab' + +// Project Import import { StyledButton } from 'ui-component/button/StyledButton' -import { DarkCodeEditor } from 'ui-component/editor/DarkCodeEditor' -import { LightCodeEditor } from 'ui-component/editor/LightCodeEditor' +import { CodeEditor } from 'ui-component/editor/CodeEditor' + +// Store import { HIDE_CANVAS_DIALOG, SHOW_CANVAS_DIALOG } from 'store/actions' +// API +import nodesApi from 'api/nodes' +import useApi from 'hooks/useApi' + import './ExpandTextDialog.css' const ExpandTextDialog = ({ show, dialogProps, onCancel, onConfirm }) => { @@ -18,18 +28,30 @@ const ExpandTextDialog = ({ show, dialogProps, onCancel, onConfirm }) => { const theme = useTheme() const dispatch = useDispatch() const customization = useSelector((state) => state.customization) - const languageType = 'json' const [inputValue, setInputValue] = useState('') const [inputParam, setInputParam] = useState(null) + const [languageType, setLanguageType] = useState('json') + const [loading, setLoading] = useState(false) + const [codeExecutedResult, setCodeExecutedResult] = useState('') + + const executeCustomFunctionNodeApi = useApi(nodesApi.executeCustomFunctionNode) useEffect(() => { if (dialogProps.value) setInputValue(dialogProps.value) - if (dialogProps.inputParam) setInputParam(dialogProps.inputParam) + if (dialogProps.inputParam) { + setInputParam(dialogProps.inputParam) + if (dialogProps.inputParam.type === 'code') { + setLanguageType('js') + } + } return () => { setInputValue('') + setLoading(false) setInputParam(null) + setLanguageType('json') + setCodeExecutedResult('') } }, [dialogProps]) @@ -39,11 +61,31 @@ const ExpandTextDialog = ({ show, dialogProps, onCancel, onConfirm }) => { return () => dispatch({ type: HIDE_CANVAS_DIALOG }) }, [show, dispatch]) + useEffect(() => { + setLoading(executeCustomFunctionNodeApi.loading) + }, [executeCustomFunctionNodeApi.loading]) + + useEffect(() => { + if (executeCustomFunctionNodeApi.data) { + setCodeExecutedResult(executeCustomFunctionNodeApi.data) + } + }, [executeCustomFunctionNodeApi.data]) + + useEffect(() => { + if (executeCustomFunctionNodeApi.error) { + if (typeof executeCustomFunctionNodeApi.error === 'object' && executeCustomFunctionNodeApi.error?.response?.data) { + setCodeExecutedResult(executeCustomFunctionNodeApi.error?.response?.data) + } else if (typeof executeCustomFunctionNodeApi.error === 'string') { + setCodeExecutedResult(executeCustomFunctionNodeApi.error) + } + } + }, [executeCustomFunctionNodeApi.error]) + const component = show ? (
- {inputParam && inputParam.type === 'string' && ( + {inputParam && (inputParam.type === 'string' || inputParam.type === 'code') && (
{inputParam.label} @@ -54,42 +96,66 @@ const ExpandTextDialog = ({ show, dialogProps, onCancel, onConfirm }) => { borderColor: theme.palette.grey['500'], borderRadius: '12px', height: '100%', - maxHeight: 'calc(100vh - 220px)', + maxHeight: languageType === 'js' ? 'calc(100vh - 250px)' : 'calc(100vh - 220px)', overflowX: 'hidden', backgroundColor: 'white' }} > - {customization.isDarkMode ? ( - setInputValue(code)} - placeholder={inputParam.placeholder} - type={languageType} - style={{ - fontSize: '0.875rem', - minHeight: 'calc(100vh - 220px)', - width: '100%' - }} - /> - ) : ( - setInputValue(code)} - placeholder={inputParam.placeholder} - type={languageType} - style={{ - fontSize: '0.875rem', - minHeight: 'calc(100vh - 220px)', - width: '100%' - }} - /> - )} + setInputValue(code)} + />
)}
+ {languageType === 'js' && ( + { + setLoading(true) + executeCustomFunctionNodeApi.request({ javascriptFunction: inputValue }) + }} + > + Execute + + )} + {codeExecutedResult && ( +
+ +
+ )} diff --git a/packages/ui/src/ui-component/editor/CodeEditor.js b/packages/ui/src/ui-component/editor/CodeEditor.js new file mode 100644 index 00000000..120e19a0 --- /dev/null +++ b/packages/ui/src/ui-component/editor/CodeEditor.js @@ -0,0 +1,48 @@ +import PropTypes from 'prop-types' +import CodeMirror from '@uiw/react-codemirror' +import { javascript } from '@codemirror/lang-javascript' +import { json } from '@codemirror/lang-json' +import { vscodeDark } from '@uiw/codemirror-theme-vscode' +import { sublime } from '@uiw/codemirror-theme-sublime' +import { EditorView } from '@codemirror/view' + +export const CodeEditor = ({ value, height, theme, lang, placeholder, disabled = false, basicSetup = {}, onValueChange }) => { + const customStyle = EditorView.baseTheme({ + '&': { + color: '#191b1f', + padding: '10px' + }, + '.cm-placeholder': { + color: 'rgba(120, 120, 120, 0.5)' + } + }) + + return ( + + ) +} + +CodeEditor.propTypes = { + value: PropTypes.string, + height: PropTypes.string, + theme: PropTypes.string, + lang: PropTypes.string, + placeholder: PropTypes.string, + disabled: PropTypes.bool, + basicSetup: PropTypes.object, + onValueChange: PropTypes.func +} diff --git a/packages/ui/src/ui-component/editor/DarkCodeEditor.js b/packages/ui/src/ui-component/editor/DarkCodeEditor.js deleted file mode 100644 index bf0719dd..00000000 --- a/packages/ui/src/ui-component/editor/DarkCodeEditor.js +++ /dev/null @@ -1,43 +0,0 @@ -import Editor from 'react-simple-code-editor' -import { highlight, languages } from 'prismjs/components/prism-core' -import 'prismjs/components/prism-clike' -import 'prismjs/components/prism-javascript' -import 'prismjs/components/prism-json' -import 'prismjs/components/prism-markup' -import './prism-dark.css' -import PropTypes from 'prop-types' -import { useTheme } from '@mui/material/styles' - -export const DarkCodeEditor = ({ value, placeholder, disabled = false, type, style, onValueChange, onMouseUp, onBlur }) => { - const theme = useTheme() - - return ( - highlight(code, type === 'json' ? languages.json : languages.js)} - padding={10} - onValueChange={onValueChange} - onMouseUp={onMouseUp} - onBlur={onBlur} - tabSize={4} - style={{ - ...style, - background: theme.palette.codeEditor.main - }} - textareaClassName='editor__textarea' - /> - ) -} - -DarkCodeEditor.propTypes = { - value: PropTypes.string, - placeholder: PropTypes.string, - disabled: PropTypes.bool, - type: PropTypes.string, - style: PropTypes.object, - onValueChange: PropTypes.func, - onMouseUp: PropTypes.func, - onBlur: PropTypes.func -} diff --git a/packages/ui/src/ui-component/editor/LightCodeEditor.js b/packages/ui/src/ui-component/editor/LightCodeEditor.js deleted file mode 100644 index 14dcbf29..00000000 --- a/packages/ui/src/ui-component/editor/LightCodeEditor.js +++ /dev/null @@ -1,43 +0,0 @@ -import Editor from 'react-simple-code-editor' -import { highlight, languages } from 'prismjs/components/prism-core' -import 'prismjs/components/prism-clike' -import 'prismjs/components/prism-javascript' -import 'prismjs/components/prism-json' -import 'prismjs/components/prism-markup' -import './prism-light.css' -import PropTypes from 'prop-types' -import { useTheme } from '@mui/material/styles' - -export const LightCodeEditor = ({ value, placeholder, disabled = false, type, style, onValueChange, onMouseUp, onBlur }) => { - const theme = useTheme() - - return ( - highlight(code, type === 'json' ? languages.json : languages.js)} - padding={10} - onValueChange={onValueChange} - onMouseUp={onMouseUp} - onBlur={onBlur} - tabSize={4} - style={{ - ...style, - background: theme.palette.card.main - }} - textareaClassName='editor__textarea' - /> - ) -} - -LightCodeEditor.propTypes = { - value: PropTypes.string, - placeholder: PropTypes.string, - disabled: PropTypes.bool, - type: PropTypes.string, - style: PropTypes.object, - onValueChange: PropTypes.func, - onMouseUp: PropTypes.func, - onBlur: PropTypes.func -} diff --git a/packages/ui/src/ui-component/editor/prism-dark.css b/packages/ui/src/ui-component/editor/prism-dark.css deleted file mode 100644 index c4bfb413..00000000 --- a/packages/ui/src/ui-component/editor/prism-dark.css +++ /dev/null @@ -1,275 +0,0 @@ -pre[class*='language-'], -code[class*='language-'] { - color: #d4d4d4; - font-size: 13px; - text-shadow: none; - font-family: Menlo, Monaco, Consolas, 'Andale Mono', 'Ubuntu Mono', 'Courier New', monospace; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - line-height: 1.5; - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -pre[class*='language-']::selection, -code[class*='language-']::selection, -pre[class*='language-'] *::selection, -code[class*='language-'] *::selection { - text-shadow: none; - background: #264f78; -} - -@media print { - pre[class*='language-'], - code[class*='language-'] { - text-shadow: none; - } -} - -pre[class*='language-'] { - padding: 1em; - margin: 0.5em 0; - overflow: auto; - background: #1e1e1e; -} - -:not(pre) > code[class*='language-'] { - padding: 0.1em 0.3em; - border-radius: 0.3em; - color: #db4c69; - background: #1e1e1e; -} -/********************************************************* -* Tokens -*/ -.namespace { - opacity: 0.7; -} - -.token.doctype .token.doctype-tag { - color: #569cd6; -} - -.token.doctype .token.name { - color: #9cdcfe; -} - -.token.comment, -.token.prolog { - color: #6a9955; -} - -.token.punctuation, -.language-html .language-css .token.punctuation, -.language-html .language-javascript .token.punctuation { - color: #d4d4d4; -} - -.token.property, -.token.tag, -.token.boolean, -.token.number, -.token.constant, -.token.symbol, -.token.inserted, -.token.unit { - color: #b5cea8; -} - -.token.selector, -.token.attr-name, -.token.string, -.token.char, -.token.builtin, -.token.deleted { - color: #ce9178; -} - -.language-css .token.string.url { - text-decoration: underline; -} - -.token.operator, -.token.entity { - color: #d4d4d4; -} - -.token.operator.arrow { - color: #569cd6; -} - -.token.atrule { - color: #ce9178; -} - -.token.atrule .token.rule { - color: #c586c0; -} - -.token.atrule .token.url { - color: #9cdcfe; -} - -.token.atrule .token.url .token.function { - color: #dcdcaa; -} - -.token.atrule .token.url .token.punctuation { - color: #d4d4d4; -} - -.token.keyword { - color: #569cd6; -} - -.token.keyword.module, -.token.keyword.control-flow { - color: #c586c0; -} - -.token.function, -.token.function .token.maybe-class-name { - color: #dcdcaa; -} - -.token.regex { - color: #d16969; -} - -.token.important { - color: #569cd6; -} - -.token.italic { - font-style: italic; -} - -.token.constant { - color: #9cdcfe; -} - -.token.class-name, -.token.maybe-class-name { - color: #4ec9b0; -} - -.token.console { - color: #9cdcfe; -} - -.token.parameter { - color: #9cdcfe; -} - -.token.interpolation { - color: #9cdcfe; -} - -.token.punctuation.interpolation-punctuation { - color: #569cd6; -} - -.token.boolean { - color: #569cd6; -} - -.token.property, -.token.variable, -.token.imports .token.maybe-class-name, -.token.exports .token.maybe-class-name { - color: #9cdcfe; -} - -.token.selector { - color: #d7ba7d; -} - -.token.escape { - color: #d7ba7d; -} - -.token.tag { - color: #569cd6; -} - -.token.tag .token.punctuation { - color: #808080; -} - -.token.cdata { - color: #808080; -} - -.token.attr-name { - color: #9cdcfe; -} - -.token.attr-value, -.token.attr-value .token.punctuation { - color: #ce9178; -} - -.token.attr-value .token.punctuation.attr-equals { - color: #d4d4d4; -} - -.token.entity { - color: #569cd6; -} - -.token.namespace { - color: #4ec9b0; -} -/********************************************************* -* Language Specific -*/ - -pre[class*='language-javascript'], -code[class*='language-javascript'], -pre[class*='language-jsx'], -code[class*='language-jsx'], -pre[class*='language-typescript'], -code[class*='language-typescript'], -pre[class*='language-tsx'], -code[class*='language-tsx'] { - color: #9cdcfe; -} - -pre[class*='language-css'], -code[class*='language-css'] { - color: #ce9178; -} - -pre[class*='language-html'], -code[class*='language-html'] { - color: #d4d4d4; -} - -.language-regex .token.anchor { - color: #dcdcaa; -} - -.language-html .token.punctuation { - color: #808080; -} -/********************************************************* -* Line highlighting -*/ -pre[class*='language-'] > code[class*='language-'] { - position: relative; - z-index: 1; -} - -.line-highlight.line-highlight { - background: #f7ebc6; - box-shadow: inset 5px 0 0 #f7d87c; - z-index: 0; -} diff --git a/packages/ui/src/ui-component/editor/prism-light.css b/packages/ui/src/ui-component/editor/prism-light.css deleted file mode 100644 index 95d6d6eb..00000000 --- a/packages/ui/src/ui-component/editor/prism-light.css +++ /dev/null @@ -1,207 +0,0 @@ -code[class*='language-'], -pre[class*='language-'] { - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - color: #90a4ae; - background: #fafafa; - font-family: Roboto Mono, monospace; - font-size: 1em; - line-height: 1.5em; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -code[class*='language-']::-moz-selection, -pre[class*='language-']::-moz-selection, -code[class*='language-'] ::-moz-selection, -pre[class*='language-'] ::-moz-selection { - background: #cceae7; - color: #263238; -} - -code[class*='language-']::selection, -pre[class*='language-']::selection, -code[class*='language-'] ::selection, -pre[class*='language-'] ::selection { - background: #cceae7; - color: #263238; -} - -:not(pre) > code[class*='language-'] { - white-space: normal; - border-radius: 0.2em; - padding: 0.1em; -} - -pre[class*='language-'] { - overflow: auto; - position: relative; - margin: 0.5em 0; - padding: 1.25em 1em; -} - -.language-css > code, -.language-sass > code, -.language-scss > code { - color: #f76d47; -} - -[class*='language-'] .namespace { - opacity: 0.7; -} - -.token.atrule { - color: #7c4dff; -} - -.token.attr-name { - color: #39adb5; -} - -.token.attr-value { - color: #f6a434; -} - -.token.attribute { - color: #f6a434; -} - -.token.boolean { - color: #7c4dff; -} - -.token.builtin { - color: #39adb5; -} - -.token.cdata { - color: #39adb5; -} - -.token.char { - color: #39adb5; -} - -.token.class { - color: #39adb5; -} - -.token.class-name { - color: #6182b8; -} - -.token.comment { - color: #aabfc9; -} - -.token.constant { - color: #7c4dff; -} - -.token.deleted { - color: #e53935; -} - -.token.doctype { - color: #aabfc9; -} - -.token.entity { - color: #e53935; -} - -.token.function { - color: #7c4dff; -} - -.token.hexcode { - color: #f76d47; -} - -.token.id { - color: #7c4dff; - font-weight: bold; -} - -.token.important { - color: #7c4dff; - font-weight: bold; -} - -.token.inserted { - color: #39adb5; -} - -.token.keyword { - color: #7c4dff; -} - -.token.number { - color: #f76d47; -} - -.token.operator { - color: #39adb5; -} - -.token.prolog { - color: #aabfc9; -} - -.token.property { - color: #39adb5; -} - -.token.pseudo-class { - color: #f6a434; -} - -.token.pseudo-element { - color: #f6a434; -} - -.token.punctuation { - color: #39adb5; -} - -.token.regex { - color: #6182b8; -} - -.token.selector { - color: #e53935; -} - -.token.string { - color: #f6a434; -} - -.token.symbol { - color: #7c4dff; -} - -.token.tag { - color: #e53935; -} - -.token.unit { - color: #f76d47; -} - -.token.url { - color: #e53935; -} - -.token.variable { - color: #e53935; -} diff --git a/packages/ui/src/ui-component/input/Input.js b/packages/ui/src/ui-component/input/Input.js index 6993847b..3e575938 100644 --- a/packages/ui/src/ui-component/input/Input.js +++ b/packages/ui/src/ui-component/input/Input.js @@ -1,23 +1,10 @@ import { useState, useEffect, useRef } from 'react' import PropTypes from 'prop-types' import { FormControl, OutlinedInput, Popover } from '@mui/material' -import ExpandTextDialog from 'ui-component/dialog/ExpandTextDialog' import SelectVariable from 'ui-component/json/SelectVariable' import { getAvailableNodesForVariable } from 'utils/genericHelper' -export const Input = ({ - inputParam, - value, - nodes, - edges, - nodeId, - onChange, - disabled = false, - showDialog, - dialogProps, - onDialogCancel, - onDialogConfirm -}) => { +export const Input = ({ inputParam, value, nodes, edges, nodeId, onChange, disabled = false }) => { const [myValue, setMyValue] = useState(value ?? '') const [anchorEl, setAnchorEl] = useState(null) const [availableNodesForVariable, setAvailableNodesForVariable] = useState([]) @@ -86,17 +73,6 @@ export const Input = ({ }} /> - {showDialog && ( - { - setMyValue(newValue) - onDialogConfirm(newValue, inputParamName) - }} - > - )}
{inputParam?.acceptVariable && ( diff --git a/packages/ui/src/utils/genericHelper.js b/packages/ui/src/utils/genericHelper.js index b34d6c72..57ba8892 100644 --- a/packages/ui/src/utils/genericHelper.js +++ b/packages/ui/src/utils/genericHelper.js @@ -182,15 +182,6 @@ export const initNode = (nodeData, newNodeId) => { return nodeData } -export const getEdgeLabelName = (source) => { - const sourceSplit = source.split('-') - if (sourceSplit.length && sourceSplit[0].includes('ifElse')) { - const outputAnchorsIndex = sourceSplit[sourceSplit.length - 1] - return outputAnchorsIndex === '0' ? 'true' : 'false' - } - return '' -} - export const isValidConnection = (connection, reactFlowInstance) => { const sourceHandle = connection.sourceHandle const targetHandle = connection.targetHandle diff --git a/packages/ui/src/views/canvas/NodeInputHandler.js b/packages/ui/src/views/canvas/NodeInputHandler.js index 892a6273..33e99736 100644 --- a/packages/ui/src/views/canvas/NodeInputHandler.js +++ b/packages/ui/src/views/canvas/NodeInputHandler.js @@ -22,8 +22,11 @@ import { flowContext } from 'store/context/ReactFlowContext' import { isValidConnection } from 'utils/genericHelper' import { JsonEditorInput } from 'ui-component/json/JsonEditor' import { TooltipWithParser } from 'ui-component/tooltip/TooltipWithParser' +import { CodeEditor } from 'ui-component/editor/CodeEditor' + import ToolDialog from 'views/tools/ToolDialog' import AssistantDialog from 'views/assistants/AssistantDialog' +import ExpandTextDialog from 'ui-component/dialog/ExpandTextDialog' import FormatPromptValuesDialog from 'ui-component/dialog/FormatPromptValuesDialog' import CredentialInputHandler from './CredentialInputHandler' @@ -83,7 +86,7 @@ const NodeInputHandler = ({ inputAnchor, inputParam, data, disabled = false, isA } } } - const onFormatPromptValuesClicked = (value, inputParam) => { + const onEditJSONClicked = (value, inputParam) => { // Preset values if the field is format prompt values let inputValue = value if (inputParam.name === 'promptValues' && !value) { @@ -255,7 +258,7 @@ const NodeInputHandler = ({ inputAnchor, inputParam, data, disabled = false, isA {inputParam.description && }
- {inputParam.type === 'string' && inputParam.rows && ( + {((inputParam.type === 'string' && inputParam.rows) || inputParam.type === 'code') && ( (data.inputs[inputParam.name] = newValue)} /> )} + {inputParam.type === 'code' && ( + <> +
+
+ (data.inputs[inputParam.name] = code)} + basicSetup={{ highlightActiveLine: false, highlightActiveLineGutter: false }} + /> +
+ + )} {(inputParam.type === 'string' || inputParam.type === 'password' || inputParam.type === 'number') && ( setShowExpandDialog(false)} - onDialogConfirm={(newValue, inputParamName) => onExpandDialogSave(newValue, inputParamName)} /> )} {inputParam.type === 'json' && ( @@ -353,11 +369,12 @@ const NodeInputHandler = ({ inputAnchor, inputParam, data, disabled = false, isA {inputParam?.acceptVariable && ( <> setAsyncOptionEditDialog('')} onConfirm={onConfirmAsyncOption} > + setShowExpandDialog(false)} + onConfirm={(newValue, inputParamName) => onExpandDialogSave(newValue, inputParamName)} + > ) } diff --git a/packages/ui/src/views/canvas/NodeOutputHandler.js b/packages/ui/src/views/canvas/NodeOutputHandler.js index c5fc1345..3970ef9d 100644 --- a/packages/ui/src/views/canvas/NodeOutputHandler.js +++ b/packages/ui/src/views/canvas/NodeOutputHandler.js @@ -73,42 +73,104 @@ const NodeOutputHandler = ({ outputAnchor, data, disabled = false }) => { )} - {outputAnchor.type === 'options' && outputAnchor.options && outputAnchor.options.length > 0 && ( - <> - opt.name === data.outputs?.[outputAnchor.name])?.type ?? outputAnchor.type - } - > - opt.name === data.outputs?.[outputAnchor.name])?.id ?? ''} - isValidConnection={(connection) => isValidConnection(connection, reactFlowInstance)} - style={{ - height: 10, - width: 10, - backgroundColor: data.selected ? theme.palette.primary.main : theme.palette.text.secondary, - top: position - }} - /> - - - { - setDropdownValue(newValue) - data.outputs[outputAnchor.name] = newValue - }} - value={data.outputs[outputAnchor.name] ?? outputAnchor.default ?? 'choose an option'} - /> - - + {data.name === 'ifElseFunction' && outputAnchor.type === 'options' && outputAnchor.options && ( +
+
+ opt.name === data.outputs?.[outputAnchor.name])?.type ?? + outputAnchor.type + } + > + opt.name === 'returnTrue')?.id ?? ''} + id={outputAnchor.options.find((opt) => opt.name === 'returnTrue')?.id ?? ''} + isValidConnection={(connection) => isValidConnection(connection, reactFlowInstance)} + style={{ + height: 10, + width: 10, + backgroundColor: data.selected ? theme.palette.primary.main : theme.palette.text.secondary, + top: position - 25 + }} + /> + +
+ + True + +
+
+ opt.name === data.outputs?.[outputAnchor.name])?.type ?? + outputAnchor.type + } + > + opt.name === 'returnFalse')?.id ?? ''} + id={outputAnchor.options.find((opt) => opt.name === 'returnFalse')?.id ?? ''} + isValidConnection={(connection) => isValidConnection(connection, reactFlowInstance)} + style={{ + height: 10, + width: 10, + backgroundColor: data.selected ? theme.palette.primary.main : theme.palette.text.secondary, + top: position + 25 + }} + /> + +
+ + False + +
+
)} + {data.name !== 'ifElseFunction' && + outputAnchor.type === 'options' && + outputAnchor.options && + outputAnchor.options.length > 0 && ( + <> + opt.name === data.outputs?.[outputAnchor.name])?.type ?? + outputAnchor.type + } + > + opt.name === data.outputs?.[outputAnchor.name])?.id ?? ''} + isValidConnection={(connection) => isValidConnection(connection, reactFlowInstance)} + style={{ + height: 10, + width: 10, + backgroundColor: data.selected ? theme.palette.primary.main : theme.palette.text.secondary, + top: position + }} + /> + + + { + setDropdownValue(newValue) + data.outputs[outputAnchor.name] = newValue + }} + value={data.outputs[outputAnchor.name] ?? outputAnchor.default ?? 'choose an option'} + /> + + + )} ) } diff --git a/packages/ui/src/views/canvas/index.js b/packages/ui/src/views/canvas/index.js index 08698398..9aa53cc6 100644 --- a/packages/ui/src/views/canvas/index.js +++ b/packages/ui/src/views/canvas/index.js @@ -40,7 +40,7 @@ import useConfirm from 'hooks/useConfirm' import { IconX } from '@tabler/icons' // utils -import { getUniqueNodeId, initNode, getEdgeLabelName, rearrangeToolsOrdering, getUpsertDetails } from 'utils/genericHelper' +import { getUniqueNodeId, initNode, rearrangeToolsOrdering, getUpsertDetails } from 'utils/genericHelper' import useNotifier from 'utils/useNotifier' // const @@ -100,8 +100,7 @@ const Canvas = () => { const newEdge = { ...params, type: 'buttonedge', - id: `${params.source}-${params.sourceHandle}-${params.target}-${params.targetHandle}`, - data: { label: getEdgeLabelName(params.sourceHandle) } + id: `${params.source}-${params.sourceHandle}-${params.target}-${params.targetHandle}` } const targetNodeId = params.targetHandle.split('-')[0] diff --git a/packages/ui/src/views/tools/ToolDialog.js b/packages/ui/src/views/tools/ToolDialog.js index 398e9eb8..6272e05f 100644 --- a/packages/ui/src/views/tools/ToolDialog.js +++ b/packages/ui/src/views/tools/ToolDialog.js @@ -12,9 +12,7 @@ import { TooltipWithParser } from 'ui-component/tooltip/TooltipWithParser' import { GridActionsCellItem } from '@mui/x-data-grid' import DeleteIcon from '@mui/icons-material/Delete' import ConfirmDialog from 'ui-component/dialog/ConfirmDialog' -import { DarkCodeEditor } from 'ui-component/editor/DarkCodeEditor' -import { LightCodeEditor } from 'ui-component/editor/LightCodeEditor' -import { useTheme } from '@mui/material/styles' +import { CodeEditor } from 'ui-component/editor/CodeEditor' // Icons import { IconX, IconFileExport } from '@tabler/icons' @@ -56,7 +54,6 @@ try { const ToolDialog = ({ show, dialogProps, onUseTemplate, onCancel, onConfirm }) => { const portalElement = document.getElementById('portal') - const theme = useTheme() const customization = useSelector((state) => state.customization) const dispatch = useDispatch() @@ -490,32 +487,14 @@ const ToolDialog = ({ show, dialogProps, onUseTemplate, onCancel, onConfirm }) = See Example )} - {customization.isDarkMode ? ( - setToolFunc(code)} - style={{ - fontSize: '0.875rem', - minHeight: 'calc(100vh - 220px)', - width: '100%', - borderRadius: 5 - }} - /> - ) : ( - setToolFunc(code)} - style={{ - fontSize: '0.875rem', - minHeight: 'calc(100vh - 220px)', - width: '100%', - border: `1px solid ${theme.palette.grey[300]}`, - borderRadius: 5 - }} - /> - )} + setToolFunc(code)} + />