mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 07:01:04 +03:00
Feature/agentflow v2 (#4298)
* agent flow v2 * chat message background * conditon agent flow * add sticky note * update human input dynamic prompt * add HTTP node * add default tool icon * fix export duplicate agentflow v2 * add agentflow v2 marketplaces * refractor memoization, add iteration nodes * add agentflow v2 templates * add agentflow generator * add migration scripts for mysql, mariadb, posrgres and fix date filters for executions * update agentflow chat history config * fix get all flows error after deletion and rename * add previous nodes from parent node * update generator prompt * update run time state when using iteration nodes * prevent looping connection, prevent duplication of start node, add executeflow node, add nodes agentflow, chat history variable * update embed * convert form input to string * bump openai version * add react rewards * add prompt generator to prediction queue * add array schema to overrideconfig * UI touchup * update embedded chat version * fix node info dialog * update start node and loop default iteration * update UI fixes for agentflow v2 * fix async drop down * add export import to agentflowsv2, executions, fix UI bugs * add default empty object to flowlisttable * add ability to share trace link publicly, allow MCP tool use for Agent and Assistant * add runtime message length to variable, display conditions on UI * fix array validation * add ability to add knowledge from vector store and embeddings for agent * add agent tool require human input * add ephemeral memory to start node * update agent flow node to show vs and embeddings icons * feat: add import chat data functionality for AgentFlowV2 * feat: set chatMessage.executionId to null if not found in import JSON file or database * fix: MariaDB execution migration script to utf8mb4_unicode_520_ci --------- Co-authored-by: Ong Chung Yau <33013947+chungyau97@users.noreply.github.com> Co-authored-by: chungyau97 <chungyau97@gmail.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
[English](./README.md) | 中文
|
||||
|
||||

|
||||

|
||||
|
||||
拖放界面来构建自定义的 LLM 流程
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
English | [中文](./README-ZH.md)
|
||||
|
||||

|
||||

|
||||
|
||||
Drag & drop UI to build your customized LLM flow
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"description": "Customer support team consisting of Support Representative and Quality Assurance Specialist to handle support tickets",
|
||||
"framework": ["Langchain"],
|
||||
"usecases": ["Customer Support"],
|
||||
"usecases": ["Customer Support", "Hierarchical Agent Teams"],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "supervisor_0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"description": "Research leads and create personalized email drafts for sales team",
|
||||
"framework": ["Langchain"],
|
||||
"usecases": ["Leads"],
|
||||
"usecases": ["Leads", "Hierarchical Agent Teams"],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "supervisor_0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"description": "A team of portfolio manager, financial analyst, and risk manager working together to optimize an investment portfolio.",
|
||||
"framework": ["Langchain"],
|
||||
"usecases": ["Finance & Accounting"],
|
||||
"usecases": ["Finance & Accounting", "Hierarchical Agent Teams"],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "supervisor_0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"description": "Prompt engineering team working together to craft Worker Prompts for your AgentFlow.",
|
||||
"framework": ["Langchain"],
|
||||
"usecases": ["Engineering"],
|
||||
"usecases": ["Engineering", "Hierarchical Agent Teams"],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "supervisor_0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"description": "Software engineering team working together to build a feature, solve a problem, or complete a task.",
|
||||
"framework": ["Langchain"],
|
||||
"usecases": ["Engineering"],
|
||||
"usecases": ["Engineering", "Hierarchical Agent Teams"],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "supervisor_0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"description": "Text to SQL query process using team of 3 agents: SQL Expert, SQL Reviewer, and SQL Executor",
|
||||
"framework": ["Langchain"],
|
||||
"usecases": ["SQL"],
|
||||
"usecases": ["SQL", "Hierarchical Agent Teams"],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "supervisor_0",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,847 @@
|
||||
{
|
||||
"description": "An email reply HITL (human in the loop) agent that can proceed or refine the email with user input",
|
||||
"usecases": ["Human In Loop"],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "startAgentflow_0",
|
||||
"type": "agentFlow",
|
||||
"position": {
|
||||
"x": -212.0817769699585,
|
||||
"y": 95.2304753249555
|
||||
},
|
||||
"data": {
|
||||
"id": "startAgentflow_0",
|
||||
"label": "Start",
|
||||
"version": 1,
|
||||
"name": "startAgentflow",
|
||||
"type": "Start",
|
||||
"color": "#7EE787",
|
||||
"hideInput": true,
|
||||
"baseClasses": ["Start"],
|
||||
"category": "Agent Flows",
|
||||
"description": "Starting point of the agentflow",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Input Type",
|
||||
"name": "startInputType",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "Chat Input",
|
||||
"name": "chatInput",
|
||||
"description": "Start the conversation with chat input"
|
||||
},
|
||||
{
|
||||
"label": "Form Input",
|
||||
"name": "formInput",
|
||||
"description": "Start the workflow with form inputs"
|
||||
}
|
||||
],
|
||||
"default": "chatInput",
|
||||
"id": "startAgentflow_0-input-startInputType-options",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Form Title",
|
||||
"name": "formTitle",
|
||||
"type": "string",
|
||||
"placeholder": "Please Fill Out The Form",
|
||||
"show": {
|
||||
"startInputType": "formInput"
|
||||
},
|
||||
"id": "startAgentflow_0-input-formTitle-string",
|
||||
"display": false
|
||||
},
|
||||
{
|
||||
"label": "Form Description",
|
||||
"name": "formDescription",
|
||||
"type": "string",
|
||||
"placeholder": "Complete all fields below to continue",
|
||||
"show": {
|
||||
"startInputType": "formInput"
|
||||
},
|
||||
"id": "startAgentflow_0-input-formDescription-string",
|
||||
"display": false
|
||||
},
|
||||
{
|
||||
"label": "Form Input Types",
|
||||
"name": "formInputTypes",
|
||||
"description": "Specify the type of form input",
|
||||
"type": "array",
|
||||
"show": {
|
||||
"startInputType": "formInput"
|
||||
},
|
||||
"array": [
|
||||
{
|
||||
"label": "Type",
|
||||
"name": "type",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "String",
|
||||
"name": "string"
|
||||
},
|
||||
{
|
||||
"label": "Number",
|
||||
"name": "number"
|
||||
},
|
||||
{
|
||||
"label": "Boolean",
|
||||
"name": "boolean"
|
||||
},
|
||||
{
|
||||
"label": "Options",
|
||||
"name": "options"
|
||||
}
|
||||
],
|
||||
"default": "string"
|
||||
},
|
||||
{
|
||||
"label": "Label",
|
||||
"name": "label",
|
||||
"type": "string",
|
||||
"placeholder": "Label for the input"
|
||||
},
|
||||
{
|
||||
"label": "Variable Name",
|
||||
"name": "name",
|
||||
"type": "string",
|
||||
"placeholder": "Variable name for the input (must be camel case)",
|
||||
"description": "Variable name must be camel case. For example: firstName, lastName, etc."
|
||||
},
|
||||
{
|
||||
"label": "Add Options",
|
||||
"name": "addOptions",
|
||||
"type": "array",
|
||||
"show": {
|
||||
"formInputTypes[$index].type": "options"
|
||||
},
|
||||
"array": [
|
||||
{
|
||||
"label": "Option",
|
||||
"name": "option",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"id": "startAgentflow_0-input-formInputTypes-array",
|
||||
"display": false
|
||||
},
|
||||
{
|
||||
"label": "Ephemeral Memory",
|
||||
"name": "startEphemeralMemory",
|
||||
"type": "boolean",
|
||||
"description": "Start fresh for every execution without past chat history",
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"label": "Flow State",
|
||||
"name": "startState",
|
||||
"description": "Runtime state during the execution of the workflow",
|
||||
"type": "array",
|
||||
"optional": true,
|
||||
"array": [
|
||||
{
|
||||
"label": "Key",
|
||||
"name": "key",
|
||||
"type": "string",
|
||||
"placeholder": "Foo"
|
||||
},
|
||||
{
|
||||
"label": "Value",
|
||||
"name": "value",
|
||||
"type": "string",
|
||||
"placeholder": "Bar"
|
||||
}
|
||||
],
|
||||
"id": "startAgentflow_0-input-startState-array",
|
||||
"display": true
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"startInputType": "chatInput",
|
||||
"formTitle": "",
|
||||
"formDescription": "",
|
||||
"formInputTypes": "",
|
||||
"startState": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "startAgentflow_0-output-startAgentflow",
|
||||
"label": "Start",
|
||||
"name": "startAgentflow"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"width": 101,
|
||||
"height": 65,
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": -212.0817769699585,
|
||||
"y": 95.2304753249555
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"id": "agentAgentflow_0",
|
||||
"position": {
|
||||
"x": -62.25,
|
||||
"y": 76
|
||||
},
|
||||
"data": {
|
||||
"id": "agentAgentflow_0",
|
||||
"label": "Email Reply Agent",
|
||||
"version": 1,
|
||||
"name": "agentAgentflow",
|
||||
"type": "Agent",
|
||||
"color": "#4DD0E1",
|
||||
"baseClasses": ["Agent"],
|
||||
"category": "Agent Flows",
|
||||
"description": "Dynamically choose and utilize tools during runtime, enabling multi-step reasoning",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Model",
|
||||
"name": "agentModel",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listModels",
|
||||
"loadConfig": true,
|
||||
"id": "agentAgentflow_0-input-agentModel-asyncOptions",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Messages",
|
||||
"name": "agentMessages",
|
||||
"type": "array",
|
||||
"optional": true,
|
||||
"acceptVariable": true,
|
||||
"array": [
|
||||
{
|
||||
"label": "Role",
|
||||
"name": "role",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "System",
|
||||
"name": "system"
|
||||
},
|
||||
{
|
||||
"label": "Assistant",
|
||||
"name": "assistant"
|
||||
},
|
||||
{
|
||||
"label": "Developer",
|
||||
"name": "developer"
|
||||
},
|
||||
{
|
||||
"label": "User",
|
||||
"name": "user"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Content",
|
||||
"name": "content",
|
||||
"type": "string",
|
||||
"acceptVariable": true,
|
||||
"generateInstruction": true,
|
||||
"rows": 4
|
||||
}
|
||||
],
|
||||
"id": "agentAgentflow_0-input-agentMessages-array",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Tools",
|
||||
"name": "agentTools",
|
||||
"type": "array",
|
||||
"optional": true,
|
||||
"array": [
|
||||
{
|
||||
"label": "Tool",
|
||||
"name": "agentSelectedTool",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listTools",
|
||||
"loadConfig": true
|
||||
},
|
||||
{
|
||||
"label": "Require Human Input",
|
||||
"name": "agentSelectedToolRequiresHumanInput",
|
||||
"type": "boolean",
|
||||
"optional": true
|
||||
}
|
||||
],
|
||||
"id": "agentAgentflow_0-input-agentTools-array",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Knowledge (Document Stores)",
|
||||
"name": "agentKnowledgeDocumentStores",
|
||||
"type": "array",
|
||||
"description": "Give your agent context about different document sources. Document stores must be upserted in advance.",
|
||||
"array": [
|
||||
{
|
||||
"label": "Document Store",
|
||||
"name": "documentStore",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listStores"
|
||||
},
|
||||
{
|
||||
"label": "Describe Knowledge",
|
||||
"name": "docStoreDescription",
|
||||
"type": "string",
|
||||
"generateDocStoreDescription": true,
|
||||
"placeholder": "Describe what the knowledge base is about, this is useful for the AI to know when and how to search for correct information",
|
||||
"rows": 4
|
||||
},
|
||||
{
|
||||
"label": "Return Source Documents",
|
||||
"name": "returnSourceDocuments",
|
||||
"type": "boolean",
|
||||
"optional": true
|
||||
}
|
||||
],
|
||||
"optional": true,
|
||||
"id": "agentAgentflow_0-input-agentKnowledgeDocumentStores-array",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Knowledge (Vector Embeddings)",
|
||||
"name": "agentKnowledgeVSEmbeddings",
|
||||
"type": "array",
|
||||
"description": "Give your agent context about different document sources from existing vector stores and embeddings",
|
||||
"array": [
|
||||
{
|
||||
"label": "Vector Store",
|
||||
"name": "vectorStore",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listVectorStores",
|
||||
"loadConfig": true
|
||||
},
|
||||
{
|
||||
"label": "Embedding Model",
|
||||
"name": "embeddingModel",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listEmbeddings",
|
||||
"loadConfig": true
|
||||
},
|
||||
{
|
||||
"label": "Knowledge Name",
|
||||
"name": "knowledgeName",
|
||||
"type": "string",
|
||||
"placeholder": "A short name for the knowledge base, this is useful for the AI to know when and how to search for correct information"
|
||||
},
|
||||
{
|
||||
"label": "Describe Knowledge",
|
||||
"name": "knowledgeDescription",
|
||||
"type": "string",
|
||||
"placeholder": "Describe what the knowledge base is about, this is useful for the AI to know when and how to search for correct information",
|
||||
"rows": 4
|
||||
},
|
||||
{
|
||||
"label": "Return Source Documents",
|
||||
"name": "returnSourceDocuments",
|
||||
"type": "boolean",
|
||||
"optional": true
|
||||
}
|
||||
],
|
||||
"optional": true,
|
||||
"id": "agentAgentflow_0-input-agentKnowledgeVSEmbeddings-array",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Enable Memory",
|
||||
"name": "agentEnableMemory",
|
||||
"type": "boolean",
|
||||
"description": "Enable memory for the conversation thread",
|
||||
"default": true,
|
||||
"optional": true,
|
||||
"id": "agentAgentflow_0-input-agentEnableMemory-boolean",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Memory Type",
|
||||
"name": "agentMemoryType",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "All Messages",
|
||||
"name": "allMessages",
|
||||
"description": "Retrieve all messages from the conversation"
|
||||
},
|
||||
{
|
||||
"label": "Window Size",
|
||||
"name": "windowSize",
|
||||
"description": "Uses a fixed window size to surface the last N messages"
|
||||
},
|
||||
{
|
||||
"label": "Conversation Summary",
|
||||
"name": "conversationSummary",
|
||||
"description": "Summarizes the whole conversation"
|
||||
},
|
||||
{
|
||||
"label": "Conversation Summary Buffer",
|
||||
"name": "conversationSummaryBuffer",
|
||||
"description": "Summarize conversations once token limit is reached. Default to 2000"
|
||||
}
|
||||
],
|
||||
"optional": true,
|
||||
"default": "allMessages",
|
||||
"show": {
|
||||
"agentEnableMemory": true
|
||||
},
|
||||
"id": "agentAgentflow_0-input-agentMemoryType-options",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Window Size",
|
||||
"name": "agentMemoryWindowSize",
|
||||
"type": "number",
|
||||
"default": "20",
|
||||
"description": "Uses a fixed window size to surface the last N messages",
|
||||
"show": {
|
||||
"agentMemoryType": "windowSize"
|
||||
},
|
||||
"id": "agentAgentflow_0-input-agentMemoryWindowSize-number",
|
||||
"display": false
|
||||
},
|
||||
{
|
||||
"label": "Max Token Limit",
|
||||
"name": "agentMemoryMaxTokenLimit",
|
||||
"type": "number",
|
||||
"default": "2000",
|
||||
"description": "Summarize conversations once token limit is reached. Default to 2000",
|
||||
"show": {
|
||||
"agentMemoryType": "conversationSummaryBuffer"
|
||||
},
|
||||
"id": "agentAgentflow_0-input-agentMemoryMaxTokenLimit-number",
|
||||
"display": false
|
||||
},
|
||||
{
|
||||
"label": "Input Message",
|
||||
"name": "agentUserMessage",
|
||||
"type": "string",
|
||||
"description": "Add an input message as user message at the end of the conversation",
|
||||
"rows": 4,
|
||||
"optional": true,
|
||||
"acceptVariable": true,
|
||||
"show": {
|
||||
"agentEnableMemory": true
|
||||
},
|
||||
"id": "agentAgentflow_0-input-agentUserMessage-string",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Return Response As",
|
||||
"name": "agentReturnResponseAs",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "User Message",
|
||||
"name": "userMessage"
|
||||
},
|
||||
{
|
||||
"label": "Assistant Message",
|
||||
"name": "assistantMessage"
|
||||
}
|
||||
],
|
||||
"default": "userMessage",
|
||||
"id": "agentAgentflow_0-input-agentReturnResponseAs-options",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Update Flow State",
|
||||
"name": "agentUpdateState",
|
||||
"description": "Update runtime state during the execution of the workflow",
|
||||
"type": "array",
|
||||
"optional": true,
|
||||
"acceptVariable": true,
|
||||
"array": [
|
||||
{
|
||||
"label": "Key",
|
||||
"name": "key",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listRuntimeStateKeys",
|
||||
"freeSolo": true
|
||||
},
|
||||
{
|
||||
"label": "Value",
|
||||
"name": "value",
|
||||
"type": "string",
|
||||
"acceptVariable": true,
|
||||
"acceptNodeOutputAsVariable": true
|
||||
}
|
||||
],
|
||||
"id": "agentAgentflow_0-input-agentUpdateState-array",
|
||||
"display": true
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"agentModel": "chatOpenAI",
|
||||
"agentMessages": [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "<p>You are a customer support agent working in Flowise Inc. Write a professional email reply to user's query. Use the web search tools to get more details about the prospect.</p>"
|
||||
}
|
||||
],
|
||||
"agentTools": [
|
||||
{
|
||||
"agentSelectedTool": "googleCustomSearch",
|
||||
"agentSelectedToolConfig": {
|
||||
"agentSelectedTool": "googleCustomSearch"
|
||||
}
|
||||
},
|
||||
{
|
||||
"agentSelectedTool": "currentDateTime",
|
||||
"agentSelectedToolConfig": {
|
||||
"agentSelectedTool": "currentDateTime"
|
||||
}
|
||||
}
|
||||
],
|
||||
"agentKnowledgeDocumentStores": "",
|
||||
"agentEnableMemory": true,
|
||||
"agentMemoryType": "allMessages",
|
||||
"agentUserMessage": "",
|
||||
"agentReturnResponseAs": "userMessage",
|
||||
"agentUpdateState": "",
|
||||
"agentModelConfig": {
|
||||
"cache": "",
|
||||
"modelName": "gpt-4o-mini",
|
||||
"temperature": 0.9,
|
||||
"streaming": true,
|
||||
"maxTokens": "",
|
||||
"topP": "",
|
||||
"frequencyPenalty": "",
|
||||
"presencePenalty": "",
|
||||
"timeout": "",
|
||||
"strictToolCalling": "",
|
||||
"stopSequence": "",
|
||||
"basepath": "",
|
||||
"proxyUrl": "",
|
||||
"baseOptions": "",
|
||||
"allowImageUploads": "",
|
||||
"imageResolution": "low",
|
||||
"reasoningEffort": "medium",
|
||||
"agentModel": "chatOpenAI"
|
||||
}
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "agentAgentflow_0-output-agentAgentflow",
|
||||
"label": "Agent",
|
||||
"name": "agentAgentflow"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"type": "agentFlow",
|
||||
"width": 182,
|
||||
"height": 103,
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": -62.25,
|
||||
"y": 76
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"id": "humanInputAgentflow_0",
|
||||
"position": {
|
||||
"x": 156.05666363734434,
|
||||
"y": 86.62266545493773
|
||||
},
|
||||
"data": {
|
||||
"id": "humanInputAgentflow_0",
|
||||
"label": "Human Input 0",
|
||||
"version": 1,
|
||||
"name": "humanInputAgentflow",
|
||||
"type": "HumanInput",
|
||||
"color": "#6E6EFD",
|
||||
"baseClasses": ["HumanInput"],
|
||||
"category": "Agent Flows",
|
||||
"description": "Request human input, approval or rejection during execution",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Description Type",
|
||||
"name": "humanInputDescriptionType",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "Fixed",
|
||||
"name": "fixed",
|
||||
"description": "Specify a fixed description"
|
||||
},
|
||||
{
|
||||
"label": "Dynamic",
|
||||
"name": "dynamic",
|
||||
"description": "Use LLM to generate a description"
|
||||
}
|
||||
],
|
||||
"id": "humanInputAgentflow_0-input-humanInputDescriptionType-options",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Description",
|
||||
"name": "humanInputDescription",
|
||||
"type": "string",
|
||||
"placeholder": "Are you sure you want to proceed?",
|
||||
"acceptVariable": true,
|
||||
"rows": 4,
|
||||
"show": {
|
||||
"humanInputDescriptionType": "fixed"
|
||||
},
|
||||
"id": "humanInputAgentflow_0-input-humanInputDescription-string",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Model",
|
||||
"name": "humanInputModel",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listModels",
|
||||
"loadConfig": true,
|
||||
"show": {
|
||||
"humanInputDescriptionType": "dynamic"
|
||||
},
|
||||
"id": "humanInputAgentflow_0-input-humanInputModel-asyncOptions",
|
||||
"display": false
|
||||
},
|
||||
{
|
||||
"label": "Prompt",
|
||||
"name": "humanInputModelPrompt",
|
||||
"type": "string",
|
||||
"default": "<p>Summarize the conversation between the user and the assistant, reiterate the last message from the assistant, and ask if user would like to proceed or if they have any feedback. </p>\n<ul>\n<li>Begin by capturing the key points of the conversation, ensuring that you reflect the main ideas and themes discussed.</li>\n<li>Then, clearly reproduce the last message sent by the assistant to maintain continuity. Make sure the whole message is reproduced.</li>\n<li>Finally, ask the user if they would like to proceed, or provide any feedback on the last assistant message</li>\n</ul>\n<h2 id=\"output-format-the-output-should-be-structured-in-three-parts-\">Output Format The output should be structured in three parts in text:</h2>\n<ul>\n<li>A summary of the conversation (1-3 sentences).</li>\n<li>The last assistant message (exactly as it appeared).</li>\n<li>Ask the user if they would like to proceed, or provide any feedback on last assistant message. No other explanation and elaboration is needed.</li>\n</ul>\n",
|
||||
"acceptVariable": true,
|
||||
"generateInstruction": true,
|
||||
"rows": 4,
|
||||
"show": {
|
||||
"humanInputDescriptionType": "dynamic"
|
||||
},
|
||||
"id": "humanInputAgentflow_0-input-humanInputModelPrompt-string",
|
||||
"display": false
|
||||
},
|
||||
{
|
||||
"label": "Enable Feedback",
|
||||
"name": "humanInputEnableFeedback",
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"id": "humanInputAgentflow_0-input-humanInputEnableFeedback-boolean",
|
||||
"display": true
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"humanInputDescriptionType": "fixed",
|
||||
"humanInputEnableFeedback": true,
|
||||
"humanInputModelConfig": {
|
||||
"cache": "",
|
||||
"modelName": "gpt-4o-mini",
|
||||
"temperature": 0.9,
|
||||
"streaming": true,
|
||||
"maxTokens": "",
|
||||
"topP": "",
|
||||
"frequencyPenalty": "",
|
||||
"presencePenalty": "",
|
||||
"timeout": "",
|
||||
"strictToolCalling": "",
|
||||
"stopSequence": "",
|
||||
"basepath": "",
|
||||
"proxyUrl": "",
|
||||
"baseOptions": "",
|
||||
"allowImageUploads": "",
|
||||
"imageResolution": "low",
|
||||
"reasoningEffort": "medium",
|
||||
"humanInputModel": "chatOpenAI"
|
||||
},
|
||||
"humanInputDescription": "<p>Are you sure you want to proceed?</p>"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "humanInputAgentflow_0-output-0",
|
||||
"label": "Human Input",
|
||||
"name": "humanInputAgentflow"
|
||||
},
|
||||
{
|
||||
"id": "humanInputAgentflow_0-output-1",
|
||||
"label": "Human Input",
|
||||
"name": "humanInputAgentflow"
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"humanInputAgentflow": ""
|
||||
},
|
||||
"selected": false
|
||||
},
|
||||
"type": "agentFlow",
|
||||
"width": 161,
|
||||
"height": 80,
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 156.05666363734434,
|
||||
"y": 86.62266545493773
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"id": "directReplyAgentflow_0",
|
||||
"position": {
|
||||
"x": 363.0101864947954,
|
||||
"y": 35.15053748988734
|
||||
},
|
||||
"data": {
|
||||
"id": "directReplyAgentflow_0",
|
||||
"label": "Direct Reply 0",
|
||||
"version": 1,
|
||||
"name": "directReplyAgentflow",
|
||||
"type": "DirectReply",
|
||||
"color": "#4DDBBB",
|
||||
"hideOutput": true,
|
||||
"baseClasses": ["DirectReply"],
|
||||
"category": "Agent Flows",
|
||||
"description": "Directly reply to the user with a message",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Message",
|
||||
"name": "directReplyMessage",
|
||||
"type": "string",
|
||||
"rows": 4,
|
||||
"acceptVariable": true,
|
||||
"id": "directReplyAgentflow_0-input-directReplyMessage-string",
|
||||
"display": true
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"directReplyMessage": "<p><span class=\"variable\" data-type=\"mention\" data-id=\"agentAgentflow_0\" data-label=\"agentAgentflow_0\">{{ agentAgentflow_0 }}</span> </p>"
|
||||
},
|
||||
"outputAnchors": [],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"type": "agentFlow",
|
||||
"width": 155,
|
||||
"height": 65,
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 363.0101864947954,
|
||||
"y": 35.15053748988734
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"id": "loopAgentflow_0",
|
||||
"position": {
|
||||
"x": 366.5975521223236,
|
||||
"y": 130.12266545493773
|
||||
},
|
||||
"data": {
|
||||
"id": "loopAgentflow_0",
|
||||
"label": "Loop 0",
|
||||
"version": 1,
|
||||
"name": "loopAgentflow",
|
||||
"type": "Loop",
|
||||
"color": "#FFA07A",
|
||||
"hideOutput": true,
|
||||
"baseClasses": ["Loop"],
|
||||
"category": "Agent Flows",
|
||||
"description": "Loop back to a previous node",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Loop Back To",
|
||||
"name": "loopBackToNode",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listPreviousNodes",
|
||||
"freeSolo": true,
|
||||
"id": "loopAgentflow_0-input-loopBackToNode-asyncOptions",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Max Loop Count",
|
||||
"name": "maxLoopCount",
|
||||
"type": "number",
|
||||
"default": 5,
|
||||
"id": "loopAgentflow_0-input-maxLoopCount-number",
|
||||
"display": true
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"loopBackToNode": "agentAgentflow_0-Email Reply Agent",
|
||||
"maxLoopCount": 5
|
||||
},
|
||||
"outputAnchors": [],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"type": "agentFlow",
|
||||
"width": 113,
|
||||
"height": 65,
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 366.5975521223236,
|
||||
"y": 130.12266545493773
|
||||
},
|
||||
"dragging": false
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"source": "startAgentflow_0",
|
||||
"sourceHandle": "startAgentflow_0-output-startAgentflow",
|
||||
"target": "agentAgentflow_0",
|
||||
"targetHandle": "agentAgentflow_0",
|
||||
"data": {
|
||||
"sourceColor": "#7EE787",
|
||||
"targetColor": "#4DD0E1",
|
||||
"isHumanInput": false
|
||||
},
|
||||
"type": "agentFlow",
|
||||
"id": "startAgentflow_0-startAgentflow_0-output-startAgentflow-agentAgentflow_0-agentAgentflow_0"
|
||||
},
|
||||
{
|
||||
"source": "agentAgentflow_0",
|
||||
"sourceHandle": "agentAgentflow_0-output-agentAgentflow",
|
||||
"target": "humanInputAgentflow_0",
|
||||
"targetHandle": "humanInputAgentflow_0",
|
||||
"data": {
|
||||
"sourceColor": "#4DD0E1",
|
||||
"targetColor": "#6E6EFD",
|
||||
"isHumanInput": false
|
||||
},
|
||||
"type": "agentFlow",
|
||||
"id": "agentAgentflow_0-agentAgentflow_0-output-agentAgentflow-humanInputAgentflow_0-humanInputAgentflow_0"
|
||||
},
|
||||
{
|
||||
"source": "humanInputAgentflow_0",
|
||||
"sourceHandle": "humanInputAgentflow_0-output-0",
|
||||
"target": "directReplyAgentflow_0",
|
||||
"targetHandle": "directReplyAgentflow_0",
|
||||
"data": {
|
||||
"sourceColor": "#6E6EFD",
|
||||
"targetColor": "#4DDBBB",
|
||||
"edgeLabel": "proceed",
|
||||
"isHumanInput": true
|
||||
},
|
||||
"type": "agentFlow",
|
||||
"id": "humanInputAgentflow_0-humanInputAgentflow_0-output-0-directReplyAgentflow_0-directReplyAgentflow_0"
|
||||
},
|
||||
{
|
||||
"source": "humanInputAgentflow_0",
|
||||
"sourceHandle": "humanInputAgentflow_0-output-1",
|
||||
"target": "loopAgentflow_0",
|
||||
"targetHandle": "loopAgentflow_0",
|
||||
"data": {
|
||||
"sourceColor": "#6E6EFD",
|
||||
"targetColor": "#FFA07A",
|
||||
"edgeLabel": "reject",
|
||||
"isHumanInput": true
|
||||
},
|
||||
"type": "agentFlow",
|
||||
"id": "humanInputAgentflow_0-humanInputAgentflow_0-output-1-loopAgentflow_0-loopAgentflow_0"
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,718 @@
|
||||
{
|
||||
"description": "An agent that can post message to Slack channel",
|
||||
"usecases": ["Agent"],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "startAgentflow_0",
|
||||
"type": "agentFlow",
|
||||
"position": {
|
||||
"x": -192.5,
|
||||
"y": 68
|
||||
},
|
||||
"data": {
|
||||
"id": "startAgentflow_0",
|
||||
"label": "Start",
|
||||
"version": 1,
|
||||
"name": "startAgentflow",
|
||||
"type": "Start",
|
||||
"color": "#7EE787",
|
||||
"hideInput": true,
|
||||
"baseClasses": ["Start"],
|
||||
"category": "Agent Flows",
|
||||
"description": "Starting point of the agentflow",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Input Type",
|
||||
"name": "startInputType",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "Chat Input",
|
||||
"name": "chatInput",
|
||||
"description": "Start the conversation with chat input"
|
||||
},
|
||||
{
|
||||
"label": "Form Input",
|
||||
"name": "formInput",
|
||||
"description": "Start the workflow with form inputs"
|
||||
}
|
||||
],
|
||||
"default": "chatInput",
|
||||
"id": "startAgentflow_0-input-startInputType-options",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Form Title",
|
||||
"name": "formTitle",
|
||||
"type": "string",
|
||||
"placeholder": "Please Fill Out The Form",
|
||||
"show": {
|
||||
"startInputType": "formInput"
|
||||
},
|
||||
"id": "startAgentflow_0-input-formTitle-string",
|
||||
"display": false
|
||||
},
|
||||
{
|
||||
"label": "Form Description",
|
||||
"name": "formDescription",
|
||||
"type": "string",
|
||||
"placeholder": "Complete all fields below to continue",
|
||||
"show": {
|
||||
"startInputType": "formInput"
|
||||
},
|
||||
"id": "startAgentflow_0-input-formDescription-string",
|
||||
"display": false
|
||||
},
|
||||
{
|
||||
"label": "Form Input Types",
|
||||
"name": "formInputTypes",
|
||||
"description": "Specify the type of form input",
|
||||
"type": "array",
|
||||
"show": {
|
||||
"startInputType": "formInput"
|
||||
},
|
||||
"array": [
|
||||
{
|
||||
"label": "Type",
|
||||
"name": "type",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "String",
|
||||
"name": "string"
|
||||
},
|
||||
{
|
||||
"label": "Number",
|
||||
"name": "number"
|
||||
},
|
||||
{
|
||||
"label": "Boolean",
|
||||
"name": "boolean"
|
||||
},
|
||||
{
|
||||
"label": "Options",
|
||||
"name": "options"
|
||||
}
|
||||
],
|
||||
"default": "string"
|
||||
},
|
||||
{
|
||||
"label": "Label",
|
||||
"name": "label",
|
||||
"type": "string",
|
||||
"placeholder": "Label for the input"
|
||||
},
|
||||
{
|
||||
"label": "Variable Name",
|
||||
"name": "name",
|
||||
"type": "string",
|
||||
"placeholder": "Variable name for the input (must be camel case)",
|
||||
"description": "Variable name must be camel case. For example: firstName, lastName, etc."
|
||||
},
|
||||
{
|
||||
"label": "Add Options",
|
||||
"name": "addOptions",
|
||||
"type": "array",
|
||||
"show": {
|
||||
"formInputTypes[$index].type": "options"
|
||||
},
|
||||
"array": [
|
||||
{
|
||||
"label": "Option",
|
||||
"name": "option",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"id": "startAgentflow_0-input-formInputTypes-array",
|
||||
"display": false
|
||||
},
|
||||
{
|
||||
"label": "Ephemeral Memory",
|
||||
"name": "startEphemeralMemory",
|
||||
"type": "boolean",
|
||||
"description": "Start fresh for every execution without past chat history",
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"label": "Flow State",
|
||||
"name": "startState",
|
||||
"description": "Runtime state during the execution of the workflow",
|
||||
"type": "array",
|
||||
"optional": true,
|
||||
"array": [
|
||||
{
|
||||
"label": "Key",
|
||||
"name": "key",
|
||||
"type": "string",
|
||||
"placeholder": "Foo"
|
||||
},
|
||||
{
|
||||
"label": "Value",
|
||||
"name": "value",
|
||||
"type": "string",
|
||||
"placeholder": "Bar"
|
||||
}
|
||||
],
|
||||
"id": "startAgentflow_0-input-startState-array",
|
||||
"display": true
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"startInputType": "chatInput",
|
||||
"formTitle": "",
|
||||
"formDescription": "",
|
||||
"formInputTypes": "",
|
||||
"startState": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "startAgentflow_0-output-startAgentflow",
|
||||
"label": "Start",
|
||||
"name": "startAgentflow"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"width": 101,
|
||||
"height": 65,
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": -192.5,
|
||||
"y": 68
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"id": "llmAgentflow_0",
|
||||
"position": {
|
||||
"x": -31.25,
|
||||
"y": 64.5
|
||||
},
|
||||
"data": {
|
||||
"id": "llmAgentflow_0",
|
||||
"label": "General Agent",
|
||||
"version": 1,
|
||||
"name": "llmAgentflow",
|
||||
"type": "LLM",
|
||||
"color": "#64B5F6",
|
||||
"baseClasses": ["LLM"],
|
||||
"category": "Agent Flows",
|
||||
"description": "Large language models to analyze user-provided inputs and generate responses",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Model",
|
||||
"name": "llmModel",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listModels",
|
||||
"loadConfig": true,
|
||||
"id": "llmAgentflow_0-input-llmModel-asyncOptions",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Messages",
|
||||
"name": "llmMessages",
|
||||
"type": "array",
|
||||
"optional": true,
|
||||
"acceptVariable": true,
|
||||
"array": [
|
||||
{
|
||||
"label": "Role",
|
||||
"name": "role",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "System",
|
||||
"name": "system"
|
||||
},
|
||||
{
|
||||
"label": "Assistant",
|
||||
"name": "assistant"
|
||||
},
|
||||
{
|
||||
"label": "Developer",
|
||||
"name": "developer"
|
||||
},
|
||||
{
|
||||
"label": "User",
|
||||
"name": "user"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Content",
|
||||
"name": "content",
|
||||
"type": "string",
|
||||
"acceptVariable": true,
|
||||
"generateInstruction": true,
|
||||
"rows": 4
|
||||
}
|
||||
],
|
||||
"id": "llmAgentflow_0-input-llmMessages-array",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Enable Memory",
|
||||
"name": "llmEnableMemory",
|
||||
"type": "boolean",
|
||||
"description": "Enable memory for the conversation thread",
|
||||
"default": true,
|
||||
"optional": true,
|
||||
"id": "llmAgentflow_0-input-llmEnableMemory-boolean",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Memory Type",
|
||||
"name": "llmMemoryType",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "All Messages",
|
||||
"name": "allMessages",
|
||||
"description": "Retrieve all messages from the conversation"
|
||||
},
|
||||
{
|
||||
"label": "Window Size",
|
||||
"name": "windowSize",
|
||||
"description": "Uses a fixed window size to surface the last N messages"
|
||||
},
|
||||
{
|
||||
"label": "Conversation Summary",
|
||||
"name": "conversationSummary",
|
||||
"description": "Summarizes the whole conversation"
|
||||
},
|
||||
{
|
||||
"label": "Conversation Summary Buffer",
|
||||
"name": "conversationSummaryBuffer",
|
||||
"description": "Summarize conversations once token limit is reached. Default to 2000"
|
||||
}
|
||||
],
|
||||
"optional": true,
|
||||
"default": "allMessages",
|
||||
"show": {
|
||||
"llmEnableMemory": true
|
||||
},
|
||||
"id": "llmAgentflow_0-input-llmMemoryType-options",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Window Size",
|
||||
"name": "llmMemoryWindowSize",
|
||||
"type": "number",
|
||||
"default": "20",
|
||||
"description": "Uses a fixed window size to surface the last N messages",
|
||||
"show": {
|
||||
"llmMemoryType": "windowSize"
|
||||
},
|
||||
"id": "llmAgentflow_0-input-llmMemoryWindowSize-number",
|
||||
"display": false
|
||||
},
|
||||
{
|
||||
"label": "Max Token Limit",
|
||||
"name": "llmMemoryMaxTokenLimit",
|
||||
"type": "number",
|
||||
"default": "2000",
|
||||
"description": "Summarize conversations once token limit is reached. Default to 2000",
|
||||
"show": {
|
||||
"llmMemoryType": "conversationSummaryBuffer"
|
||||
},
|
||||
"id": "llmAgentflow_0-input-llmMemoryMaxTokenLimit-number",
|
||||
"display": false
|
||||
},
|
||||
{
|
||||
"label": "Input Message",
|
||||
"name": "llmUserMessage",
|
||||
"type": "string",
|
||||
"description": "Add an input message as user message at the end of the conversation",
|
||||
"rows": 4,
|
||||
"optional": true,
|
||||
"acceptVariable": true,
|
||||
"show": {
|
||||
"llmEnableMemory": true
|
||||
},
|
||||
"id": "llmAgentflow_0-input-llmUserMessage-string",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Return Response As",
|
||||
"name": "llmReturnResponseAs",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "User Message",
|
||||
"name": "userMessage"
|
||||
},
|
||||
{
|
||||
"label": "Assistant Message",
|
||||
"name": "assistantMessage"
|
||||
}
|
||||
],
|
||||
"default": "userMessage",
|
||||
"id": "llmAgentflow_0-input-llmReturnResponseAs-options",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "JSON Structured Output",
|
||||
"name": "llmStructuredOutput",
|
||||
"description": "Instruct the LLM to give output in a JSON structured schema",
|
||||
"type": "array",
|
||||
"optional": true,
|
||||
"acceptVariable": true,
|
||||
"array": [
|
||||
{
|
||||
"label": "Key",
|
||||
"name": "key",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"label": "Type",
|
||||
"name": "type",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "String",
|
||||
"name": "string"
|
||||
},
|
||||
{
|
||||
"label": "String Array",
|
||||
"name": "stringArray"
|
||||
},
|
||||
{
|
||||
"label": "Number",
|
||||
"name": "number"
|
||||
},
|
||||
{
|
||||
"label": "Boolean",
|
||||
"name": "boolean"
|
||||
},
|
||||
{
|
||||
"label": "Enum",
|
||||
"name": "enum"
|
||||
},
|
||||
{
|
||||
"label": "JSON Array",
|
||||
"name": "jsonArray"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Enum Values",
|
||||
"name": "enumValues",
|
||||
"type": "string",
|
||||
"placeholder": "value1, value2, value3",
|
||||
"description": "Enum values. Separated by comma",
|
||||
"optional": true,
|
||||
"show": {
|
||||
"llmStructuredOutput[$index].type": "enum"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "JSON Schema",
|
||||
"name": "jsonSchema",
|
||||
"type": "code",
|
||||
"placeholder": "{\n \"answer\": {\n \"type\": \"string\",\n \"description\": \"Value of the answer\"\n },\n \"reason\": {\n \"type\": \"string\",\n \"description\": \"Reason for the answer\"\n },\n \"optional\": {\n \"type\": \"boolean\"\n },\n \"count\": {\n \"type\": \"number\"\n },\n \"children\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"value\": {\n \"type\": \"string\",\n \"description\": \"Value of the children's answer\"\n }\n }\n }\n }\n}",
|
||||
"description": "JSON schema for the structured output",
|
||||
"optional": true,
|
||||
"show": {
|
||||
"llmStructuredOutput[$index].type": "jsonArray"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Description",
|
||||
"name": "description",
|
||||
"type": "string",
|
||||
"placeholder": "Description of the key"
|
||||
}
|
||||
],
|
||||
"id": "llmAgentflow_0-input-llmStructuredOutput-array",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Update Flow State",
|
||||
"name": "llmUpdateState",
|
||||
"description": "Update runtime state during the execution of the workflow",
|
||||
"type": "array",
|
||||
"optional": true,
|
||||
"acceptVariable": true,
|
||||
"array": [
|
||||
{
|
||||
"label": "Key",
|
||||
"name": "key",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listRuntimeStateKeys",
|
||||
"freeSolo": true
|
||||
},
|
||||
{
|
||||
"label": "Value",
|
||||
"name": "value",
|
||||
"type": "string",
|
||||
"acceptVariable": true,
|
||||
"acceptNodeOutputAsVariable": true
|
||||
}
|
||||
],
|
||||
"id": "llmAgentflow_0-input-llmUpdateState-array",
|
||||
"display": true
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"llmModel": "chatOpenAI",
|
||||
"llmMessages": "",
|
||||
"llmEnableMemory": true,
|
||||
"llmMemoryType": "allMessages",
|
||||
"llmUserMessage": "",
|
||||
"llmReturnResponseAs": "userMessage",
|
||||
"llmStructuredOutput": "",
|
||||
"llmUpdateState": "",
|
||||
"llmModelConfig": {
|
||||
"credential": "",
|
||||
"modelName": "gpt-4o-mini",
|
||||
"temperature": 0.9,
|
||||
"streaming": true,
|
||||
"maxTokens": "",
|
||||
"topP": "",
|
||||
"frequencyPenalty": "",
|
||||
"presencePenalty": "",
|
||||
"timeout": "",
|
||||
"strictToolCalling": "",
|
||||
"stopSequence": "",
|
||||
"basepath": "",
|
||||
"proxyUrl": "",
|
||||
"baseOptions": "",
|
||||
"allowImageUploads": "",
|
||||
"imageResolution": "low",
|
||||
"reasoningEffort": "medium",
|
||||
"llmModel": "chatOpenAI"
|
||||
}
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "llmAgentflow_0-output-llmAgentflow",
|
||||
"label": "LLM",
|
||||
"name": "llmAgentflow"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"type": "agentFlow",
|
||||
"width": 168,
|
||||
"height": 71,
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": -31.25,
|
||||
"y": 64.5
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"id": "toolAgentflow_0",
|
||||
"position": {
|
||||
"x": 182.75,
|
||||
"y": 64.5
|
||||
},
|
||||
"data": {
|
||||
"id": "toolAgentflow_0",
|
||||
"label": "Slack Reply",
|
||||
"version": 1,
|
||||
"name": "toolAgentflow",
|
||||
"type": "Tool",
|
||||
"color": "#d4a373",
|
||||
"baseClasses": ["Tool"],
|
||||
"category": "Agent Flows",
|
||||
"description": "Tools allow LLM to interact with external systems",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Tool",
|
||||
"name": "selectedTool",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listTools",
|
||||
"loadConfig": true,
|
||||
"id": "toolAgentflow_0-input-selectedTool-asyncOptions",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Tool Input Arguments",
|
||||
"name": "toolInputArgs",
|
||||
"type": "array",
|
||||
"acceptVariable": true,
|
||||
"refresh": true,
|
||||
"array": [
|
||||
{
|
||||
"label": "Input Argument Name",
|
||||
"name": "inputArgName",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listToolInputArgs",
|
||||
"refresh": true
|
||||
},
|
||||
{
|
||||
"label": "Input Argument Value",
|
||||
"name": "inputArgValue",
|
||||
"type": "string",
|
||||
"acceptVariable": true
|
||||
}
|
||||
],
|
||||
"show": {
|
||||
"selectedTool": ".+"
|
||||
},
|
||||
"id": "toolAgentflow_0-input-toolInputArgs-array",
|
||||
"display": true
|
||||
},
|
||||
{
|
||||
"label": "Update Flow State",
|
||||
"name": "toolUpdateState",
|
||||
"description": "Update runtime state during the execution of the workflow",
|
||||
"type": "array",
|
||||
"optional": true,
|
||||
"acceptVariable": true,
|
||||
"array": [
|
||||
{
|
||||
"label": "Key",
|
||||
"name": "key",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listRuntimeStateKeys",
|
||||
"freeSolo": true
|
||||
},
|
||||
{
|
||||
"label": "Value",
|
||||
"name": "value",
|
||||
"type": "string",
|
||||
"acceptVariable": true,
|
||||
"acceptNodeOutputAsVariable": true
|
||||
}
|
||||
],
|
||||
"id": "toolAgentflow_0-input-toolUpdateState-array",
|
||||
"display": true
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"selectedTool": "slackMCP",
|
||||
"toolInputArgs": [
|
||||
{
|
||||
"inputArgName": "channel_id",
|
||||
"inputArgValue": "<p>ABCDEFG</p>"
|
||||
},
|
||||
{
|
||||
"inputArgName": "text",
|
||||
"inputArgValue": "<p><span class=\"variable\" data-type=\"mention\" data-id=\"llmAgentflow_0\" data-label=\"llmAgentflow_0\">{{ llmAgentflow_0 }}</span> </p>"
|
||||
}
|
||||
],
|
||||
"toolUpdateState": "",
|
||||
"selectedToolConfig": {
|
||||
"mcpActions": "[\"slack_post_message\"]",
|
||||
"selectedTool": "slackMCP"
|
||||
}
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "toolAgentflow_0-output-toolAgentflow",
|
||||
"label": "Tool",
|
||||
"name": "toolAgentflow"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"type": "agentFlow",
|
||||
"width": 142,
|
||||
"height": 71,
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 182.75,
|
||||
"y": 64.5
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"id": "directReplyAgentflow_0",
|
||||
"position": {
|
||||
"x": 366.75,
|
||||
"y": 67.5
|
||||
},
|
||||
"data": {
|
||||
"id": "directReplyAgentflow_0",
|
||||
"label": "Direct Reply To Chat",
|
||||
"version": 1,
|
||||
"name": "directReplyAgentflow",
|
||||
"type": "DirectReply",
|
||||
"color": "#4DDBBB",
|
||||
"hideOutput": true,
|
||||
"baseClasses": ["DirectReply"],
|
||||
"category": "Agent Flows",
|
||||
"description": "Directly reply to the user with a message",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Message",
|
||||
"name": "directReplyMessage",
|
||||
"type": "string",
|
||||
"rows": 4,
|
||||
"acceptVariable": true,
|
||||
"id": "directReplyAgentflow_0-input-directReplyMessage-string",
|
||||
"display": true
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"directReplyMessage": "<p><span class=\"variable\" data-type=\"mention\" data-id=\"llmAgentflow_0\" data-label=\"llmAgentflow_0\">{{ llmAgentflow_0 }}</span> </p>"
|
||||
},
|
||||
"outputAnchors": [],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"type": "agentFlow",
|
||||
"width": 194,
|
||||
"height": 65,
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 366.75,
|
||||
"y": 67.5
|
||||
},
|
||||
"dragging": false
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"source": "startAgentflow_0",
|
||||
"sourceHandle": "startAgentflow_0-output-startAgentflow",
|
||||
"target": "llmAgentflow_0",
|
||||
"targetHandle": "llmAgentflow_0",
|
||||
"data": {
|
||||
"sourceColor": "#7EE787",
|
||||
"targetColor": "#64B5F6",
|
||||
"isHumanInput": false
|
||||
},
|
||||
"type": "agentFlow",
|
||||
"id": "startAgentflow_0-startAgentflow_0-output-startAgentflow-llmAgentflow_0-llmAgentflow_0"
|
||||
},
|
||||
{
|
||||
"source": "llmAgentflow_0",
|
||||
"sourceHandle": "llmAgentflow_0-output-llmAgentflow",
|
||||
"target": "toolAgentflow_0",
|
||||
"targetHandle": "toolAgentflow_0",
|
||||
"data": {
|
||||
"sourceColor": "#64B5F6",
|
||||
"targetColor": "#d4a373",
|
||||
"isHumanInput": false
|
||||
},
|
||||
"type": "agentFlow",
|
||||
"id": "llmAgentflow_0-llmAgentflow_0-output-llmAgentflow-toolAgentflow_0-toolAgentflow_0"
|
||||
},
|
||||
{
|
||||
"source": "toolAgentflow_0",
|
||||
"sourceHandle": "toolAgentflow_0-output-toolAgentflow",
|
||||
"target": "directReplyAgentflow_0",
|
||||
"targetHandle": "directReplyAgentflow_0",
|
||||
"data": {
|
||||
"sourceColor": "#d4a373",
|
||||
"targetColor": "#4DDBBB",
|
||||
"isHumanInput": false
|
||||
},
|
||||
"type": "agentFlow",
|
||||
"id": "toolAgentflow_0-toolAgentflow_0-output-toolAgentflow-directReplyAgentflow_0-directReplyAgentflow_0"
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,701 +0,0 @@
|
||||
{
|
||||
"description": "AutoGPT - Autonomous agent with chain of thoughts for self-guided task completion",
|
||||
"framework": ["Langchain"],
|
||||
"usecases": ["Reflective Agent"],
|
||||
"nodes": [
|
||||
{
|
||||
"width": 300,
|
||||
"height": 679,
|
||||
"id": "autoGPT_0",
|
||||
"position": {
|
||||
"x": 1566.5228556278,
|
||||
"y": 48.800017192230115
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "autoGPT_0",
|
||||
"label": "AutoGPT",
|
||||
"version": 2,
|
||||
"name": "autoGPT",
|
||||
"type": "AutoGPT",
|
||||
"baseClasses": ["AutoGPT"],
|
||||
"category": "Agents",
|
||||
"description": "Autonomous agent with chain of thoughts by GPT4",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "AutoGPT Name",
|
||||
"name": "aiName",
|
||||
"type": "string",
|
||||
"placeholder": "Tom",
|
||||
"optional": true,
|
||||
"id": "autoGPT_0-input-aiName-string"
|
||||
},
|
||||
{
|
||||
"label": "AutoGPT Role",
|
||||
"name": "aiRole",
|
||||
"type": "string",
|
||||
"placeholder": "Assistant",
|
||||
"optional": true,
|
||||
"id": "autoGPT_0-input-aiRole-string"
|
||||
},
|
||||
{
|
||||
"label": "Maximum Loop",
|
||||
"name": "maxLoop",
|
||||
"type": "number",
|
||||
"default": 5,
|
||||
"optional": true,
|
||||
"id": "autoGPT_0-input-maxLoop-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Allowed Tools",
|
||||
"name": "tools",
|
||||
"type": "Tool",
|
||||
"list": true,
|
||||
"id": "autoGPT_0-input-tools-Tool"
|
||||
},
|
||||
{
|
||||
"label": "Chat Model",
|
||||
"name": "model",
|
||||
"type": "BaseChatModel",
|
||||
"id": "autoGPT_0-input-model-BaseChatModel"
|
||||
},
|
||||
{
|
||||
"label": "Vector Store Retriever",
|
||||
"name": "vectorStoreRetriever",
|
||||
"type": "BaseRetriever",
|
||||
"id": "autoGPT_0-input-vectorStoreRetriever-BaseRetriever"
|
||||
},
|
||||
{
|
||||
"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": "autoGPT_0-input-inputModeration-Moderation"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"inputModeration": "",
|
||||
"tools": ["{{serpAPI_0.data.instance}}"],
|
||||
"model": "{{chatOpenAI_0.data.instance}}",
|
||||
"vectorStoreRetriever": "{{pinecone_0.data.instance}}",
|
||||
"aiName": "",
|
||||
"aiRole": "",
|
||||
"maxLoop": 5
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "autoGPT_0-output-autoGPT-AutoGPT",
|
||||
"name": "autoGPT",
|
||||
"label": "AutoGPT",
|
||||
"type": "AutoGPT"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1566.5228556278,
|
||||
"y": 48.800017192230115
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 276,
|
||||
"id": "serpAPI_0",
|
||||
"position": {
|
||||
"x": 1207.9685973743674,
|
||||
"y": -216.77363417201138
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "serpAPI_0",
|
||||
"label": "Serp API",
|
||||
"version": 1,
|
||||
"name": "serpAPI",
|
||||
"type": "SerpAPI",
|
||||
"baseClasses": ["SerpAPI", "Tool", "StructuredTool"],
|
||||
"category": "Tools",
|
||||
"description": "Wrapper around SerpAPI - a real-time API to access Google search results",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Connect Credential",
|
||||
"name": "credential",
|
||||
"type": "credential",
|
||||
"credentialNames": ["serpApi"],
|
||||
"id": "serpAPI_0-input-credential-credential"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool",
|
||||
"name": "serpAPI",
|
||||
"label": "SerpAPI",
|
||||
"type": "SerpAPI | Tool | StructuredTool"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1207.9685973743674,
|
||||
"y": -216.77363417201138
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 670,
|
||||
"id": "chatOpenAI_0",
|
||||
"position": {
|
||||
"x": 861.5955028972123,
|
||||
"y": -322.72984118549857
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "chatOpenAI_0",
|
||||
"label": "ChatOpenAI",
|
||||
"version": 6,
|
||||
"name": "chatOpenAI",
|
||||
"type": "ChatOpenAI",
|
||||
"baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"],
|
||||
"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": "asyncOptions",
|
||||
"loadMethod": "listModels",
|
||||
"default": "gpt-3.5-turbo",
|
||||
"id": "chatOpenAI_0-input-modelName-options"
|
||||
},
|
||||
{
|
||||
"label": "Temperature",
|
||||
"name": "temperature",
|
||||
"type": "number",
|
||||
"default": 0.9,
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_0-input-temperature-number"
|
||||
},
|
||||
{
|
||||
"label": "Max Tokens",
|
||||
"name": "maxTokens",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-maxTokens-number"
|
||||
},
|
||||
{
|
||||
"label": "Top Probability",
|
||||
"name": "topP",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-topP-number"
|
||||
},
|
||||
{
|
||||
"label": "Frequency Penalty",
|
||||
"name": "frequencyPenalty",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-frequencyPenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Presence Penalty",
|
||||
"name": "presencePenalty",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-presencePenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Timeout",
|
||||
"name": "timeout",
|
||||
"type": "number",
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"label": "Allow Image Uploads",
|
||||
"name": "allowImageUploads",
|
||||
"type": "boolean",
|
||||
"description": "Automatically uses gpt-4-vision-preview when image is being uploaded from chat. Only works with LLMChain, Conversation Chain, ReAct Agent, and Conversational Agent",
|
||||
"default": false,
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_0-input-allowImageUploads-boolean"
|
||||
},
|
||||
{
|
||||
"label": "Image Resolution",
|
||||
"description": "This parameter controls the resolution in which the model views the image.",
|
||||
"name": "imageResolution",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "Low",
|
||||
"name": "low"
|
||||
},
|
||||
{
|
||||
"label": "High",
|
||||
"name": "high"
|
||||
},
|
||||
{
|
||||
"label": "Auto",
|
||||
"name": "auto"
|
||||
}
|
||||
],
|
||||
"default": "low",
|
||||
"optional": false,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-imageResolution-options"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Cache",
|
||||
"name": "cache",
|
||||
"type": "BaseCache",
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_0-input-cache-BaseCache"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"modelName": "gpt-3.5-turbo",
|
||||
"temperature": 0.9,
|
||||
"maxTokens": "",
|
||||
"topP": "",
|
||||
"frequencyPenalty": "",
|
||||
"presencePenalty": "",
|
||||
"timeout": "",
|
||||
"basepath": "",
|
||||
"baseOptions": "",
|
||||
"allowImageUploads": true,
|
||||
"imageResolution": "low"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"name": "chatOpenAI",
|
||||
"label": "ChatOpenAI",
|
||||
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 861.5955028972123,
|
||||
"y": -322.72984118549857
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 424,
|
||||
"id": "openAIEmbeddings_0",
|
||||
"position": {
|
||||
"x": 116.62153412789377,
|
||||
"y": 52.465581131402246
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "openAIEmbeddings_0",
|
||||
"label": "OpenAI Embeddings",
|
||||
"version": 4,
|
||||
"name": "openAIEmbeddings",
|
||||
"type": "OpenAIEmbeddings",
|
||||
"baseClasses": ["OpenAIEmbeddings", "Embeddings"],
|
||||
"category": "Embeddings",
|
||||
"description": "OpenAI API to generate embeddings for a given text",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Connect Credential",
|
||||
"name": "credential",
|
||||
"type": "credential",
|
||||
"credentialNames": ["openAIApi"],
|
||||
"id": "openAIEmbeddings_0-input-credential-credential"
|
||||
},
|
||||
{
|
||||
"label": "Model Name",
|
||||
"name": "modelName",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listModels",
|
||||
"default": "text-embedding-ada-002",
|
||||
"id": "openAIEmbeddings_0-input-modelName-asyncOptions"
|
||||
},
|
||||
{
|
||||
"label": "Strip New Lines",
|
||||
"name": "stripNewLines",
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-stripNewLines-boolean"
|
||||
},
|
||||
{
|
||||
"label": "Batch Size",
|
||||
"name": "batchSize",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-batchSize-number"
|
||||
},
|
||||
{
|
||||
"label": "Timeout",
|
||||
"name": "timeout",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-timeout-number"
|
||||
},
|
||||
{
|
||||
"label": "BasePath",
|
||||
"name": "basepath",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-basepath-string"
|
||||
},
|
||||
{
|
||||
"label": "Dimensions",
|
||||
"name": "dimensions",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-dimensions-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"modelName": "text-embedding-ada-002",
|
||||
"stripNewLines": "",
|
||||
"batchSize": "",
|
||||
"timeout": "",
|
||||
"basepath": "",
|
||||
"dimensions": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
|
||||
"name": "openAIEmbeddings",
|
||||
"label": "OpenAIEmbeddings",
|
||||
"description": "OpenAI API to generate embeddings for a given text",
|
||||
"type": "OpenAIEmbeddings | Embeddings"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 116.62153412789377,
|
||||
"y": 52.465581131402246
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 606,
|
||||
"id": "pinecone_0",
|
||||
"position": {
|
||||
"x": 512.2389361920059,
|
||||
"y": -36.80102752360557
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "pinecone_0",
|
||||
"label": "Pinecone",
|
||||
"version": 3,
|
||||
"name": "pinecone",
|
||||
"type": "Pinecone",
|
||||
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
|
||||
"category": "Vector Stores",
|
||||
"description": "Upsert embedded data and perform similarity or mmr search using Pinecone, a leading fully managed hosted vector database",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Connect Credential",
|
||||
"name": "credential",
|
||||
"type": "credential",
|
||||
"credentialNames": ["pineconeApi"],
|
||||
"id": "pinecone_0-input-credential-credential"
|
||||
},
|
||||
{
|
||||
"label": "Pinecone Index",
|
||||
"name": "pineconeIndex",
|
||||
"type": "string",
|
||||
"id": "pinecone_0-input-pineconeIndex-string"
|
||||
},
|
||||
{
|
||||
"label": "Pinecone Namespace",
|
||||
"name": "pineconeNamespace",
|
||||
"type": "string",
|
||||
"placeholder": "my-first-namespace",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "pinecone_0-input-pineconeNamespace-string"
|
||||
},
|
||||
{
|
||||
"label": "Pinecone Metadata Filter",
|
||||
"name": "pineconeMetadataFilter",
|
||||
"type": "json",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "pinecone_0-input-pineconeMetadataFilter-json"
|
||||
},
|
||||
{
|
||||
"label": "Top K",
|
||||
"name": "topK",
|
||||
"description": "Number of top results to fetch. Default to 4",
|
||||
"placeholder": "4",
|
||||
"type": "number",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "pinecone_0-input-topK-number"
|
||||
},
|
||||
{
|
||||
"label": "Search Type",
|
||||
"name": "searchType",
|
||||
"type": "options",
|
||||
"default": "similarity",
|
||||
"options": [
|
||||
{
|
||||
"label": "Similarity",
|
||||
"name": "similarity"
|
||||
},
|
||||
{
|
||||
"label": "Max Marginal Relevance",
|
||||
"name": "mmr"
|
||||
}
|
||||
],
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "pinecone_0-input-searchType-options"
|
||||
},
|
||||
{
|
||||
"label": "Fetch K (for MMR Search)",
|
||||
"name": "fetchK",
|
||||
"description": "Number of initial documents to fetch for MMR reranking. Default to 20. Used only when the search type is MMR",
|
||||
"placeholder": "20",
|
||||
"type": "number",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "pinecone_0-input-fetchK-number"
|
||||
},
|
||||
{
|
||||
"label": "Lambda (for MMR Search)",
|
||||
"name": "lambda",
|
||||
"description": "Number between 0 and 1 that determines the degree of diversity among the results, where 0 corresponds to maximum diversity and 1 to minimum diversity. Used only when the search type is MMR",
|
||||
"placeholder": "0.5",
|
||||
"type": "number",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "pinecone_0-input-lambda-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Document",
|
||||
"name": "document",
|
||||
"type": "Document",
|
||||
"list": true,
|
||||
"optional": true,
|
||||
"id": "pinecone_0-input-document-Document"
|
||||
},
|
||||
{
|
||||
"label": "Embeddings",
|
||||
"name": "embeddings",
|
||||
"type": "Embeddings",
|
||||
"id": "pinecone_0-input-embeddings-Embeddings"
|
||||
},
|
||||
{
|
||||
"label": "Record Manager",
|
||||
"name": "recordManager",
|
||||
"type": "RecordManager",
|
||||
"description": "Keep track of the record to prevent duplication",
|
||||
"optional": true,
|
||||
"id": "pinecone_0-input-recordManager-RecordManager"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"document": "",
|
||||
"embeddings": "{{openAIEmbeddings_0.data.instance}}",
|
||||
"recordManager": "",
|
||||
"pineconeIndex": "",
|
||||
"pineconeNamespace": "",
|
||||
"pineconeMetadataFilter": "",
|
||||
"topK": "",
|
||||
"searchType": "similarity",
|
||||
"fetchK": "",
|
||||
"lambda": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"name": "output",
|
||||
"label": "Output",
|
||||
"type": "options",
|
||||
"description": "",
|
||||
"options": [
|
||||
{
|
||||
"id": "pinecone_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever",
|
||||
"name": "retriever",
|
||||
"label": "Pinecone Retriever",
|
||||
"description": "",
|
||||
"type": "Pinecone | VectorStoreRetriever | BaseRetriever"
|
||||
},
|
||||
{
|
||||
"id": "pinecone_0-output-vectorStore-Pinecone|VectorStore",
|
||||
"name": "vectorStore",
|
||||
"label": "Pinecone Vector Store",
|
||||
"description": "",
|
||||
"type": "Pinecone | VectorStore"
|
||||
}
|
||||
],
|
||||
"default": "retriever"
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"output": "retriever"
|
||||
},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 512.2389361920059,
|
||||
"y": -36.80102752360557
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"id": "stickyNote_0",
|
||||
"position": {
|
||||
"x": 1565.5672914362437,
|
||||
"y": -138.9994972608436
|
||||
},
|
||||
"type": "stickyNote",
|
||||
"data": {
|
||||
"id": "stickyNote_0",
|
||||
"label": "Sticky Note",
|
||||
"version": 2,
|
||||
"name": "stickyNote",
|
||||
"type": "StickyNote",
|
||||
"baseClasses": ["StickyNote"],
|
||||
"tags": ["Utilities"],
|
||||
"category": "Utilities",
|
||||
"description": "Add a sticky note",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "",
|
||||
"name": "note",
|
||||
"type": "string",
|
||||
"rows": 1,
|
||||
"placeholder": "Type something here",
|
||||
"optional": true,
|
||||
"id": "stickyNote_0-input-note-string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"note": "An agent that uses long-term memory (Pinecone in this example) together with a prompt for self-guided task completion.\n\nAgent has access to Serp API tool to search the web, and store the continuous results to Pinecone"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "stickyNote_0-output-stickyNote-StickyNote",
|
||||
"name": "stickyNote",
|
||||
"label": "StickyNote",
|
||||
"description": "Add a sticky note",
|
||||
"type": "StickyNote"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"width": 300,
|
||||
"height": 163,
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1565.5672914362437,
|
||||
"y": -138.9994972608436
|
||||
},
|
||||
"dragging": false
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"source": "chatOpenAI_0",
|
||||
"sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"target": "autoGPT_0",
|
||||
"targetHandle": "autoGPT_0-input-model-BaseChatModel",
|
||||
"type": "buttonedge",
|
||||
"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-autoGPT_0-autoGPT_0-input-model-BaseChatModel",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "serpAPI_0",
|
||||
"sourceHandle": "serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool",
|
||||
"target": "autoGPT_0",
|
||||
"targetHandle": "autoGPT_0-input-tools-Tool",
|
||||
"type": "buttonedge",
|
||||
"id": "serpAPI_0-serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool-autoGPT_0-autoGPT_0-input-tools-Tool",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "openAIEmbeddings_0",
|
||||
"sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
|
||||
"target": "pinecone_0",
|
||||
"targetHandle": "pinecone_0-input-embeddings-Embeddings",
|
||||
"type": "buttonedge",
|
||||
"id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pinecone_0-pinecone_0-input-embeddings-Embeddings",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "pinecone_0",
|
||||
"sourceHandle": "pinecone_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever",
|
||||
"target": "autoGPT_0",
|
||||
"targetHandle": "autoGPT_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"type": "buttonedge",
|
||||
"id": "pinecone_0-pinecone_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever-autoGPT_0-autoGPT_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,623 +0,0 @@
|
||||
{
|
||||
"description": "Use BabyAGI to create tasks and reprioritize for a given objective",
|
||||
"framework": ["Langchain"],
|
||||
"usecases": ["Reflective Agent"],
|
||||
"nodes": [
|
||||
{
|
||||
"width": 300,
|
||||
"height": 431,
|
||||
"id": "babyAGI_1",
|
||||
"position": {
|
||||
"x": 950.8042093214954,
|
||||
"y": 66.00028106865324
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "babyAGI_1",
|
||||
"label": "BabyAGI",
|
||||
"version": 2,
|
||||
"name": "babyAGI",
|
||||
"type": "BabyAGI",
|
||||
"baseClasses": ["BabyAGI"],
|
||||
"category": "Agents",
|
||||
"description": "Task Driven Autonomous Agent which creates new task and reprioritizes task list based on objective",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Task Loop",
|
||||
"name": "taskLoop",
|
||||
"type": "number",
|
||||
"default": 3,
|
||||
"id": "babyAGI_1-input-taskLoop-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Chat Model",
|
||||
"name": "model",
|
||||
"type": "BaseChatModel",
|
||||
"id": "babyAGI_1-input-model-BaseChatModel"
|
||||
},
|
||||
{
|
||||
"label": "Vector Store",
|
||||
"name": "vectorStore",
|
||||
"type": "VectorStore",
|
||||
"id": "babyAGI_1-input-vectorStore-VectorStore"
|
||||
},
|
||||
{
|
||||
"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": "babyAGI_1-input-inputModeration-Moderation"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"inputModeration": "",
|
||||
"model": "{{chatOpenAI_0.data.instance}}",
|
||||
"vectorStore": "{{pinecone_0.data.instance}}",
|
||||
"taskLoop": 3
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "babyAGI_1-output-babyAGI-BabyAGI",
|
||||
"name": "babyAGI",
|
||||
"label": "BabyAGI",
|
||||
"type": "BabyAGI"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"dragging": false,
|
||||
"positionAbsolute": {
|
||||
"x": 950.8042093214954,
|
||||
"y": 66.00028106865324
|
||||
}
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 424,
|
||||
"id": "openAIEmbeddings_0",
|
||||
"position": {
|
||||
"x": -111.82510263637522,
|
||||
"y": -224.88655030419665
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "openAIEmbeddings_0",
|
||||
"label": "OpenAI Embeddings",
|
||||
"version": 4,
|
||||
"name": "openAIEmbeddings",
|
||||
"type": "OpenAIEmbeddings",
|
||||
"baseClasses": ["OpenAIEmbeddings", "Embeddings"],
|
||||
"category": "Embeddings",
|
||||
"description": "OpenAI API to generate embeddings for a given text",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Connect Credential",
|
||||
"name": "credential",
|
||||
"type": "credential",
|
||||
"credentialNames": ["openAIApi"],
|
||||
"id": "openAIEmbeddings_0-input-credential-credential"
|
||||
},
|
||||
{
|
||||
"label": "Model Name",
|
||||
"name": "modelName",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listModels",
|
||||
"default": "text-embedding-ada-002",
|
||||
"id": "openAIEmbeddings_0-input-modelName-asyncOptions"
|
||||
},
|
||||
{
|
||||
"label": "Strip New Lines",
|
||||
"name": "stripNewLines",
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-stripNewLines-boolean"
|
||||
},
|
||||
{
|
||||
"label": "Batch Size",
|
||||
"name": "batchSize",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-batchSize-number"
|
||||
},
|
||||
{
|
||||
"label": "Timeout",
|
||||
"name": "timeout",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-timeout-number"
|
||||
},
|
||||
{
|
||||
"label": "BasePath",
|
||||
"name": "basepath",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-basepath-string"
|
||||
},
|
||||
{
|
||||
"label": "Dimensions",
|
||||
"name": "dimensions",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-dimensions-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"modelName": "text-embedding-ada-002",
|
||||
"stripNewLines": "",
|
||||
"batchSize": "",
|
||||
"timeout": "",
|
||||
"basepath": "",
|
||||
"dimensions": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
|
||||
"name": "openAIEmbeddings",
|
||||
"label": "OpenAIEmbeddings",
|
||||
"description": "OpenAI API to generate embeddings for a given text",
|
||||
"type": "OpenAIEmbeddings | Embeddings"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": -111.82510263637522,
|
||||
"y": -224.88655030419665
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 606,
|
||||
"id": "pinecone_0",
|
||||
"position": {
|
||||
"x": 245.707825551803,
|
||||
"y": -176.9243551667388
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "pinecone_0",
|
||||
"label": "Pinecone",
|
||||
"version": 3,
|
||||
"name": "pinecone",
|
||||
"type": "Pinecone",
|
||||
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
|
||||
"category": "Vector Stores",
|
||||
"description": "Upsert embedded data and perform similarity or mmr search using Pinecone, a leading fully managed hosted vector database",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Connect Credential",
|
||||
"name": "credential",
|
||||
"type": "credential",
|
||||
"credentialNames": ["pineconeApi"],
|
||||
"id": "pinecone_0-input-credential-credential"
|
||||
},
|
||||
{
|
||||
"label": "Pinecone Index",
|
||||
"name": "pineconeIndex",
|
||||
"type": "string",
|
||||
"id": "pinecone_0-input-pineconeIndex-string"
|
||||
},
|
||||
{
|
||||
"label": "Pinecone Namespace",
|
||||
"name": "pineconeNamespace",
|
||||
"type": "string",
|
||||
"placeholder": "my-first-namespace",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "pinecone_0-input-pineconeNamespace-string"
|
||||
},
|
||||
{
|
||||
"label": "Pinecone Metadata Filter",
|
||||
"name": "pineconeMetadataFilter",
|
||||
"type": "json",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "pinecone_0-input-pineconeMetadataFilter-json"
|
||||
},
|
||||
{
|
||||
"label": "Top K",
|
||||
"name": "topK",
|
||||
"description": "Number of top results to fetch. Default to 4",
|
||||
"placeholder": "4",
|
||||
"type": "number",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "pinecone_0-input-topK-number"
|
||||
},
|
||||
{
|
||||
"label": "Search Type",
|
||||
"name": "searchType",
|
||||
"type": "options",
|
||||
"default": "similarity",
|
||||
"options": [
|
||||
{
|
||||
"label": "Similarity",
|
||||
"name": "similarity"
|
||||
},
|
||||
{
|
||||
"label": "Max Marginal Relevance",
|
||||
"name": "mmr"
|
||||
}
|
||||
],
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "pinecone_0-input-searchType-options"
|
||||
},
|
||||
{
|
||||
"label": "Fetch K (for MMR Search)",
|
||||
"name": "fetchK",
|
||||
"description": "Number of initial documents to fetch for MMR reranking. Default to 20. Used only when the search type is MMR",
|
||||
"placeholder": "20",
|
||||
"type": "number",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "pinecone_0-input-fetchK-number"
|
||||
},
|
||||
{
|
||||
"label": "Lambda (for MMR Search)",
|
||||
"name": "lambda",
|
||||
"description": "Number between 0 and 1 that determines the degree of diversity among the results, where 0 corresponds to maximum diversity and 1 to minimum diversity. Used only when the search type is MMR",
|
||||
"placeholder": "0.5",
|
||||
"type": "number",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "pinecone_0-input-lambda-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Document",
|
||||
"name": "document",
|
||||
"type": "Document",
|
||||
"list": true,
|
||||
"optional": true,
|
||||
"id": "pinecone_0-input-document-Document"
|
||||
},
|
||||
{
|
||||
"label": "Embeddings",
|
||||
"name": "embeddings",
|
||||
"type": "Embeddings",
|
||||
"id": "pinecone_0-input-embeddings-Embeddings"
|
||||
},
|
||||
{
|
||||
"label": "Record Manager",
|
||||
"name": "recordManager",
|
||||
"type": "RecordManager",
|
||||
"description": "Keep track of the record to prevent duplication",
|
||||
"optional": true,
|
||||
"id": "pinecone_0-input-recordManager-RecordManager"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"document": "",
|
||||
"embeddings": "{{openAIEmbeddings_0.data.instance}}",
|
||||
"recordManager": "",
|
||||
"pineconeIndex": "",
|
||||
"pineconeNamespace": "",
|
||||
"pineconeMetadataFilter": "",
|
||||
"topK": "",
|
||||
"searchType": "similarity",
|
||||
"fetchK": "",
|
||||
"lambda": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"name": "output",
|
||||
"label": "Output",
|
||||
"type": "options",
|
||||
"description": "",
|
||||
"options": [
|
||||
{
|
||||
"id": "pinecone_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever",
|
||||
"name": "retriever",
|
||||
"label": "Pinecone Retriever",
|
||||
"description": "",
|
||||
"type": "Pinecone | VectorStoreRetriever | BaseRetriever"
|
||||
},
|
||||
{
|
||||
"id": "pinecone_0-output-vectorStore-Pinecone|VectorStore",
|
||||
"name": "vectorStore",
|
||||
"label": "Pinecone Vector Store",
|
||||
"description": "",
|
||||
"type": "Pinecone | VectorStore"
|
||||
}
|
||||
],
|
||||
"default": "retriever"
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"output": "vectorStore"
|
||||
},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 245.707825551803,
|
||||
"y": -176.9243551667388
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 670,
|
||||
"id": "chatOpenAI_0",
|
||||
"position": {
|
||||
"x": 597.7565040390853,
|
||||
"y": -381.01461408909825
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "chatOpenAI_0",
|
||||
"label": "ChatOpenAI",
|
||||
"version": 6,
|
||||
"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": "asyncOptions",
|
||||
"loadMethod": "listModels",
|
||||
"default": "gpt-3.5-turbo",
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"label": "Allow Image Uploads",
|
||||
"name": "allowImageUploads",
|
||||
"type": "boolean",
|
||||
"description": "Automatically uses gpt-4-vision-preview when image is being uploaded from chat. Only works with LLMChain, Conversation Chain, ReAct Agent, and Conversational Agent",
|
||||
"default": false,
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_0-input-allowImageUploads-boolean"
|
||||
},
|
||||
{
|
||||
"label": "Image Resolution",
|
||||
"description": "This parameter controls the resolution in which the model views the image.",
|
||||
"name": "imageResolution",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "Low",
|
||||
"name": "low"
|
||||
},
|
||||
{
|
||||
"label": "High",
|
||||
"name": "high"
|
||||
},
|
||||
{
|
||||
"label": "Auto",
|
||||
"name": "auto"
|
||||
}
|
||||
],
|
||||
"default": "low",
|
||||
"optional": false,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-imageResolution-options"
|
||||
}
|
||||
],
|
||||
"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": "",
|
||||
"allowImageUploads": true,
|
||||
"imageResolution": "low"
|
||||
},
|
||||
"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": 597.7565040390853,
|
||||
"y": -381.01461408909825
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"id": "stickyNote_0",
|
||||
"position": {
|
||||
"x": 949.0763123880214,
|
||||
"y": -172.0310628893923
|
||||
},
|
||||
"type": "stickyNote",
|
||||
"data": {
|
||||
"id": "stickyNote_0",
|
||||
"label": "Sticky Note",
|
||||
"version": 2,
|
||||
"name": "stickyNote",
|
||||
"type": "StickyNote",
|
||||
"baseClasses": ["StickyNote"],
|
||||
"tags": ["Utilities"],
|
||||
"category": "Utilities",
|
||||
"description": "Add a sticky note",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "",
|
||||
"name": "note",
|
||||
"type": "string",
|
||||
"rows": 1,
|
||||
"placeholder": "Type something here",
|
||||
"optional": true,
|
||||
"id": "stickyNote_0-input-note-string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"note": "BabyAGI is made up of 3 components:\n\n- A chain responsible for creating tasks\n- A chain responsible for prioritising tasks\n- A chain responsible for executing tasks\n\nThese chains are executed in sequence until the task list is empty or the maximum number of iterations is reached"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "stickyNote_0-output-stickyNote-StickyNote",
|
||||
"name": "stickyNote",
|
||||
"label": "StickyNote",
|
||||
"description": "Add a sticky note",
|
||||
"type": "StickyNote"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"width": 300,
|
||||
"height": 203,
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 949.0763123880214,
|
||||
"y": -172.0310628893923
|
||||
},
|
||||
"dragging": false
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"source": "openAIEmbeddings_0",
|
||||
"sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
|
||||
"target": "pinecone_0",
|
||||
"targetHandle": "pinecone_0-input-embeddings-Embeddings",
|
||||
"type": "buttonedge",
|
||||
"id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pinecone_0-pinecone_0-input-embeddings-Embeddings",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "chatOpenAI_0",
|
||||
"sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
|
||||
"target": "babyAGI_1",
|
||||
"targetHandle": "babyAGI_1-input-model-BaseChatModel",
|
||||
"type": "buttonedge",
|
||||
"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-babyAGI_1-babyAGI_1-input-model-BaseChatModel",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "pinecone_0",
|
||||
"sourceHandle": "pinecone_0-output-vectorStore-Pinecone|VectorStore",
|
||||
"target": "babyAGI_1",
|
||||
"targetHandle": "babyAGI_1-input-vectorStore-VectorStore",
|
||||
"type": "buttonedge",
|
||||
"id": "pinecone_0-pinecone_0-output-vectorStore-Pinecone|VectorStore-babyAGI_1-babyAGI_1-input-vectorStore-VectorStore",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,767 +0,0 @@
|
||||
{
|
||||
"description": "Tool Agent using OpenAPI yaml to automatically decide which API to call, generating url and body request from conversation",
|
||||
"framework": ["Langchain"],
|
||||
"usecases": ["Interacting with API"],
|
||||
"nodes": [
|
||||
{
|
||||
"width": 300,
|
||||
"height": 544,
|
||||
"id": "openApiChain_1",
|
||||
"position": {
|
||||
"x": 1203.1825726424859,
|
||||
"y": 300.7226683414998
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "openApiChain_1",
|
||||
"label": "OpenAPI Chain",
|
||||
"version": 2,
|
||||
"name": "openApiChain",
|
||||
"type": "OpenAPIChain",
|
||||
"baseClasses": ["OpenAPIChain", "BaseChain"],
|
||||
"category": "Chains",
|
||||
"description": "Chain that automatically select and call APIs based only on an OpenAPI spec",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "YAML Link",
|
||||
"name": "yamlLink",
|
||||
"type": "string",
|
||||
"placeholder": "https://api.speak.com/openapi.yaml",
|
||||
"description": "If YAML link is provided, uploaded YAML File will be ignored and YAML link will be used instead",
|
||||
"id": "openApiChain_1-input-yamlLink-string"
|
||||
},
|
||||
{
|
||||
"label": "YAML File",
|
||||
"name": "yamlFile",
|
||||
"type": "file",
|
||||
"fileType": ".yaml",
|
||||
"description": "If YAML link is provided, uploaded YAML File will be ignored and YAML link will be used instead",
|
||||
"id": "openApiChain_1-input-yamlFile-file"
|
||||
},
|
||||
{
|
||||
"label": "Headers",
|
||||
"name": "headers",
|
||||
"type": "json",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "openApiChain_1-input-headers-json"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "ChatOpenAI Model",
|
||||
"name": "model",
|
||||
"type": "ChatOpenAI",
|
||||
"id": "openApiChain_1-input-model-ChatOpenAI"
|
||||
},
|
||||
{
|
||||
"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": "openApiChain_1-input-inputModeration-Moderation"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"inputModeration": "",
|
||||
"model": "{{chatOpenAI_1.data.instance}}",
|
||||
"yamlLink": "https://gist.githubusercontent.com/HenryHengZJ/b60f416c42cb9bcd3160fe797421119a/raw/0ef05b3aaf142e0423f71c19dec866178487dc10/klarna.yml",
|
||||
"headers": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "openApiChain_1-output-openApiChain-OpenAPIChain|BaseChain",
|
||||
"name": "openApiChain",
|
||||
"label": "OpenAPIChain",
|
||||
"type": "OpenAPIChain | BaseChain"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1203.1825726424859,
|
||||
"y": 300.7226683414998
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 670,
|
||||
"id": "chatOpenAI_1",
|
||||
"position": {
|
||||
"x": 792.3201947594027,
|
||||
"y": 293.61889966751846
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "chatOpenAI_1",
|
||||
"label": "ChatOpenAI",
|
||||
"version": 6,
|
||||
"name": "chatOpenAI",
|
||||
"type": "ChatOpenAI",
|
||||
"baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"],
|
||||
"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": "asyncOptions",
|
||||
"loadMethod": "listModels",
|
||||
"default": "gpt-3.5-turbo",
|
||||
"id": "chatOpenAI_1-input-modelName-options"
|
||||
},
|
||||
{
|
||||
"label": "Temperature",
|
||||
"name": "temperature",
|
||||
"type": "number",
|
||||
"default": 0.9,
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_1-input-temperature-number"
|
||||
},
|
||||
{
|
||||
"label": "Max Tokens",
|
||||
"name": "maxTokens",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_1-input-maxTokens-number"
|
||||
},
|
||||
{
|
||||
"label": "Top Probability",
|
||||
"name": "topP",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_1-input-topP-number"
|
||||
},
|
||||
{
|
||||
"label": "Frequency Penalty",
|
||||
"name": "frequencyPenalty",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_1-input-frequencyPenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Presence Penalty",
|
||||
"name": "presencePenalty",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_1-input-presencePenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Timeout",
|
||||
"name": "timeout",
|
||||
"type": "number",
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"label": "Allow Image Uploads",
|
||||
"name": "allowImageUploads",
|
||||
"type": "boolean",
|
||||
"description": "Automatically uses gpt-4-vision-preview when image is being uploaded from chat. Only works with LLMChain, Conversation Chain, ReAct Agent, and Conversational Agent",
|
||||
"default": false,
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_1-input-allowImageUploads-boolean"
|
||||
},
|
||||
{
|
||||
"label": "Image Resolution",
|
||||
"description": "This parameter controls the resolution in which the model views the image.",
|
||||
"name": "imageResolution",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "Low",
|
||||
"name": "low"
|
||||
},
|
||||
{
|
||||
"label": "High",
|
||||
"name": "high"
|
||||
},
|
||||
{
|
||||
"label": "Auto",
|
||||
"name": "auto"
|
||||
}
|
||||
],
|
||||
"default": "low",
|
||||
"optional": false,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_1-input-imageResolution-options"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Cache",
|
||||
"name": "cache",
|
||||
"type": "BaseCache",
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_1-input-cache-BaseCache"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"modelName": "gpt-3.5-turbo",
|
||||
"temperature": 0.9,
|
||||
"maxTokens": "",
|
||||
"topP": "",
|
||||
"frequencyPenalty": "",
|
||||
"presencePenalty": "",
|
||||
"timeout": "",
|
||||
"basepath": "",
|
||||
"baseOptions": "",
|
||||
"allowImageUploads": true,
|
||||
"imageResolution": "low"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"name": "chatOpenAI",
|
||||
"label": "ChatOpenAI",
|
||||
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 792.3201947594027,
|
||||
"y": 293.61889966751846
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 603,
|
||||
"id": "chainTool_0",
|
||||
"position": {
|
||||
"x": 1635.3466862861876,
|
||||
"y": 272.3189405402944
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "chainTool_0",
|
||||
"label": "Chain Tool",
|
||||
"version": 1,
|
||||
"name": "chainTool",
|
||||
"type": "ChainTool",
|
||||
"baseClasses": ["ChainTool", "DynamicTool", "Tool", "StructuredTool"],
|
||||
"category": "Tools",
|
||||
"description": "Use a chain as allowed tool for agent",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Chain Name",
|
||||
"name": "name",
|
||||
"type": "string",
|
||||
"placeholder": "state-of-union-qa",
|
||||
"id": "chainTool_0-input-name-string"
|
||||
},
|
||||
{
|
||||
"label": "Chain Description",
|
||||
"name": "description",
|
||||
"type": "string",
|
||||
"rows": 3,
|
||||
"placeholder": "State of the Union QA - useful for when you need to ask questions about the most recent state of the union address.",
|
||||
"id": "chainTool_0-input-description-string"
|
||||
},
|
||||
{
|
||||
"label": "Return Direct",
|
||||
"name": "returnDirect",
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"id": "chainTool_0-input-returnDirect-boolean"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Base Chain",
|
||||
"name": "baseChain",
|
||||
"type": "BaseChain",
|
||||
"id": "chainTool_0-input-baseChain-BaseChain"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"name": "shopping-qa",
|
||||
"description": "useful for when you need to search for e-commerce products like shirt, pants, dress, glasses, etc.",
|
||||
"returnDirect": false,
|
||||
"baseChain": "{{openApiChain_1.data.instance}}"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "chainTool_0-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool",
|
||||
"name": "chainTool",
|
||||
"label": "ChainTool",
|
||||
"type": "ChainTool | DynamicTool | Tool | StructuredTool"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1635.3466862861876,
|
||||
"y": 272.3189405402944
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 670,
|
||||
"id": "chatOpenAI_2",
|
||||
"position": {
|
||||
"x": 1566.5049234393214,
|
||||
"y": 920.3787183665902
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "chatOpenAI_2",
|
||||
"label": "ChatOpenAI",
|
||||
"version": 6,
|
||||
"name": "chatOpenAI",
|
||||
"type": "ChatOpenAI",
|
||||
"baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"],
|
||||
"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": "asyncOptions",
|
||||
"loadMethod": "listModels",
|
||||
"default": "gpt-3.5-turbo",
|
||||
"id": "chatOpenAI_2-input-modelName-options"
|
||||
},
|
||||
{
|
||||
"label": "Temperature",
|
||||
"name": "temperature",
|
||||
"type": "number",
|
||||
"default": 0.9,
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_2-input-temperature-number"
|
||||
},
|
||||
{
|
||||
"label": "Max Tokens",
|
||||
"name": "maxTokens",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_2-input-maxTokens-number"
|
||||
},
|
||||
{
|
||||
"label": "Top Probability",
|
||||
"name": "topP",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_2-input-topP-number"
|
||||
},
|
||||
{
|
||||
"label": "Frequency Penalty",
|
||||
"name": "frequencyPenalty",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_2-input-frequencyPenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Presence Penalty",
|
||||
"name": "presencePenalty",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_2-input-presencePenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Timeout",
|
||||
"name": "timeout",
|
||||
"type": "number",
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"label": "Allow Image Uploads",
|
||||
"name": "allowImageUploads",
|
||||
"type": "boolean",
|
||||
"description": "Automatically uses gpt-4-vision-preview when image is being uploaded from chat. Only works with LLMChain, Conversation Chain, ReAct Agent, and Conversational Agent",
|
||||
"default": false,
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_2-input-allowImageUploads-boolean"
|
||||
},
|
||||
{
|
||||
"label": "Image Resolution",
|
||||
"description": "This parameter controls the resolution in which the model views the image.",
|
||||
"name": "imageResolution",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "Low",
|
||||
"name": "low"
|
||||
},
|
||||
{
|
||||
"label": "High",
|
||||
"name": "high"
|
||||
},
|
||||
{
|
||||
"label": "Auto",
|
||||
"name": "auto"
|
||||
}
|
||||
],
|
||||
"default": "low",
|
||||
"optional": false,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_2-input-imageResolution-options"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Cache",
|
||||
"name": "cache",
|
||||
"type": "BaseCache",
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_2-input-cache-BaseCache"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"modelName": "gpt-3.5-turbo",
|
||||
"temperature": 0.9,
|
||||
"maxTokens": "",
|
||||
"topP": "",
|
||||
"frequencyPenalty": "",
|
||||
"presencePenalty": "",
|
||||
"timeout": "",
|
||||
"basepath": "",
|
||||
"baseOptions": "",
|
||||
"allowImageUploads": true,
|
||||
"imageResolution": "low"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"name": "chatOpenAI",
|
||||
"label": "ChatOpenAI",
|
||||
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1566.5049234393214,
|
||||
"y": 920.3787183665902
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 253,
|
||||
"id": "bufferMemory_0",
|
||||
"position": {
|
||||
"x": 1148.8461056155377,
|
||||
"y": 967.8215757228843
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "bufferMemory_0",
|
||||
"label": "Buffer Memory",
|
||||
"version": 2,
|
||||
"name": "bufferMemory",
|
||||
"type": "BufferMemory",
|
||||
"baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"],
|
||||
"category": "Memory",
|
||||
"description": "Retrieve chat messages stored in database",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Session Id",
|
||||
"name": "sessionId",
|
||||
"type": "string",
|
||||
"description": "If not specified, a random id will be used. Learn <a target=\"_blank\" href=\"https://docs.flowiseai.com/memory#ui-and-embedded-chat\">more</a>",
|
||||
"default": "",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "bufferMemory_0-input-sessionId-string"
|
||||
},
|
||||
{
|
||||
"label": "Memory Key",
|
||||
"name": "memoryKey",
|
||||
"type": "string",
|
||||
"default": "chat_history",
|
||||
"additionalParams": true,
|
||||
"id": "bufferMemory_0-input-memoryKey-string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"sessionId": "",
|
||||
"memoryKey": "chat_history"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory",
|
||||
"name": "bufferMemory",
|
||||
"label": "BufferMemory",
|
||||
"type": "BufferMemory | BaseChatMemory | BaseMemory"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"positionAbsolute": {
|
||||
"x": 1148.8461056155377,
|
||||
"y": 967.8215757228843
|
||||
},
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"id": "toolAgent_0",
|
||||
"position": {
|
||||
"x": 2054.7555242376347,
|
||||
"y": 710.4140533942601
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "toolAgent_0",
|
||||
"label": "Tool Agent",
|
||||
"version": 1,
|
||||
"name": "toolAgent",
|
||||
"type": "AgentExecutor",
|
||||
"baseClasses": ["AgentExecutor", "BaseChain", "Runnable"],
|
||||
"category": "Agents",
|
||||
"description": "Agent that uses Function Calling to pick the tools and args to call",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "System Message",
|
||||
"name": "systemMessage",
|
||||
"type": "string",
|
||||
"default": "You are a helpful AI assistant.",
|
||||
"rows": 4,
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "toolAgent_0-input-systemMessage-string"
|
||||
},
|
||||
{
|
||||
"label": "Max Iterations",
|
||||
"name": "maxIterations",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "toolAgent_0-input-maxIterations-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Tools",
|
||||
"name": "tools",
|
||||
"type": "Tool",
|
||||
"list": true,
|
||||
"id": "toolAgent_0-input-tools-Tool"
|
||||
},
|
||||
{
|
||||
"label": "Memory",
|
||||
"name": "memory",
|
||||
"type": "BaseChatMemory",
|
||||
"id": "toolAgent_0-input-memory-BaseChatMemory"
|
||||
},
|
||||
{
|
||||
"label": "Tool Calling Chat Model",
|
||||
"name": "model",
|
||||
"type": "BaseChatModel",
|
||||
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, ChatVertexAI, GroqChat",
|
||||
"id": "toolAgent_0-input-model-BaseChatModel"
|
||||
},
|
||||
{
|
||||
"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": "toolAgent_0-input-inputModeration-Moderation"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"tools": ["{{chainTool_0.data.instance}}"],
|
||||
"memory": "{{bufferMemory_0.data.instance}}",
|
||||
"model": "{{chatOpenAI_2.data.instance}}",
|
||||
"systemMessage": "You are a helpful AI assistant.",
|
||||
"inputModeration": "",
|
||||
"maxIterations": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "toolAgent_0-output-toolAgent-AgentExecutor|BaseChain|Runnable",
|
||||
"name": "toolAgent",
|
||||
"label": "AgentExecutor",
|
||||
"description": "Agent that uses Function Calling to pick the tools and args to call",
|
||||
"type": "AgentExecutor | BaseChain | Runnable"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"width": 300,
|
||||
"height": 435,
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 2054.7555242376347,
|
||||
"y": 710.4140533942601
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"id": "stickyNote_0",
|
||||
"position": {
|
||||
"x": 2046.8203973748023,
|
||||
"y": 399.1483966834255
|
||||
},
|
||||
"type": "stickyNote",
|
||||
"data": {
|
||||
"id": "stickyNote_0",
|
||||
"label": "Sticky Note",
|
||||
"version": 2,
|
||||
"name": "stickyNote",
|
||||
"type": "StickyNote",
|
||||
"baseClasses": ["StickyNote"],
|
||||
"tags": ["Utilities"],
|
||||
"category": "Utilities",
|
||||
"description": "Add a sticky note",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "",
|
||||
"name": "note",
|
||||
"type": "string",
|
||||
"rows": 1,
|
||||
"placeholder": "Type something here",
|
||||
"optional": true,
|
||||
"id": "stickyNote_0-input-note-string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"note": "Using agent, we give it a tool that is attached to an OpenAPI Chain.\n\nOpenAPI Chain uses a LLM to automatically figure out what is the correct URL and params to call given the YML spec file.\n\nResults are then fetched back to agent.\n\nExample question:\nI am looking for some blue tshirt, can u help me find some?"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "stickyNote_0-output-stickyNote-StickyNote",
|
||||
"name": "stickyNote",
|
||||
"label": "StickyNote",
|
||||
"description": "Add a sticky note",
|
||||
"type": "StickyNote"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"width": 300,
|
||||
"height": 284,
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 2046.8203973748023,
|
||||
"y": 399.1483966834255
|
||||
},
|
||||
"dragging": false
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"source": "chatOpenAI_1",
|
||||
"sourceHandle": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"target": "openApiChain_1",
|
||||
"targetHandle": "openApiChain_1-input-model-ChatOpenAI",
|
||||
"type": "buttonedge",
|
||||
"id": "chatOpenAI_1-chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-openApiChain_1-openApiChain_1-input-model-ChatOpenAI",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "openApiChain_1",
|
||||
"sourceHandle": "openApiChain_1-output-openApiChain-OpenAPIChain|BaseChain",
|
||||
"target": "chainTool_0",
|
||||
"targetHandle": "chainTool_0-input-baseChain-BaseChain",
|
||||
"type": "buttonedge",
|
||||
"id": "openApiChain_1-openApiChain_1-output-openApiChain-OpenAPIChain|BaseChain-chainTool_0-chainTool_0-input-baseChain-BaseChain",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "chainTool_0",
|
||||
"sourceHandle": "chainTool_0-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool",
|
||||
"target": "toolAgent_0",
|
||||
"targetHandle": "toolAgent_0-input-tools-Tool",
|
||||
"type": "buttonedge",
|
||||
"id": "chainTool_0-chainTool_0-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool-toolAgent_0-toolAgent_0-input-tools-Tool"
|
||||
},
|
||||
{
|
||||
"source": "chatOpenAI_2",
|
||||
"sourceHandle": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"target": "toolAgent_0",
|
||||
"targetHandle": "toolAgent_0-input-model-BaseChatModel",
|
||||
"type": "buttonedge",
|
||||
"id": "chatOpenAI_2-chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-toolAgent_0-toolAgent_0-input-model-BaseChatModel"
|
||||
},
|
||||
{
|
||||
"source": "bufferMemory_0",
|
||||
"sourceHandle": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory",
|
||||
"target": "toolAgent_0",
|
||||
"targetHandle": "toolAgent_0-input-memory-BaseChatMemory",
|
||||
"type": "buttonedge",
|
||||
"id": "bufferMemory_0-bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory-toolAgent_0-toolAgent_0-input-memory-BaseChatMemory"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,773 +0,0 @@
|
||||
{
|
||||
"description": "Conversational Agent with ability to visit a website and extract information",
|
||||
"usecases": ["Agent"],
|
||||
"framework": ["Langchain"],
|
||||
"nodes": [
|
||||
{
|
||||
"width": 300,
|
||||
"height": 253,
|
||||
"id": "bufferMemory_0",
|
||||
"position": {
|
||||
"x": 457.04304716743604,
|
||||
"y": 362.4048129799687
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "bufferMemory_0",
|
||||
"label": "Buffer Memory",
|
||||
"version": 2,
|
||||
"name": "bufferMemory",
|
||||
"type": "BufferMemory",
|
||||
"baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"],
|
||||
"category": "Memory",
|
||||
"description": "Retrieve chat messages stored in database",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Session Id",
|
||||
"name": "sessionId",
|
||||
"type": "string",
|
||||
"description": "If not specified, a random id will be used. Learn <a target=\"_blank\" href=\"https://docs.flowiseai.com/memory#ui-and-embedded-chat\">more</a>",
|
||||
"default": "",
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "bufferMemory_0-input-sessionId-string"
|
||||
},
|
||||
{
|
||||
"label": "Memory Key",
|
||||
"name": "memoryKey",
|
||||
"type": "string",
|
||||
"default": "chat_history",
|
||||
"additionalParams": true,
|
||||
"id": "bufferMemory_0-input-memoryKey-string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"sessionId": "",
|
||||
"memoryKey": "chat_history"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory",
|
||||
"name": "bufferMemory",
|
||||
"label": "BufferMemory",
|
||||
"type": "BufferMemory | BaseChatMemory | BaseMemory"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 457.04304716743604,
|
||||
"y": 362.4048129799687
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 281,
|
||||
"id": "webBrowser_0",
|
||||
"position": {
|
||||
"x": 1091.0866823400172,
|
||||
"y": -16.43806989958216
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "webBrowser_0",
|
||||
"label": "Web Browser",
|
||||
"version": 1,
|
||||
"name": "webBrowser",
|
||||
"type": "WebBrowser",
|
||||
"baseClasses": ["WebBrowser", "Tool", "StructuredTool", "BaseLangChain"],
|
||||
"category": "Tools",
|
||||
"description": "Gives agent the ability to visit a website and extract information",
|
||||
"inputParams": [],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Language Model",
|
||||
"name": "model",
|
||||
"type": "BaseLanguageModel",
|
||||
"id": "webBrowser_0-input-model-BaseLanguageModel"
|
||||
},
|
||||
{
|
||||
"label": "Embeddings",
|
||||
"name": "embeddings",
|
||||
"type": "Embeddings",
|
||||
"id": "webBrowser_0-input-embeddings-Embeddings"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"model": "{{chatOpenAI_0.data.instance}}",
|
||||
"embeddings": "{{openAIEmbeddings_0.data.instance}}"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "webBrowser_0-output-webBrowser-WebBrowser|Tool|StructuredTool|BaseLangChain",
|
||||
"name": "webBrowser",
|
||||
"label": "WebBrowser",
|
||||
"type": "WebBrowser | Tool | StructuredTool | BaseLangChain"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1091.0866823400172,
|
||||
"y": -16.43806989958216
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 670,
|
||||
"id": "chatOpenAI_0",
|
||||
"position": {
|
||||
"x": 741.9540879250319,
|
||||
"y": -534.6535148852278
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "chatOpenAI_0",
|
||||
"label": "ChatOpenAI",
|
||||
"version": 6,
|
||||
"name": "chatOpenAI",
|
||||
"type": "ChatOpenAI",
|
||||
"baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"],
|
||||
"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": "asyncOptions",
|
||||
"loadMethod": "listModels",
|
||||
"default": "gpt-3.5-turbo",
|
||||
"id": "chatOpenAI_0-input-modelName-options"
|
||||
},
|
||||
{
|
||||
"label": "Temperature",
|
||||
"name": "temperature",
|
||||
"type": "number",
|
||||
"default": 0.9,
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_0-input-temperature-number"
|
||||
},
|
||||
{
|
||||
"label": "Max Tokens",
|
||||
"name": "maxTokens",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-maxTokens-number"
|
||||
},
|
||||
{
|
||||
"label": "Top Probability",
|
||||
"name": "topP",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-topP-number"
|
||||
},
|
||||
{
|
||||
"label": "Frequency Penalty",
|
||||
"name": "frequencyPenalty",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-frequencyPenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Presence Penalty",
|
||||
"name": "presencePenalty",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-presencePenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Timeout",
|
||||
"name": "timeout",
|
||||
"type": "number",
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"label": "Allow Image Uploads",
|
||||
"name": "allowImageUploads",
|
||||
"type": "boolean",
|
||||
"description": "Automatically uses gpt-4-vision-preview when image is being uploaded from chat. Only works with LLMChain, Conversation Chain, ReAct Agent, and Conversational Agent",
|
||||
"default": false,
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_0-input-allowImageUploads-boolean"
|
||||
},
|
||||
{
|
||||
"label": "Image Resolution",
|
||||
"description": "This parameter controls the resolution in which the model views the image.",
|
||||
"name": "imageResolution",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "Low",
|
||||
"name": "low"
|
||||
},
|
||||
{
|
||||
"label": "High",
|
||||
"name": "high"
|
||||
},
|
||||
{
|
||||
"label": "Auto",
|
||||
"name": "auto"
|
||||
}
|
||||
],
|
||||
"default": "low",
|
||||
"optional": false,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-imageResolution-options"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Cache",
|
||||
"name": "cache",
|
||||
"type": "BaseCache",
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_0-input-cache-BaseCache"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"modelName": "gpt-3.5-turbo",
|
||||
"temperature": 0.9,
|
||||
"maxTokens": "",
|
||||
"topP": "",
|
||||
"frequencyPenalty": "",
|
||||
"presencePenalty": "",
|
||||
"timeout": "",
|
||||
"basepath": "",
|
||||
"baseOptions": "",
|
||||
"allowImageUploads": true,
|
||||
"imageResolution": "low"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"name": "chatOpenAI",
|
||||
"label": "ChatOpenAI",
|
||||
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 741.9540879250319,
|
||||
"y": -534.6535148852278
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 424,
|
||||
"id": "openAIEmbeddings_0",
|
||||
"position": {
|
||||
"x": 403.72014625628697,
|
||||
"y": -103.82540449681527
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "openAIEmbeddings_0",
|
||||
"label": "OpenAI Embeddings",
|
||||
"version": 4,
|
||||
"name": "openAIEmbeddings",
|
||||
"type": "OpenAIEmbeddings",
|
||||
"baseClasses": ["OpenAIEmbeddings", "Embeddings"],
|
||||
"category": "Embeddings",
|
||||
"description": "OpenAI API to generate embeddings for a given text",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Connect Credential",
|
||||
"name": "credential",
|
||||
"type": "credential",
|
||||
"credentialNames": ["openAIApi"],
|
||||
"id": "openAIEmbeddings_0-input-credential-credential"
|
||||
},
|
||||
{
|
||||
"label": "Model Name",
|
||||
"name": "modelName",
|
||||
"type": "asyncOptions",
|
||||
"loadMethod": "listModels",
|
||||
"default": "text-embedding-ada-002",
|
||||
"id": "openAIEmbeddings_0-input-modelName-asyncOptions"
|
||||
},
|
||||
{
|
||||
"label": "Strip New Lines",
|
||||
"name": "stripNewLines",
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-stripNewLines-boolean"
|
||||
},
|
||||
{
|
||||
"label": "Batch Size",
|
||||
"name": "batchSize",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-batchSize-number"
|
||||
},
|
||||
{
|
||||
"label": "Timeout",
|
||||
"name": "timeout",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-timeout-number"
|
||||
},
|
||||
{
|
||||
"label": "BasePath",
|
||||
"name": "basepath",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-basepath-string"
|
||||
},
|
||||
{
|
||||
"label": "Dimensions",
|
||||
"name": "dimensions",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-dimensions-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"modelName": "text-embedding-ada-002",
|
||||
"stripNewLines": "",
|
||||
"batchSize": "",
|
||||
"timeout": "",
|
||||
"basepath": "",
|
||||
"dimensions": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
|
||||
"name": "openAIEmbeddings",
|
||||
"label": "OpenAIEmbeddings",
|
||||
"description": "OpenAI API to generate embeddings for a given text",
|
||||
"type": "OpenAIEmbeddings | Embeddings"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 403.72014625628697,
|
||||
"y": -103.82540449681527
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 670,
|
||||
"id": "chatOpenAI_1",
|
||||
"position": {
|
||||
"x": 68.312124033115,
|
||||
"y": -239.65476709991256
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "chatOpenAI_1",
|
||||
"label": "ChatOpenAI",
|
||||
"version": 6,
|
||||
"name": "chatOpenAI",
|
||||
"type": "ChatOpenAI",
|
||||
"baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"],
|
||||
"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": "asyncOptions",
|
||||
"loadMethod": "listModels",
|
||||
"default": "gpt-3.5-turbo",
|
||||
"id": "chatOpenAI_1-input-modelName-options"
|
||||
},
|
||||
{
|
||||
"label": "Temperature",
|
||||
"name": "temperature",
|
||||
"type": "number",
|
||||
"default": 0.9,
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_1-input-temperature-number"
|
||||
},
|
||||
{
|
||||
"label": "Max Tokens",
|
||||
"name": "maxTokens",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_1-input-maxTokens-number"
|
||||
},
|
||||
{
|
||||
"label": "Top Probability",
|
||||
"name": "topP",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_1-input-topP-number"
|
||||
},
|
||||
{
|
||||
"label": "Frequency Penalty",
|
||||
"name": "frequencyPenalty",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_1-input-frequencyPenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Presence Penalty",
|
||||
"name": "presencePenalty",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_1-input-presencePenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Timeout",
|
||||
"name": "timeout",
|
||||
"type": "number",
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"label": "Allow Image Uploads",
|
||||
"name": "allowImageUploads",
|
||||
"type": "boolean",
|
||||
"description": "Automatically uses gpt-4-vision-preview when image is being uploaded from chat. Only works with LLMChain, Conversation Chain, ReAct Agent, and Conversational Agent",
|
||||
"default": false,
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_1-input-allowImageUploads-boolean"
|
||||
},
|
||||
{
|
||||
"label": "Image Resolution",
|
||||
"description": "This parameter controls the resolution in which the model views the image.",
|
||||
"name": "imageResolution",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "Low",
|
||||
"name": "low"
|
||||
},
|
||||
{
|
||||
"label": "High",
|
||||
"name": "high"
|
||||
},
|
||||
{
|
||||
"label": "Auto",
|
||||
"name": "auto"
|
||||
}
|
||||
],
|
||||
"default": "low",
|
||||
"optional": false,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_1-input-imageResolution-options"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Cache",
|
||||
"name": "cache",
|
||||
"type": "BaseCache",
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_1-input-cache-BaseCache"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"modelName": "gpt-3.5-turbo-16k",
|
||||
"temperature": 0.9,
|
||||
"maxTokens": "",
|
||||
"topP": "",
|
||||
"frequencyPenalty": "",
|
||||
"presencePenalty": "",
|
||||
"timeout": "",
|
||||
"basepath": "",
|
||||
"baseOptions": "",
|
||||
"allowImageUploads": true,
|
||||
"imageResolution": "low"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"name": "chatOpenAI",
|
||||
"label": "ChatOpenAI",
|
||||
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 68.312124033115,
|
||||
"y": -239.65476709991256
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 435,
|
||||
"id": "conversationalAgent_0",
|
||||
"position": {
|
||||
"x": 1518.944765840293,
|
||||
"y": 212.2513364217197
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "conversationalAgent_0",
|
||||
"label": "Conversational Agent",
|
||||
"version": 3,
|
||||
"name": "conversationalAgent",
|
||||
"type": "AgentExecutor",
|
||||
"baseClasses": ["AgentExecutor", "BaseChain", "Runnable"],
|
||||
"category": "Agents",
|
||||
"description": "Conversational agent for a chat model. It will utilize chat specific prompts",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "System Message",
|
||||
"name": "systemMessage",
|
||||
"type": "string",
|
||||
"rows": 4,
|
||||
"default": "Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "conversationalAgent_0-input-systemMessage-string"
|
||||
},
|
||||
{
|
||||
"label": "Max Iterations",
|
||||
"name": "maxIterations",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "conversationalAgent_0-input-maxIterations-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Allowed Tools",
|
||||
"name": "tools",
|
||||
"type": "Tool",
|
||||
"list": true,
|
||||
"id": "conversationalAgent_0-input-tools-Tool"
|
||||
},
|
||||
{
|
||||
"label": "Chat Model",
|
||||
"name": "model",
|
||||
"type": "BaseChatModel",
|
||||
"id": "conversationalAgent_0-input-model-BaseChatModel"
|
||||
},
|
||||
{
|
||||
"label": "Memory",
|
||||
"name": "memory",
|
||||
"type": "BaseChatMemory",
|
||||
"id": "conversationalAgent_0-input-memory-BaseChatMemory"
|
||||
},
|
||||
{
|
||||
"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": "conversationalAgent_0-input-inputModeration-Moderation"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"inputModeration": "",
|
||||
"tools": ["{{webBrowser_0.data.instance}}"],
|
||||
"model": "{{chatOpenAI_1.data.instance}}",
|
||||
"memory": "{{bufferMemory_0.data.instance}}",
|
||||
"systemMessage": "Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist."
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "conversationalAgent_0-output-conversationalAgent-AgentExecutor|BaseChain|Runnable",
|
||||
"name": "conversationalAgent",
|
||||
"label": "AgentExecutor",
|
||||
"type": "AgentExecutor | BaseChain | Runnable"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1518.944765840293,
|
||||
"y": 212.2513364217197
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"id": "stickyNote_0",
|
||||
"position": {
|
||||
"x": 1086.284843942572,
|
||||
"y": -110.93321070573408
|
||||
},
|
||||
"type": "stickyNote",
|
||||
"data": {
|
||||
"id": "stickyNote_0",
|
||||
"label": "Sticky Note",
|
||||
"version": 2,
|
||||
"name": "stickyNote",
|
||||
"type": "StickyNote",
|
||||
"baseClasses": ["StickyNote"],
|
||||
"tags": ["Utilities"],
|
||||
"category": "Utilities",
|
||||
"description": "Add a sticky note",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "",
|
||||
"name": "note",
|
||||
"type": "string",
|
||||
"rows": 1,
|
||||
"placeholder": "Type something here",
|
||||
"optional": true,
|
||||
"id": "stickyNote_0-input-note-string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"note": "Web Browser Tool gives agent the ability to visit a website and extract information"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "stickyNote_0-output-stickyNote-StickyNote",
|
||||
"name": "stickyNote",
|
||||
"label": "StickyNote",
|
||||
"description": "Add a sticky note",
|
||||
"type": "StickyNote"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"width": 300,
|
||||
"height": 62,
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1086.284843942572,
|
||||
"y": -110.93321070573408
|
||||
},
|
||||
"dragging": false
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"source": "openAIEmbeddings_0",
|
||||
"sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
|
||||
"target": "webBrowser_0",
|
||||
"targetHandle": "webBrowser_0-input-embeddings-Embeddings",
|
||||
"type": "buttonedge",
|
||||
"id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-webBrowser_0-webBrowser_0-input-embeddings-Embeddings",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "chatOpenAI_0",
|
||||
"sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"target": "webBrowser_0",
|
||||
"targetHandle": "webBrowser_0-input-model-BaseLanguageModel",
|
||||
"type": "buttonedge",
|
||||
"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-webBrowser_0-webBrowser_0-input-model-BaseLanguageModel",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "webBrowser_0",
|
||||
"sourceHandle": "webBrowser_0-output-webBrowser-WebBrowser|Tool|StructuredTool|BaseLangChain",
|
||||
"target": "conversationalAgent_0",
|
||||
"targetHandle": "conversationalAgent_0-input-tools-Tool",
|
||||
"type": "buttonedge",
|
||||
"id": "webBrowser_0-webBrowser_0-output-webBrowser-WebBrowser|Tool|StructuredTool|BaseLangChain-conversationalAgent_0-conversationalAgent_0-input-tools-Tool",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "chatOpenAI_1",
|
||||
"sourceHandle": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"target": "conversationalAgent_0",
|
||||
"targetHandle": "conversationalAgent_0-input-model-BaseChatModel",
|
||||
"type": "buttonedge",
|
||||
"id": "chatOpenAI_1-chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-conversationalAgent_0-conversationalAgent_0-input-model-BaseChatModel",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "bufferMemory_0",
|
||||
"sourceHandle": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory",
|
||||
"target": "conversationalAgent_0",
|
||||
"targetHandle": "conversationalAgent_0-input-memory-BaseChatMemory",
|
||||
"type": "buttonedge",
|
||||
"id": "bufferMemory_0-bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory-conversationalAgent_0-conversationalAgent_0-input-memory-BaseChatMemory",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -100,7 +100,7 @@
|
||||
"multer-s3": "^3.0.1",
|
||||
"mysql2": "^3.11.3",
|
||||
"flowise-nim-container-manager": "^1.0.11",
|
||||
"openai": "^4.82.0",
|
||||
"openai": "^4.96.0",
|
||||
"pg": "^8.11.1",
|
||||
"posthog-node": "^3.5.0",
|
||||
"prom-client": "^15.1.3",
|
||||
@@ -109,6 +109,7 @@
|
||||
"s3-streamlogger": "^1.11.0",
|
||||
"sanitize-html": "^2.11.0",
|
||||
"sqlite3": "^5.1.6",
|
||||
"turndown": "^7.2.0",
|
||||
"typeorm": "^0.3.6",
|
||||
"uuid": "^9.0.1",
|
||||
"winston": "^3.9.0"
|
||||
@@ -120,6 +121,7 @@
|
||||
"@types/multer": "^1.4.7",
|
||||
"@types/multer-s3": "^3.0.3",
|
||||
"@types/sanitize-html": "^2.9.5",
|
||||
"@types/turndown": "^5.0.5",
|
||||
"concurrently": "^7.1.0",
|
||||
"cypress": "^13.13.0",
|
||||
"nodemon": "^2.0.22",
|
||||
|
||||
@@ -2,8 +2,10 @@ import {
|
||||
IAction,
|
||||
ICommonObject,
|
||||
IFileUpload,
|
||||
IHumanInput,
|
||||
INode,
|
||||
INodeData as INodeDataFromComponent,
|
||||
INodeExecutionData,
|
||||
INodeParams,
|
||||
IServerSideEventStreamer
|
||||
} from 'flowise-components'
|
||||
@@ -13,10 +15,12 @@ import { Telemetry } from './utils/telemetry'
|
||||
|
||||
export type MessageType = 'apiMessage' | 'userMessage'
|
||||
|
||||
export type ChatflowType = 'CHATFLOW' | 'MULTIAGENT' | 'ASSISTANT'
|
||||
export type ChatflowType = 'CHATFLOW' | 'MULTIAGENT' | 'ASSISTANT' | 'AGENTFLOW'
|
||||
|
||||
export type AssistantType = 'CUSTOM' | 'OPENAI' | 'AZURE'
|
||||
|
||||
export type ExecutionState = 'INPROGRESS' | 'FINISHED' | 'ERROR' | 'TERMINATED' | 'TIMEOUT' | 'STOPPED'
|
||||
|
||||
export enum MODE {
|
||||
QUEUE = 'queue',
|
||||
MAIN = 'main'
|
||||
@@ -57,6 +61,7 @@ export interface IChatMessage {
|
||||
role: MessageType
|
||||
content: string
|
||||
chatflowid: string
|
||||
executionId?: string
|
||||
sourceDocuments?: string
|
||||
usedTools?: string
|
||||
fileAnnotations?: string
|
||||
@@ -140,6 +145,19 @@ export interface IUpsertHistory {
|
||||
date: Date
|
||||
}
|
||||
|
||||
export interface IExecution {
|
||||
id: string
|
||||
executionData: string
|
||||
state: ExecutionState
|
||||
agentflowId: string
|
||||
sessionId: string
|
||||
isPublic?: boolean
|
||||
action?: string
|
||||
createdDate: Date
|
||||
updatedDate: Date
|
||||
stoppedDate: Date
|
||||
}
|
||||
|
||||
export interface IComponentNodes {
|
||||
[key: string]: INode
|
||||
}
|
||||
@@ -187,6 +205,8 @@ export interface IReactFlowNode {
|
||||
height: number
|
||||
selected: boolean
|
||||
dragging: boolean
|
||||
parentNode?: string
|
||||
extent?: string
|
||||
}
|
||||
|
||||
export interface IReactFlowEdge {
|
||||
@@ -227,6 +247,14 @@ export interface IDepthQueue {
|
||||
[key: string]: number
|
||||
}
|
||||
|
||||
export interface IAgentflowExecutedData {
|
||||
nodeLabel: string
|
||||
nodeId: string
|
||||
data: INodeExecutionData
|
||||
previousNodeIds: string[]
|
||||
status?: ExecutionState
|
||||
}
|
||||
|
||||
export interface IMessage {
|
||||
message: string
|
||||
type: MessageType
|
||||
@@ -238,6 +266,7 @@ export interface IncomingInput {
|
||||
question: string
|
||||
overrideConfig?: ICommonObject
|
||||
chatId?: string
|
||||
sessionId?: string
|
||||
stopNodeId?: string
|
||||
uploads?: IFileUpload[]
|
||||
leadEmail?: string
|
||||
@@ -246,6 +275,12 @@ export interface IncomingInput {
|
||||
streaming?: boolean
|
||||
}
|
||||
|
||||
export interface IncomingAgentflowInput extends Omit<IncomingInput, 'question'> {
|
||||
question?: string
|
||||
form?: Record<string, any>
|
||||
humanInput?: IHumanInput
|
||||
}
|
||||
|
||||
export interface IActiveChatflows {
|
||||
[key: string]: {
|
||||
startingNodes: IReactFlowNode[]
|
||||
@@ -266,6 +301,7 @@ export interface IOverrideConfig {
|
||||
label: string
|
||||
name: string
|
||||
type: string
|
||||
schema?: ICommonObject[]
|
||||
}
|
||||
|
||||
export type ICredentialDataDecrypted = ICommonObject
|
||||
@@ -315,6 +351,8 @@ export interface IFlowConfig {
|
||||
chatHistory: IMessage[]
|
||||
apiMessageId: string
|
||||
overrideConfig?: ICommonObject
|
||||
state?: ICommonObject
|
||||
runtimeChatHistoryLength?: number
|
||||
}
|
||||
|
||||
export interface IPredictionQueueAppServer {
|
||||
@@ -333,7 +371,13 @@ export interface IExecuteFlowParams extends IPredictionQueueAppServer {
|
||||
isInternal: boolean
|
||||
signal?: AbortController
|
||||
files?: Express.Multer.File[]
|
||||
fileUploads?: IFileUpload[]
|
||||
uploadedFilesContent?: string
|
||||
isUpsert?: boolean
|
||||
isRecursive?: boolean
|
||||
parentExecutionId?: string
|
||||
iterationContext?: ICommonObject
|
||||
isTool?: boolean
|
||||
}
|
||||
|
||||
export interface INodeOverrides {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Request, Response, NextFunction } from 'express'
|
||||
import agentflowv2Service from '../../services/agentflowv2-generator'
|
||||
|
||||
const generateAgentflowv2 = async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
if (!req.body.question || !req.body.selectedChatModel) {
|
||||
throw new Error('Question and selectedChatModel are required')
|
||||
}
|
||||
const apiResponse = await agentflowv2Service.generateAgentflowv2(req.body.question, req.body.selectedChatModel)
|
||||
return res.json(apiResponse)
|
||||
} catch (error) {
|
||||
next(error)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
generateAgentflowv2
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
import { Request, Response, NextFunction } from 'express'
|
||||
import executionsService from '../../services/executions'
|
||||
import { ExecutionState } from '../../Interface'
|
||||
|
||||
const getExecutionById = async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
const executionId = req.params.id
|
||||
const execution = await executionsService.getExecutionById(executionId)
|
||||
return res.json(execution)
|
||||
} catch (error) {
|
||||
next(error)
|
||||
}
|
||||
}
|
||||
|
||||
const getPublicExecutionById = async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
const executionId = req.params.id
|
||||
const execution = await executionsService.getPublicExecutionById(executionId)
|
||||
return res.json(execution)
|
||||
} catch (error) {
|
||||
next(error)
|
||||
}
|
||||
}
|
||||
|
||||
const updateExecution = async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
const executionId = req.params.id
|
||||
const execution = await executionsService.updateExecution(executionId, req.body)
|
||||
return res.json(execution)
|
||||
} catch (error) {
|
||||
next(error)
|
||||
}
|
||||
}
|
||||
|
||||
const getAllExecutions = async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
// Extract all possible filters from query params
|
||||
const filters: any = {}
|
||||
|
||||
// ID filter
|
||||
if (req.query.id) filters.id = req.query.id as string
|
||||
|
||||
// Flow and session filters
|
||||
if (req.query.agentflowId) filters.agentflowId = req.query.agentflowId as string
|
||||
if (req.query.sessionId) filters.sessionId = req.query.sessionId as string
|
||||
|
||||
// State filter
|
||||
if (req.query.state) {
|
||||
const stateValue = req.query.state as string
|
||||
if (['INPROGRESS', 'FINISHED', 'ERROR', 'TERMINATED', 'TIMEOUT', 'STOPPED'].includes(stateValue)) {
|
||||
filters.state = stateValue as ExecutionState
|
||||
}
|
||||
}
|
||||
|
||||
// Date filters
|
||||
if (req.query.startDate) {
|
||||
filters.startDate = new Date(req.query.startDate as string)
|
||||
}
|
||||
|
||||
if (req.query.endDate) {
|
||||
filters.endDate = new Date(req.query.endDate as string)
|
||||
}
|
||||
|
||||
// Pagination
|
||||
if (req.query.page) {
|
||||
filters.page = parseInt(req.query.page as string, 10)
|
||||
}
|
||||
|
||||
if (req.query.limit) {
|
||||
filters.limit = parseInt(req.query.limit as string, 10)
|
||||
}
|
||||
|
||||
const apiResponse = await executionsService.getAllExecutions(filters)
|
||||
|
||||
return res.json(apiResponse)
|
||||
} catch (error) {
|
||||
next(error)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete multiple executions by their IDs
|
||||
* If a single ID is provided in the URL params, it will delete that execution
|
||||
* If an array of IDs is provided in the request body, it will delete all those executions
|
||||
*/
|
||||
const deleteExecutions = async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
let executionIds: string[] = []
|
||||
|
||||
// Check if we're deleting a single execution from URL param
|
||||
if (req.params.id) {
|
||||
executionIds = [req.params.id]
|
||||
}
|
||||
// Check if we're deleting multiple executions from request body
|
||||
else if (req.body.executionIds && Array.isArray(req.body.executionIds)) {
|
||||
executionIds = req.body.executionIds
|
||||
} else {
|
||||
return res.status(400).json({ success: false, message: 'No execution IDs provided' })
|
||||
}
|
||||
|
||||
const result = await executionsService.deleteExecutions(executionIds)
|
||||
return res.json(result)
|
||||
} catch (error) {
|
||||
next(error)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
getAllExecutions,
|
||||
deleteExecutions,
|
||||
getExecutionById,
|
||||
getPublicExecutionById,
|
||||
updateExecution
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Request, Response, NextFunction } from 'express'
|
||||
import validationService from '../../services/validation'
|
||||
import { InternalFlowiseError } from '../../errors/internalFlowiseError'
|
||||
import { StatusCodes } from 'http-status-codes'
|
||||
|
||||
const checkFlowValidation = async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
const flowId = req.params?.id as string | undefined
|
||||
if (!flowId) {
|
||||
throw new InternalFlowiseError(
|
||||
StatusCodes.PRECONDITION_FAILED,
|
||||
`Error: validationController.checkFlowValidation - id not provided!`
|
||||
)
|
||||
}
|
||||
const apiResponse = await validationService.checkFlowValidation(flowId)
|
||||
return res.json(apiResponse)
|
||||
} catch (error) {
|
||||
next(error)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
checkFlowValidation
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable */
|
||||
import { Entity, Column, CreateDateColumn, PrimaryGeneratedColumn, Index } from 'typeorm'
|
||||
import { Entity, Column, CreateDateColumn, PrimaryGeneratedColumn, Index, JoinColumn, OneToOne } from 'typeorm'
|
||||
import { IChatMessage, MessageType } from '../../Interface'
|
||||
import { Execution } from './Execution'
|
||||
|
||||
@Entity()
|
||||
export class ChatMessage implements IChatMessage {
|
||||
@@ -14,6 +15,13 @@ export class ChatMessage implements IChatMessage {
|
||||
@Column({ type: 'uuid' })
|
||||
chatflowid: string
|
||||
|
||||
@Column({ nullable: true, type: 'uuid' })
|
||||
executionId?: string
|
||||
|
||||
@OneToOne(() => Execution)
|
||||
@JoinColumn({ name: 'executionId' })
|
||||
execution: Execution
|
||||
|
||||
@Column({ type: 'text' })
|
||||
content: string
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import { Entity, Column, Index, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn, ManyToOne, JoinColumn } from 'typeorm'
|
||||
import { IExecution, ExecutionState } from '../../Interface'
|
||||
import { ChatFlow } from './ChatFlow'
|
||||
|
||||
@Entity()
|
||||
export class Execution implements IExecution {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string
|
||||
|
||||
@Column({ type: 'text' })
|
||||
executionData: string
|
||||
|
||||
@Column()
|
||||
state: ExecutionState
|
||||
|
||||
@Index()
|
||||
@Column({ type: 'uuid' })
|
||||
agentflowId: string
|
||||
|
||||
@Index()
|
||||
@Column({ type: 'uuid' })
|
||||
sessionId: string
|
||||
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
action?: string
|
||||
|
||||
@Column({ nullable: true })
|
||||
isPublic?: boolean
|
||||
|
||||
@Column({ type: 'timestamp' })
|
||||
@CreateDateColumn()
|
||||
createdDate: Date
|
||||
|
||||
@Column({ type: 'timestamp' })
|
||||
@UpdateDateColumn()
|
||||
updatedDate: Date
|
||||
|
||||
@Column()
|
||||
stoppedDate: Date
|
||||
|
||||
@ManyToOne(() => ChatFlow)
|
||||
@JoinColumn({ name: 'agentflowId' })
|
||||
agentflow: ChatFlow
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import { Lead } from './Lead'
|
||||
import { UpsertHistory } from './UpsertHistory'
|
||||
import { ApiKey } from './ApiKey'
|
||||
import { CustomTemplate } from './CustomTemplate'
|
||||
import { Execution } from './Execution'
|
||||
|
||||
export const entities = {
|
||||
ChatFlow,
|
||||
@@ -25,5 +26,6 @@ export const entities = {
|
||||
Lead,
|
||||
UpsertHistory,
|
||||
ApiKey,
|
||||
CustomTemplate
|
||||
CustomTemplate,
|
||||
Execution
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddExecutionEntity1738090872625 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS \`execution\` (
|
||||
\`id\` varchar(36) NOT NULL,
|
||||
\`executionData\` text NOT NULL,
|
||||
\`action\` text,
|
||||
\`state\` varchar(255) NOT NULL,
|
||||
\`agentflowId\` varchar(255) NOT NULL,
|
||||
\`sessionId\` varchar(255) NOT NULL,
|
||||
\`isPublic\` boolean,
|
||||
\`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
|
||||
\`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
\`stoppedDate\` datetime(6),
|
||||
PRIMARY KEY (\`id\`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;`
|
||||
)
|
||||
|
||||
const columnExists = await queryRunner.hasColumn('chat_message', 'executionId')
|
||||
if (!columnExists) {
|
||||
await queryRunner.query(`ALTER TABLE \`chat_message\` ADD COLUMN \`executionId\` TEXT;`)
|
||||
}
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE IF EXISTS \`execution\``)
|
||||
await queryRunner.query(`ALTER TABLE \`chat_message\` DROP COLUMN \`executionId\`;`)
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplat
|
||||
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
|
||||
import { AddFollowUpPrompts1726666318346 } from './1726666318346-AddFollowUpPrompts'
|
||||
import { AddTypeToAssistant1733011290987 } from './1733011290987-AddTypeToAssistant'
|
||||
import { AddExecutionEntity1738090872625 } from './1738090872625-AddExecutionEntity'
|
||||
|
||||
export const mariadbMigrations = [
|
||||
Init1693840429259,
|
||||
@@ -59,5 +60,6 @@ export const mariadbMigrations = [
|
||||
AddCustomTemplate1725629836652,
|
||||
AddArtifactsToChatMessage1726156258465,
|
||||
AddFollowUpPrompts1726666318346,
|
||||
AddTypeToAssistant1733011290987
|
||||
AddTypeToAssistant1733011290987,
|
||||
AddExecutionEntity1738090872625
|
||||
]
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddExecutionEntity1738090872625 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS \`execution\` (
|
||||
\`id\` varchar(36) NOT NULL,
|
||||
\`executionData\` text NOT NULL,
|
||||
\`action\` text,
|
||||
\`state\` varchar(255) NOT NULL,
|
||||
\`agentflowId\` varchar(255) NOT NULL,
|
||||
\`sessionId\` varchar(255) NOT NULL,
|
||||
\`isPublic\` boolean,
|
||||
\`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
|
||||
\`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
\`stoppedDate\` datetime(6),
|
||||
PRIMARY KEY (\`id\`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;`
|
||||
)
|
||||
|
||||
const columnExists = await queryRunner.hasColumn('chat_message', 'executionId')
|
||||
if (!columnExists) {
|
||||
await queryRunner.query(`ALTER TABLE \`chat_message\` ADD COLUMN \`executionId\` TEXT;`)
|
||||
}
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE IF EXISTS \`execution\``)
|
||||
await queryRunner.query(`ALTER TABLE \`chat_message\` DROP COLUMN \`executionId\`;`)
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplat
|
||||
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
|
||||
import { AddFollowUpPrompts1726666302024 } from './1726666302024-AddFollowUpPrompts'
|
||||
import { AddTypeToAssistant1733011290987 } from './1733011290987-AddTypeToAssistant'
|
||||
import { AddExecutionEntity1738090872625 } from './1738090872625-AddExecutionEntity'
|
||||
|
||||
export const mysqlMigrations = [
|
||||
Init1693840429259,
|
||||
@@ -59,5 +60,6 @@ export const mysqlMigrations = [
|
||||
AddCustomTemplate1725629836652,
|
||||
AddArtifactsToChatMessage1726156258465,
|
||||
AddFollowUpPrompts1726666302024,
|
||||
AddTypeToAssistant1733011290987
|
||||
AddTypeToAssistant1733011290987,
|
||||
AddExecutionEntity1738090872625
|
||||
]
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddExecutionEntity1738090872625 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS execution (
|
||||
id uuid NOT NULL DEFAULT uuid_generate_v4(),
|
||||
"executionData" text NOT NULL,
|
||||
"action" text,
|
||||
"state" varchar NOT NULL,
|
||||
"agentflowId" uuid NOT NULL,
|
||||
"sessionId" uuid NOT NULL,
|
||||
"isPublic" boolean,
|
||||
"createdDate" timestamp NOT NULL DEFAULT now(),
|
||||
"updatedDate" timestamp NOT NULL DEFAULT now(),
|
||||
"stoppedDate" timestamp,
|
||||
CONSTRAINT "PK_936a419c3b8044598d72d95da61" PRIMARY KEY (id)
|
||||
);`
|
||||
)
|
||||
|
||||
const columnExists = await queryRunner.hasColumn('chat_message', 'executionId')
|
||||
if (!columnExists) {
|
||||
await queryRunner.query(`ALTER TABLE "chat_message" ADD COLUMN "executionId" uuid;`)
|
||||
}
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE execution`)
|
||||
await queryRunner.query(`ALTER TABLE "chat_message" DROP COLUMN "executionId";`)
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplat
|
||||
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
|
||||
import { AddFollowUpPrompts1726666309552 } from './1726666309552-AddFollowUpPrompts'
|
||||
import { AddTypeToAssistant1733011290987 } from './1733011290987-AddTypeToAssistant'
|
||||
import { AddExecutionEntity1738090872625 } from './1738090872625-AddExecutionEntity'
|
||||
|
||||
export const postgresMigrations = [
|
||||
Init1693891895163,
|
||||
@@ -59,5 +60,6 @@ export const postgresMigrations = [
|
||||
AddCustomTemplate1725629836652,
|
||||
AddArtifactsToChatMessage1726156258465,
|
||||
AddFollowUpPrompts1726666309552,
|
||||
AddTypeToAssistant1733011290987
|
||||
AddTypeToAssistant1733011290987,
|
||||
AddExecutionEntity1738090872625
|
||||
]
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddExecutionEntity1738090872625 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS "execution" ("id" varchar PRIMARY KEY NOT NULL, "executionData" text NOT NULL, "action" text, "state" varchar NOT NULL, "agentflowId" varchar NOT NULL, "sessionId" varchar NOT NULL, "isPublic" boolean, "createdDate" datetime NOT NULL DEFAULT (datetime('now')), "updatedDate" datetime NOT NULL DEFAULT (datetime('now')), "stoppedDate" datetime);`
|
||||
)
|
||||
await queryRunner.query(`ALTER TABLE "chat_message" ADD COLUMN "executionId" varchar;`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE execution`)
|
||||
await queryRunner.query(`ALTER TABLE "chat_message" DROP COLUMN "executionId";`)
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtif
|
||||
import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplate'
|
||||
import { AddFollowUpPrompts1726666294213 } from './1726666294213-AddFollowUpPrompts'
|
||||
import { AddTypeToAssistant1733011290987 } from './1733011290987-AddTypeToAssistant'
|
||||
import { AddExecutionEntity1738090872625 } from './1738090872625-AddExecutionEntity'
|
||||
|
||||
export const sqliteMigrations = [
|
||||
Init1693835579790,
|
||||
@@ -57,5 +58,6 @@ export const sqliteMigrations = [
|
||||
AddArtifactsToChatMessage1726156258465,
|
||||
AddCustomTemplate1725629836652,
|
||||
AddFollowUpPrompts1726666294213,
|
||||
AddTypeToAssistant1733011290987
|
||||
AddTypeToAssistant1733011290987,
|
||||
AddExecutionEntity1738090872625
|
||||
]
|
||||
|
||||
@@ -7,6 +7,9 @@ import { RedisEventPublisher } from './RedisEventPublisher'
|
||||
import { AbortControllerPool } from '../AbortControllerPool'
|
||||
import { BaseQueue } from './BaseQueue'
|
||||
import { RedisOptions } from 'bullmq'
|
||||
import logger from '../utils/logger'
|
||||
import { generateAgentflowv2 as generateAgentflowv2_json } from 'flowise-components'
|
||||
import { databaseEntities } from '../utils'
|
||||
|
||||
interface PredictionQueueOptions {
|
||||
appDataSource: DataSource
|
||||
@@ -16,6 +19,15 @@ interface PredictionQueueOptions {
|
||||
abortControllerPool: AbortControllerPool
|
||||
}
|
||||
|
||||
interface IGenerateAgentflowv2Params extends IExecuteFlowParams {
|
||||
prompt: string
|
||||
componentNodes: IComponentNodes
|
||||
toolNodes: IComponentNodes
|
||||
selectedChatModel: Record<string, any>
|
||||
question: string
|
||||
isAgentFlowGenerator: boolean
|
||||
}
|
||||
|
||||
export class PredictionQueue extends BaseQueue {
|
||||
private componentNodes: IComponentNodes
|
||||
private telemetry: Telemetry
|
||||
@@ -45,13 +57,24 @@ export class PredictionQueue extends BaseQueue {
|
||||
return this.queue
|
||||
}
|
||||
|
||||
async processJob(data: IExecuteFlowParams) {
|
||||
async processJob(data: IExecuteFlowParams | IGenerateAgentflowv2Params) {
|
||||
if (this.appDataSource) data.appDataSource = this.appDataSource
|
||||
if (this.telemetry) data.telemetry = this.telemetry
|
||||
if (this.cachePool) data.cachePool = this.cachePool
|
||||
if (this.componentNodes) data.componentNodes = this.componentNodes
|
||||
if (this.redisPublisher) data.sseStreamer = this.redisPublisher
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(data, 'isAgentFlowGenerator')) {
|
||||
logger.info('Generating Agentflow...')
|
||||
const { prompt, componentNodes, toolNodes, selectedChatModel, question } = data as IGenerateAgentflowv2Params
|
||||
const options: Record<string, any> = {
|
||||
appDataSource: this.appDataSource,
|
||||
databaseEntities: databaseEntities,
|
||||
logger: logger
|
||||
}
|
||||
return await generateAgentflowv2_json({ prompt, componentNodes, toolNodes, selectedChatModel }, question, options)
|
||||
}
|
||||
|
||||
if (this.abortControllerPool) {
|
||||
const abortControllerId = `${data.chatflow.id}_${data.chatId}`
|
||||
const signal = new AbortController()
|
||||
|
||||
@@ -119,6 +119,21 @@ export class RedisEventPublisher implements IServerSideEventStreamer {
|
||||
}
|
||||
}
|
||||
|
||||
streamCalledToolsEvent(chatId: string, data: any) {
|
||||
try {
|
||||
this.redisPublisher.publish(
|
||||
chatId,
|
||||
JSON.stringify({
|
||||
chatId,
|
||||
eventType: 'calledTools',
|
||||
data
|
||||
})
|
||||
)
|
||||
} catch (error) {
|
||||
console.error('Error streaming calledTools event:', error)
|
||||
}
|
||||
}
|
||||
|
||||
streamFileAnnotationsEvent(chatId: string, data: any) {
|
||||
try {
|
||||
this.redisPublisher.publish(
|
||||
@@ -164,6 +179,36 @@ export class RedisEventPublisher implements IServerSideEventStreamer {
|
||||
}
|
||||
}
|
||||
|
||||
streamAgentFlowEvent(chatId: string, data: any): void {
|
||||
try {
|
||||
this.redisPublisher.publish(
|
||||
chatId,
|
||||
JSON.stringify({
|
||||
chatId,
|
||||
eventType: 'agentFlowEvent',
|
||||
data
|
||||
})
|
||||
)
|
||||
} catch (error) {
|
||||
console.error('Error streaming agentFlow event:', error)
|
||||
}
|
||||
}
|
||||
|
||||
streamAgentFlowExecutedDataEvent(chatId: string, data: any): void {
|
||||
try {
|
||||
this.redisPublisher.publish(
|
||||
chatId,
|
||||
JSON.stringify({
|
||||
chatId,
|
||||
eventType: 'agentFlowExecutedData',
|
||||
data
|
||||
})
|
||||
)
|
||||
} catch (error) {
|
||||
console.error('Error streaming agentFlowExecutedData event:', error)
|
||||
}
|
||||
}
|
||||
|
||||
streamNextAgentEvent(chatId: string, data: any): void {
|
||||
try {
|
||||
this.redisPublisher.publish(
|
||||
@@ -179,6 +224,21 @@ export class RedisEventPublisher implements IServerSideEventStreamer {
|
||||
}
|
||||
}
|
||||
|
||||
streamNextAgentFlowEvent(chatId: string, data: any): void {
|
||||
try {
|
||||
this.redisPublisher.publish(
|
||||
chatId,
|
||||
JSON.stringify({
|
||||
chatId,
|
||||
eventType: 'nextAgentFlow',
|
||||
data
|
||||
})
|
||||
)
|
||||
} catch (error) {
|
||||
console.error('Error streaming nextAgentFlow event:', error)
|
||||
}
|
||||
}
|
||||
|
||||
streamActionEvent(chatId: string, data: any): void {
|
||||
try {
|
||||
this.redisPublisher.publish(
|
||||
@@ -254,6 +314,21 @@ export class RedisEventPublisher implements IServerSideEventStreamer {
|
||||
}
|
||||
}
|
||||
|
||||
streamUsageMetadataEvent(chatId: string, data: any): void {
|
||||
try {
|
||||
this.redisPublisher.publish(
|
||||
chatId,
|
||||
JSON.stringify({
|
||||
chatId,
|
||||
eventType: 'usageMetadata',
|
||||
data
|
||||
})
|
||||
)
|
||||
} catch (error) {
|
||||
console.error('Error streaming usage metadata event:', error)
|
||||
}
|
||||
}
|
||||
|
||||
async disconnect() {
|
||||
if (this.redisPublisher) {
|
||||
await this.redisPublisher.quit()
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import express from 'express'
|
||||
import agentflowv2GeneratorController from '../../controllers/agentflowv2-generator'
|
||||
const router = express.Router()
|
||||
|
||||
router.post('/generate', agentflowv2GeneratorController.generateAgentflowv2)
|
||||
|
||||
export default router
|
||||
@@ -0,0 +1,16 @@
|
||||
import express from 'express'
|
||||
import executionController from '../../controllers/executions'
|
||||
const router = express.Router()
|
||||
|
||||
// READ
|
||||
router.get('/', executionController.getAllExecutions)
|
||||
router.get(['/', '/:id'], executionController.getExecutionById)
|
||||
|
||||
// PUT
|
||||
router.put(['/', '/:id'], executionController.updateExecution)
|
||||
|
||||
// DELETE - single execution or multiple executions
|
||||
router.delete('/:id', executionController.deleteExecutions)
|
||||
router.delete('/', executionController.deleteExecutions)
|
||||
|
||||
export default router
|
||||
@@ -35,6 +35,7 @@ import predictionRouter from './predictions'
|
||||
import promptListsRouter from './prompts-lists'
|
||||
import publicChatbotRouter from './public-chatbots'
|
||||
import publicChatflowsRouter from './public-chatflows'
|
||||
import publicExecutionsRouter from './public-executions'
|
||||
import statsRouter from './stats'
|
||||
import toolsRouter from './tools'
|
||||
import upsertHistoryRouter from './upsert-history'
|
||||
@@ -43,6 +44,9 @@ import vectorRouter from './vectors'
|
||||
import verifyRouter from './verify'
|
||||
import versionRouter from './versions'
|
||||
import nvidiaNimRouter from './nvidia-nim'
|
||||
import executionsRouter from './executions'
|
||||
import validationRouter from './validation'
|
||||
import agentflowv2GeneratorRouter from './agentflowv2-generator'
|
||||
|
||||
const router = express.Router()
|
||||
|
||||
@@ -82,6 +86,7 @@ router.use('/prediction', predictionRouter)
|
||||
router.use('/prompts-list', promptListsRouter)
|
||||
router.use('/public-chatbotConfig', publicChatbotRouter)
|
||||
router.use('/public-chatflows', publicChatflowsRouter)
|
||||
router.use('/public-executions', publicExecutionsRouter)
|
||||
router.use('/stats', statsRouter)
|
||||
router.use('/tools', toolsRouter)
|
||||
router.use('/variables', variablesRouter)
|
||||
@@ -90,5 +95,8 @@ router.use('/verify', verifyRouter)
|
||||
router.use('/version', versionRouter)
|
||||
router.use('/upsert-history', upsertHistoryRouter)
|
||||
router.use('/nvidia-nim', nvidiaNimRouter)
|
||||
router.use('/executions', executionsRouter)
|
||||
router.use('/validation', validationRouter)
|
||||
router.use('/agentflowv2-generator', agentflowv2GeneratorRouter)
|
||||
|
||||
export default router
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import express from 'express'
|
||||
import executionController from '../../controllers/executions'
|
||||
const router = express.Router()
|
||||
|
||||
// CREATE
|
||||
|
||||
// READ
|
||||
router.get(['/', '/:id'], executionController.getPublicExecutionById)
|
||||
|
||||
// UPDATE
|
||||
|
||||
// DELETE
|
||||
|
||||
export default router
|
||||
@@ -0,0 +1,8 @@
|
||||
import express from 'express'
|
||||
import validationController from '../../controllers/validation'
|
||||
const router = express.Router()
|
||||
|
||||
// READ
|
||||
router.get('/:id', validationController.checkFlowValidation)
|
||||
|
||||
export default router
|
||||
@@ -0,0 +1,248 @@
|
||||
import { StatusCodes } from 'http-status-codes'
|
||||
import { InternalFlowiseError } from '../../errors/internalFlowiseError'
|
||||
import { getErrorMessage } from '../../errors/utils'
|
||||
import { getRunningExpressApp } from '../../utils/getRunningExpressApp'
|
||||
import path from 'path'
|
||||
import * as fs from 'fs'
|
||||
import { generateAgentflowv2 as generateAgentflowv2_json } from 'flowise-components'
|
||||
import { z } from 'zod'
|
||||
import { sysPrompt } from './prompt'
|
||||
import { databaseEntities } from '../../utils'
|
||||
import logger from '../../utils/logger'
|
||||
import { MODE } from '../../Interface'
|
||||
|
||||
// Define the Zod schema for Agentflowv2 data structure
|
||||
const NodeType = z.object({
|
||||
id: z.string(),
|
||||
type: z.string(),
|
||||
position: z.object({
|
||||
x: z.number(),
|
||||
y: z.number()
|
||||
}),
|
||||
width: z.number(),
|
||||
height: z.number(),
|
||||
selected: z.boolean().optional(),
|
||||
positionAbsolute: z
|
||||
.object({
|
||||
x: z.number(),
|
||||
y: z.number()
|
||||
})
|
||||
.optional(),
|
||||
dragging: z.boolean().optional(),
|
||||
data: z.any().optional(),
|
||||
parentNode: z.string().optional()
|
||||
})
|
||||
|
||||
const EdgeType = z.object({
|
||||
source: z.string(),
|
||||
sourceHandle: z.string(),
|
||||
target: z.string(),
|
||||
targetHandle: z.string(),
|
||||
data: z
|
||||
.object({
|
||||
sourceColor: z.string().optional(),
|
||||
targetColor: z.string().optional(),
|
||||
edgeLabel: z.string().optional(),
|
||||
isHumanInput: z.boolean().optional()
|
||||
})
|
||||
.optional(),
|
||||
type: z.string().optional(),
|
||||
id: z.string()
|
||||
})
|
||||
|
||||
const AgentFlowV2Type = z
|
||||
.object({
|
||||
description: z.string().optional(),
|
||||
usecases: z.array(z.string()).optional(),
|
||||
nodes: z.array(NodeType),
|
||||
edges: z.array(EdgeType)
|
||||
})
|
||||
.describe('Generate Agentflowv2 nodes and edges')
|
||||
|
||||
// Type for the templates array
|
||||
type AgentFlowV2Template = z.infer<typeof AgentFlowV2Type>
|
||||
|
||||
const getAllAgentFlow2Nodes = async () => {
|
||||
const appServer = getRunningExpressApp()
|
||||
const nodes = appServer.nodesPool.componentNodes
|
||||
const agentFlow2Nodes = []
|
||||
for (const node in nodes) {
|
||||
if (nodes[node].category === 'Agent Flows') {
|
||||
agentFlow2Nodes.push({
|
||||
name: nodes[node].name,
|
||||
label: nodes[node].label,
|
||||
description: nodes[node].description
|
||||
})
|
||||
}
|
||||
}
|
||||
return JSON.stringify(agentFlow2Nodes, null, 2)
|
||||
}
|
||||
|
||||
const getAllToolNodes = async () => {
|
||||
const appServer = getRunningExpressApp()
|
||||
const nodes = appServer.nodesPool.componentNodes
|
||||
const toolNodes = []
|
||||
const disabled_nodes = process.env.DISABLED_NODES ? process.env.DISABLED_NODES.split(',') : []
|
||||
const removeTools = ['chainTool', 'retrieverTool', 'webBrowser', ...disabled_nodes]
|
||||
|
||||
for (const node in nodes) {
|
||||
if (nodes[node].category.includes('Tools')) {
|
||||
if (removeTools.includes(nodes[node].name)) {
|
||||
continue
|
||||
}
|
||||
toolNodes.push({
|
||||
name: nodes[node].name,
|
||||
description: nodes[node].description
|
||||
})
|
||||
}
|
||||
}
|
||||
return JSON.stringify(toolNodes, null, 2)
|
||||
}
|
||||
|
||||
const getAllAgentflowv2Marketplaces = async () => {
|
||||
const templates: AgentFlowV2Template[] = []
|
||||
let marketplaceDir = path.join(__dirname, '..', '..', '..', 'marketplaces', 'agentflowsv2')
|
||||
let jsonsInDir = fs.readdirSync(marketplaceDir).filter((file) => path.extname(file) === '.json')
|
||||
jsonsInDir.forEach((file) => {
|
||||
try {
|
||||
const filePath = path.join(__dirname, '..', '..', '..', 'marketplaces', 'agentflowsv2', file)
|
||||
const fileData = fs.readFileSync(filePath)
|
||||
const fileDataObj = JSON.parse(fileData.toString())
|
||||
// get rid of the node.data, remain all other properties
|
||||
const filteredNodes = fileDataObj.nodes.map((node: any) => {
|
||||
return {
|
||||
...node,
|
||||
data: undefined
|
||||
}
|
||||
})
|
||||
|
||||
const template = {
|
||||
title: file.split('.json')[0],
|
||||
description: fileDataObj.description || `Template from ${file}`,
|
||||
usecases: fileDataObj.usecases || [],
|
||||
nodes: filteredNodes,
|
||||
edges: fileDataObj.edges
|
||||
}
|
||||
|
||||
// Validate template against schema
|
||||
const validatedTemplate = AgentFlowV2Type.parse(template)
|
||||
templates.push(validatedTemplate)
|
||||
} catch (error) {
|
||||
console.error(`Error processing template file ${file}:`, error)
|
||||
// Continue with next file instead of failing completely
|
||||
}
|
||||
})
|
||||
|
||||
// Format templates into the requested string format
|
||||
let formattedTemplates = ''
|
||||
templates.forEach((template: AgentFlowV2Template, index: number) => {
|
||||
formattedTemplates += `Example ${index + 1}: <<${(template as any).title}>> - ${template.description}\n`
|
||||
formattedTemplates += `"nodes": [\n`
|
||||
|
||||
// Format nodes with proper indentation
|
||||
const nodesJson = JSON.stringify(template.nodes, null, 3)
|
||||
// Split by newlines and add 3 spaces to the beginning of each line except the first and last
|
||||
const nodesLines = nodesJson.split('\n')
|
||||
if (nodesLines.length > 2) {
|
||||
formattedTemplates += ` ${nodesLines[0]}\n`
|
||||
for (let i = 1; i < nodesLines.length - 1; i++) {
|
||||
formattedTemplates += ` ${nodesLines[i]}\n`
|
||||
}
|
||||
formattedTemplates += ` ${nodesLines[nodesLines.length - 1]}\n`
|
||||
} else {
|
||||
formattedTemplates += ` ${nodesJson}\n`
|
||||
}
|
||||
|
||||
formattedTemplates += `]\n`
|
||||
formattedTemplates += `"edges": [\n`
|
||||
|
||||
// Format edges with proper indentation
|
||||
const edgesJson = JSON.stringify(template.edges, null, 3)
|
||||
// Split by newlines and add tab to the beginning of each line except the first and last
|
||||
const edgesLines = edgesJson.split('\n')
|
||||
if (edgesLines.length > 2) {
|
||||
formattedTemplates += `\t${edgesLines[0]}\n`
|
||||
for (let i = 1; i < edgesLines.length - 1; i++) {
|
||||
formattedTemplates += `\t${edgesLines[i]}\n`
|
||||
}
|
||||
formattedTemplates += `\t${edgesLines[edgesLines.length - 1]}\n`
|
||||
} else {
|
||||
formattedTemplates += `\t${edgesJson}\n`
|
||||
}
|
||||
|
||||
formattedTemplates += `]\n\n`
|
||||
})
|
||||
|
||||
return formattedTemplates
|
||||
}
|
||||
|
||||
const generateAgentflowv2 = async (question: string, selectedChatModel: Record<string, any>) => {
|
||||
try {
|
||||
const agentFlow2Nodes = await getAllAgentFlow2Nodes()
|
||||
const toolNodes = await getAllToolNodes()
|
||||
const marketplaceTemplates = await getAllAgentflowv2Marketplaces()
|
||||
|
||||
const prompt = sysPrompt
|
||||
.replace('{agentFlow2Nodes}', agentFlow2Nodes)
|
||||
.replace('{marketplaceTemplates}', marketplaceTemplates)
|
||||
.replace('{userRequest}', question)
|
||||
const options: Record<string, any> = {
|
||||
appDataSource: getRunningExpressApp().AppDataSource,
|
||||
databaseEntities: databaseEntities,
|
||||
logger: logger
|
||||
}
|
||||
|
||||
let response
|
||||
|
||||
if (process.env.MODE === MODE.QUEUE) {
|
||||
const predictionQueue = getRunningExpressApp().queueManager.getQueue('prediction')
|
||||
const job = await predictionQueue.addJob({
|
||||
prompt,
|
||||
question,
|
||||
toolNodes,
|
||||
selectedChatModel,
|
||||
isAgentFlowGenerator: true
|
||||
})
|
||||
logger.debug(`[server]: Generated Agentflowv2 Job added to queue: ${job.id}`)
|
||||
const queueEvents = predictionQueue.getQueueEvents()
|
||||
response = await job.waitUntilFinished(queueEvents)
|
||||
} else {
|
||||
response = await generateAgentflowv2_json(
|
||||
{ prompt, componentNodes: getRunningExpressApp().nodesPool.componentNodes, toolNodes, selectedChatModel },
|
||||
question,
|
||||
options
|
||||
)
|
||||
}
|
||||
|
||||
try {
|
||||
// Try to parse and validate the response if it's a string
|
||||
if (typeof response === 'string') {
|
||||
const parsedResponse = JSON.parse(response)
|
||||
const validatedResponse = AgentFlowV2Type.parse(parsedResponse)
|
||||
return validatedResponse
|
||||
}
|
||||
// If response is already an object
|
||||
else if (typeof response === 'object') {
|
||||
const validatedResponse = AgentFlowV2Type.parse(response)
|
||||
return validatedResponse
|
||||
}
|
||||
// Unexpected response type
|
||||
else {
|
||||
throw new Error(`Unexpected response type: ${typeof response}`)
|
||||
}
|
||||
} catch (parseError) {
|
||||
console.error('Failed to parse or validate response:', parseError)
|
||||
// If parsing fails, return an error object
|
||||
return {
|
||||
error: 'Failed to validate response format',
|
||||
rawResponse: response
|
||||
} as any // Type assertion to avoid type errors
|
||||
}
|
||||
} catch (error) {
|
||||
throw new InternalFlowiseError(StatusCodes.INTERNAL_SERVER_ERROR, `Error: generateAgentflowv2 - ${getErrorMessage(error)}`)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
generateAgentflowv2
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
export const sysPromptBackup = `You are a workflow orchestrator that is designed to make agent coordination and execution easy. Workflow consists of nodes and edges. Your goal is to generate nodes and edges needed for the workflow to achieve the given task.
|
||||
|
||||
Here are the nodes to choose from:
|
||||
{agentFlow2Nodes}
|
||||
|
||||
Here's some examples of workflows, take a look at which nodes are most relevant to the task and how the nodes and edges are connected:
|
||||
{marketplaceTemplates}
|
||||
|
||||
Now, let's generate the nodes and edges for the user's request.
|
||||
The response should be in JSON format with "nodes" and "edges" arrays, following the structure shown in the examples.
|
||||
|
||||
Think carefully, break down the task into smaller steps and think about which nodes are needed for each step.
|
||||
1. First, take a look at the examples and use them as references to think about which nodes are needed to achieve the task. It must always start with startAgentflow node, and have at least 2 nodes in total. You MUST only use nodes that are in the list of nodes above. Each node must have a unique incrementing id.
|
||||
2. Then, think about the edges between the nodes.
|
||||
3. An agentAgentflow is an AI Agent that can use tools to accomplish goals, executing decisions, automating tasks, and interacting with the real world autonomously such as web search, interact with database and API, send messages, book appointments, etc. Always place higher priority to this and see if the tasks can be accomplished by this node. Use this node if you are asked to create an agent that can perform multiple tasks autonomously.
|
||||
4. A llmAgentflow is excel at processing, understanding, and generating human-like language. It can be used for generating text, summarizing, translating, returning JSON outputs, etc.
|
||||
5. If you need to execute the tool sequentially after another, you can use the toolAgentflow node.
|
||||
6. If you need to iterate over a set of data, you can use the iteration node. You must have at least 1 node inside the iteration node. The children nodes will be executed N times, where N is the number of items in the iterationInput array. The children nodes must have the property "parentNode" and the value must be the id of the iteration node.
|
||||
7. If you can't find a node that fits the task, you can use the httpAgentflow node to execute a http request. For example, to retrieve data from 3rd party APIs, or to send data to a webhook
|
||||
8. If you need to dynamically choose between user intention, for example classifying the user's intent, you can use the conditionAgentAgentflow node. For defined conditions, you can use the conditionAgentflow node.
|
||||
`
|
||||
|
||||
export const sysPrompt = `You are an advanced workflow orchestrator designed to generate nodes and edges for complex tasks. Your goal is to create a workflow that accomplishes the given user request efficiently and effectively.
|
||||
|
||||
Your task is to generate a workflow for the following user request:
|
||||
|
||||
<user_request>
|
||||
{userRequest}
|
||||
</user_request>
|
||||
|
||||
First, review the available nodes for this system:
|
||||
|
||||
<available_nodes>
|
||||
{agentFlow2Nodes}
|
||||
</available_nodes>
|
||||
|
||||
Now, examine these workflow examples to understand how nodes are typically connected and which are most relevant for different tasks:
|
||||
|
||||
<workflow_examples>
|
||||
{marketplaceTemplates}
|
||||
</workflow_examples>
|
||||
|
||||
To create this workflow, follow these steps and wrap your thought process in <workflow_planning> tags inside your thinking block:
|
||||
|
||||
1. List out all the key components of the user request.
|
||||
2. Analyze the user request and break it down into smaller steps.
|
||||
3. For each step, consider which nodes are most appropriate and match each component with potential nodes. Remember:
|
||||
- Always start with a startAgentflow node.
|
||||
- Include at least 2 nodes in total.
|
||||
- Only use nodes from the available nodes list.
|
||||
- Assign each node a unique, incrementing ID.
|
||||
4. Outline the overall structure of the workflow.
|
||||
5. Determine the logical connections (edges) between the nodes.
|
||||
6. Consider special cases:
|
||||
- Use agentAgentflow for multiple autonomous tasks.
|
||||
- Use llmAgentflow for language processing tasks.
|
||||
- Use toolAgentflow for sequential tool execution.
|
||||
- Use iteration node when you need to iterate over a set of data (must include at least one child node with a "parentNode" property).
|
||||
- Use httpAgentflow for API requests or webhooks.
|
||||
- Use conditionAgentAgentflow for dynamic choices or conditionAgentflow for defined conditions.
|
||||
- Use humanInputAgentflow for human input and review.
|
||||
- Use loopAgentflow for repetitive tasks, or when back and forth communication is needed such as hierarchical workflows.
|
||||
|
||||
After your analysis, provide the final workflow as a JSON object with "nodes" and "edges" arrays.
|
||||
|
||||
Begin your analysis and workflow creation process now. Your final output should consist only of the JSON object with the workflow and should not duplicate or rehash any of the work you did in the workflow planning section.`
|
||||
@@ -433,9 +433,10 @@ const getDocumentStores = async (): Promise<any> => {
|
||||
const getTools = async (): Promise<any> => {
|
||||
try {
|
||||
const tools = await nodesService.getAllNodesForCategory('Tools')
|
||||
const mcpTools = await nodesService.getAllNodesForCategory('Tools (MCP)')
|
||||
|
||||
// filter out those tools that input params type are not in the list
|
||||
const filteredTools = tools.filter((tool) => {
|
||||
const filteredTools = [...tools, ...mcpTools].filter((tool) => {
|
||||
const inputs = tool.inputs || []
|
||||
return inputs.every((input) => INPUT_PARAMS_TYPE.includes(input.type))
|
||||
})
|
||||
|
||||
@@ -118,6 +118,7 @@ const removeAllChatMessages = async (
|
||||
logger.error(`[server]: Error deleting file storage for chatflow ${chatflowid}, chatId ${chatId}: ${e}`)
|
||||
}
|
||||
}
|
||||
|
||||
const dbResponse = await appServer.AppDataSource.getRepository(ChatMessage).delete(deleteOptions)
|
||||
return dbResponse
|
||||
} catch (error) {
|
||||
@@ -136,6 +137,10 @@ const removeChatMessagesByMessageIds = async (
|
||||
try {
|
||||
const appServer = getRunningExpressApp()
|
||||
|
||||
// Get messages before deletion to check for executionId
|
||||
const messages = await appServer.AppDataSource.getRepository(ChatMessage).findByIds(messageIds)
|
||||
const executionIds = messages.map((msg) => msg.executionId).filter(Boolean)
|
||||
|
||||
for (const [composite_key] of chatIdMap) {
|
||||
const [chatId] = composite_key.split('_')
|
||||
|
||||
@@ -147,6 +152,11 @@ const removeChatMessagesByMessageIds = async (
|
||||
await removeFilesFromStorage(chatflowid, chatId)
|
||||
}
|
||||
|
||||
// Delete executions if they exist
|
||||
if (executionIds.length > 0) {
|
||||
await appServer.AppDataSource.getRepository('Execution').delete(executionIds)
|
||||
}
|
||||
|
||||
const dbResponse = await appServer.AppDataSource.getRepository(ChatMessage).delete(messageIds)
|
||||
return dbResponse
|
||||
} catch (error) {
|
||||
|
||||
@@ -38,6 +38,10 @@ const checkIfChatflowIsValidForStreaming = async (chatflowId: string): Promise<a
|
||||
}
|
||||
}
|
||||
|
||||
if (chatflow.type === 'AGENTFLOW') {
|
||||
return { isStreaming: true }
|
||||
}
|
||||
|
||||
/*** Get Ending Node with Directed Graph ***/
|
||||
const flowData = chatflow.flowData
|
||||
const parsedFlowData: IReactFlowObject = JSON.parse(flowData)
|
||||
@@ -121,6 +125,8 @@ const getAllChatflows = async (type?: ChatflowType): Promise<ChatFlow[]> => {
|
||||
const dbResponse = await appServer.AppDataSource.getRepository(ChatFlow).find()
|
||||
if (type === 'MULTIAGENT') {
|
||||
return dbResponse.filter((chatflow) => chatflow.type === 'MULTIAGENT')
|
||||
} else if (type === 'AGENTFLOW') {
|
||||
return dbResponse.filter((chatflow) => chatflow.type === 'AGENTFLOW')
|
||||
} else if (type === 'ASSISTANT') {
|
||||
return dbResponse.filter((chatflow) => chatflow.type === 'ASSISTANT')
|
||||
} else if (type === 'CHATFLOW') {
|
||||
@@ -336,7 +342,7 @@ const getSinglePublicChatbotConfig = async (chatflowId: string): Promise<any> =>
|
||||
if (dbResponse.chatbotConfig || uploadsConfig) {
|
||||
try {
|
||||
const parsedConfig = dbResponse.chatbotConfig ? JSON.parse(dbResponse.chatbotConfig) : {}
|
||||
return { ...parsedConfig, uploads: uploadsConfig }
|
||||
return { ...parsedConfig, uploads: uploadsConfig, flowData: dbResponse.flowData }
|
||||
} catch (e) {
|
||||
throw new InternalFlowiseError(StatusCodes.INTERNAL_SERVER_ERROR, `Error parsing Chatbot Config for Chatflow ${chatflowId}`)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
import { StatusCodes } from 'http-status-codes'
|
||||
import { InternalFlowiseError } from '../../errors/internalFlowiseError'
|
||||
import { getErrorMessage } from '../../errors/utils'
|
||||
import { getRunningExpressApp } from '../../utils/getRunningExpressApp'
|
||||
import { Execution } from '../../database/entities/Execution'
|
||||
import { ExecutionState, IAgentflowExecutedData } from '../../Interface'
|
||||
import { In } from 'typeorm'
|
||||
import { ChatMessage } from '../../database/entities/ChatMessage'
|
||||
import { _removeCredentialId } from '../../utils/buildAgentflow'
|
||||
|
||||
interface ExecutionFilters {
|
||||
id?: string
|
||||
agentflowId?: string
|
||||
sessionId?: string
|
||||
state?: ExecutionState
|
||||
startDate?: Date
|
||||
endDate?: Date
|
||||
page?: number
|
||||
limit?: number
|
||||
}
|
||||
|
||||
const getExecutionById = async (executionId: string): Promise<Execution | null> => {
|
||||
try {
|
||||
const appServer = getRunningExpressApp()
|
||||
const executionRepository = appServer.AppDataSource.getRepository(Execution)
|
||||
const res = await executionRepository.findOne({ where: { id: executionId } })
|
||||
if (!res) {
|
||||
throw new InternalFlowiseError(StatusCodes.NOT_FOUND, `Execution ${executionId} not found`)
|
||||
}
|
||||
return res
|
||||
} catch (error) {
|
||||
throw new InternalFlowiseError(
|
||||
StatusCodes.INTERNAL_SERVER_ERROR,
|
||||
`Error: executionsService.getExecutionById - ${getErrorMessage(error)}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const getPublicExecutionById = async (executionId: string): Promise<Execution | null> => {
|
||||
try {
|
||||
const appServer = getRunningExpressApp()
|
||||
const executionRepository = appServer.AppDataSource.getRepository(Execution)
|
||||
const res = await executionRepository.findOne({ where: { id: executionId, isPublic: true } })
|
||||
if (!res) {
|
||||
throw new InternalFlowiseError(StatusCodes.NOT_FOUND, `Execution ${executionId} not found`)
|
||||
}
|
||||
const executionData = typeof res?.executionData === 'string' ? JSON.parse(res?.executionData) : res?.executionData
|
||||
const executionDataWithoutCredentialId = executionData.map((data: IAgentflowExecutedData) => _removeCredentialId(data))
|
||||
const stringifiedExecutionData = JSON.stringify(executionDataWithoutCredentialId)
|
||||
return { ...res, executionData: stringifiedExecutionData }
|
||||
} catch (error) {
|
||||
throw new InternalFlowiseError(
|
||||
StatusCodes.INTERNAL_SERVER_ERROR,
|
||||
`Error: executionsService.getPublicExecutionById - ${getErrorMessage(error)}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const getAllExecutions = async (filters: ExecutionFilters = {}): Promise<{ data: Execution[]; total: number }> => {
|
||||
try {
|
||||
const appServer = getRunningExpressApp()
|
||||
const { id, agentflowId, sessionId, state, startDate, endDate, page = 1, limit = 10 } = filters
|
||||
|
||||
// Handle UUID fields properly using raw parameters to avoid type conversion issues
|
||||
// This uses the query builder instead of direct objects for compatibility with UUID fields
|
||||
const queryBuilder = appServer.AppDataSource.getRepository(Execution)
|
||||
.createQueryBuilder('execution')
|
||||
.leftJoinAndSelect('execution.agentflow', 'agentflow')
|
||||
.orderBy('execution.createdDate', 'DESC')
|
||||
.skip((page - 1) * limit)
|
||||
.take(limit)
|
||||
|
||||
if (id) queryBuilder.andWhere('execution.id = :id', { id })
|
||||
if (agentflowId) queryBuilder.andWhere('execution.agentflowId = :agentflowId', { agentflowId })
|
||||
if (sessionId) queryBuilder.andWhere('execution.sessionId = :sessionId', { sessionId })
|
||||
if (state) queryBuilder.andWhere('execution.state = :state', { state })
|
||||
|
||||
// Date range conditions
|
||||
if (startDate && endDate) {
|
||||
queryBuilder.andWhere('execution.createdDate BETWEEN :startDate AND :endDate', { startDate, endDate })
|
||||
} else if (startDate) {
|
||||
queryBuilder.andWhere('execution.createdDate >= :startDate', { startDate })
|
||||
} else if (endDate) {
|
||||
queryBuilder.andWhere('execution.createdDate <= :endDate', { endDate })
|
||||
}
|
||||
|
||||
const [data, total] = await queryBuilder.getManyAndCount()
|
||||
|
||||
return { data, total }
|
||||
} catch (error) {
|
||||
throw new InternalFlowiseError(
|
||||
StatusCodes.INTERNAL_SERVER_ERROR,
|
||||
`Error: executionsService.getAllExecutions - ${getErrorMessage(error)}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const updateExecution = async (executionId: string, data: Partial<Execution>): Promise<Execution | null> => {
|
||||
try {
|
||||
const appServer = getRunningExpressApp()
|
||||
const execution = await appServer.AppDataSource.getRepository(Execution).findOneBy({
|
||||
id: executionId
|
||||
})
|
||||
if (!execution) {
|
||||
throw new InternalFlowiseError(StatusCodes.NOT_FOUND, `Execution ${executionId} not found`)
|
||||
}
|
||||
const updateExecution = new Execution()
|
||||
Object.assign(updateExecution, data)
|
||||
await appServer.AppDataSource.getRepository(Execution).merge(execution, updateExecution)
|
||||
const dbResponse = await appServer.AppDataSource.getRepository(Execution).save(execution)
|
||||
return dbResponse
|
||||
} catch (error) {
|
||||
throw new InternalFlowiseError(
|
||||
StatusCodes.INTERNAL_SERVER_ERROR,
|
||||
`Error: executionsService.updateExecution - ${getErrorMessage(error)}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete multiple executions by their IDs
|
||||
* @param executionIds Array of execution IDs to delete
|
||||
* @returns Object with success status and count of deleted executions
|
||||
*/
|
||||
const deleteExecutions = async (executionIds: string[]): Promise<{ success: boolean; deletedCount: number }> => {
|
||||
try {
|
||||
const appServer = getRunningExpressApp()
|
||||
const executionRepository = appServer.AppDataSource.getRepository(Execution)
|
||||
|
||||
// Delete executions where id is in the provided array
|
||||
const result = await executionRepository.delete({
|
||||
id: In(executionIds)
|
||||
})
|
||||
|
||||
// Update chat message executionId column to NULL
|
||||
await appServer.AppDataSource.getRepository(ChatMessage).update({ executionId: In(executionIds) }, { executionId: null as any })
|
||||
|
||||
return {
|
||||
success: true,
|
||||
deletedCount: result.affected || 0
|
||||
}
|
||||
} catch (error) {
|
||||
throw new InternalFlowiseError(
|
||||
StatusCodes.INTERNAL_SERVER_ERROR,
|
||||
`Error: executionsService.deleteExecutions - ${getErrorMessage(error)}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
getExecutionById,
|
||||
getAllExecutions,
|
||||
deleteExecutions,
|
||||
getPublicExecutionById,
|
||||
updateExecution
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import { ChatMessageFeedback } from '../../database/entities/ChatMessageFeedback
|
||||
import { CustomTemplate } from '../../database/entities/CustomTemplate'
|
||||
import { DocumentStore } from '../../database/entities/DocumentStore'
|
||||
import { DocumentStoreFileChunk } from '../../database/entities/DocumentStoreFileChunk'
|
||||
import { Execution } from '../../database/entities/Execution'
|
||||
import { Tool } from '../../database/entities/Tool'
|
||||
import { Variable } from '../../database/entities/Variable'
|
||||
import { InternalFlowiseError } from '../../errors/internalFlowiseError'
|
||||
@@ -17,12 +18,14 @@ import assistantService from '../assistants'
|
||||
import chatMessagesService from '../chat-messages'
|
||||
import chatflowService from '../chatflows'
|
||||
import documenStoreService from '../documentstore'
|
||||
import executionService from '../executions'
|
||||
import marketplacesService from '../marketplaces'
|
||||
import toolsService from '../tools'
|
||||
import variableService from '../variables'
|
||||
|
||||
type ExportInput = {
|
||||
agentflow: boolean
|
||||
agentflowv2: boolean
|
||||
assistantCustom: boolean
|
||||
assistantOpenAI: boolean
|
||||
assistantAzure: boolean
|
||||
@@ -31,12 +34,14 @@ type ExportInput = {
|
||||
chat_feedback: boolean
|
||||
custom_template: boolean
|
||||
document_store: boolean
|
||||
execution: boolean
|
||||
tool: boolean
|
||||
variable: boolean
|
||||
}
|
||||
|
||||
type ExportData = {
|
||||
AgentFlow: ChatFlow[]
|
||||
AgentFlowV2: ChatFlow[]
|
||||
AssistantCustom: Assistant[]
|
||||
AssistantFlow: ChatFlow[]
|
||||
AssistantOpenAI: Assistant[]
|
||||
@@ -47,6 +52,7 @@ type ExportData = {
|
||||
CustomTemplate: CustomTemplate[]
|
||||
DocumentStore: DocumentStore[]
|
||||
DocumentStoreFileChunk: DocumentStoreFileChunk[]
|
||||
Execution: Execution[]
|
||||
Tool: Tool[]
|
||||
Variable: Variable[]
|
||||
}
|
||||
@@ -55,6 +61,7 @@ const convertExportInput = (body: any): ExportInput => {
|
||||
try {
|
||||
if (!body || typeof body !== 'object') throw new Error('Invalid ExportInput object in request body')
|
||||
if (body.agentflow && typeof body.agentflow !== 'boolean') throw new Error('Invalid agentflow property in ExportInput object')
|
||||
if (body.agentflowv2 && typeof body.agentflowv2 !== 'boolean') throw new Error('Invalid agentflowv2 property in ExportInput object')
|
||||
if (body.assistant && typeof body.assistant !== 'boolean') throw new Error('Invalid assistant property in ExportInput object')
|
||||
if (body.chatflow && typeof body.chatflow !== 'boolean') throw new Error('Invalid chatflow property in ExportInput object')
|
||||
if (body.chat_message && typeof body.chat_message !== 'boolean')
|
||||
@@ -65,6 +72,7 @@ const convertExportInput = (body: any): ExportInput => {
|
||||
throw new Error('Invalid custom_template property in ExportInput object')
|
||||
if (body.document_store && typeof body.document_store !== 'boolean')
|
||||
throw new Error('Invalid document_store property in ExportInput object')
|
||||
if (body.execution && typeof body.execution !== 'boolean') throw new Error('Invalid execution property in ExportInput object')
|
||||
if (body.tool && typeof body.tool !== 'boolean') throw new Error('Invalid tool property in ExportInput object')
|
||||
if (body.variable && typeof body.variable !== 'boolean') throw new Error('Invalid variable property in ExportInput object')
|
||||
return body as ExportInput
|
||||
@@ -80,6 +88,7 @@ const FileDefaultName = 'ExportData.json'
|
||||
const exportData = async (exportInput: ExportInput): Promise<{ FileDefaultName: string } & ExportData> => {
|
||||
try {
|
||||
let AgentFlow: ChatFlow[] = exportInput.agentflow === true ? await chatflowService.getAllChatflows('MULTIAGENT') : []
|
||||
let AgentFlowV2: ChatFlow[] = exportInput.agentflowv2 === true ? await chatflowService.getAllChatflows('AGENTFLOW') : []
|
||||
|
||||
let AssistantCustom: Assistant[] = exportInput.assistantCustom === true ? await assistantService.getAllAssistants('CUSTOM') : []
|
||||
let AssistantFlow: ChatFlow[] = exportInput.assistantCustom === true ? await chatflowService.getAllChatflows('ASSISTANT') : []
|
||||
@@ -103,6 +112,9 @@ const exportData = async (exportInput: ExportInput): Promise<{ FileDefaultName:
|
||||
let DocumentStoreFileChunk: DocumentStoreFileChunk[] =
|
||||
exportInput.document_store === true ? await documenStoreService.getAllDocumentFileChunks() : []
|
||||
|
||||
const { data: totalExecutions } = exportInput.execution === true ? await executionService.getAllExecutions() : { data: [] }
|
||||
let Execution: Execution[] = exportInput.execution === true ? totalExecutions : []
|
||||
|
||||
let Tool: Tool[] = exportInput.tool === true ? await toolsService.getAllTools() : []
|
||||
|
||||
let Variable: Variable[] = exportInput.variable === true ? await variableService.getAllVariables() : []
|
||||
@@ -110,6 +122,7 @@ const exportData = async (exportInput: ExportInput): Promise<{ FileDefaultName:
|
||||
return {
|
||||
FileDefaultName,
|
||||
AgentFlow,
|
||||
AgentFlowV2,
|
||||
AssistantCustom,
|
||||
AssistantFlow,
|
||||
AssistantOpenAI,
|
||||
@@ -120,6 +133,7 @@ const exportData = async (exportInput: ExportInput): Promise<{ FileDefaultName:
|
||||
CustomTemplate,
|
||||
DocumentStore,
|
||||
DocumentStoreFileChunk,
|
||||
Execution,
|
||||
Tool,
|
||||
Variable
|
||||
}
|
||||
@@ -180,8 +194,9 @@ async function replaceDuplicateIdsForChatMessage(queryRunner: QueryRunner, origi
|
||||
})
|
||||
const originalDataChatflowIds = [
|
||||
...originalData.AssistantFlow.map((assistantFlow) => assistantFlow.id),
|
||||
...originalData.AgentFlow.map((agentflow) => agentflow.id),
|
||||
...originalData.ChatFlow.map((chatflow) => chatflow.id)
|
||||
...originalData.AgentFlow.map((agentFlow) => agentFlow.id),
|
||||
...originalData.AgentFlowV2.map((agentFlowV2) => agentFlowV2.id),
|
||||
...originalData.ChatFlow.map((chatFlow) => chatFlow.id)
|
||||
]
|
||||
chatmessageChatflowIds.forEach((item) => {
|
||||
if (originalDataChatflowIds.includes(item.id)) {
|
||||
@@ -224,6 +239,54 @@ async function replaceDuplicateIdsForChatMessage(queryRunner: QueryRunner, origi
|
||||
}
|
||||
}
|
||||
|
||||
async function replaceExecutionIdForChatMessage(queryRunner: QueryRunner, originalData: ExportData, chatMessages: ChatMessage[]) {
|
||||
try {
|
||||
// step 1 - get all execution ids from chatMessages
|
||||
const chatMessageExecutionIds = chatMessages
|
||||
.map((chatMessage) => {
|
||||
return { id: chatMessage.executionId, qty: 0 }
|
||||
})
|
||||
.filter((item): item is { id: string; qty: number } => item !== undefined)
|
||||
|
||||
// step 2 - increase qty if execution id is in importData.Execution
|
||||
const originalDataExecutionIds = originalData.Execution.map((execution) => execution.id)
|
||||
chatMessageExecutionIds.forEach((item) => {
|
||||
if (originalDataExecutionIds.includes(item.id)) {
|
||||
item.qty += 1
|
||||
}
|
||||
})
|
||||
|
||||
// step 3 - increase qty if execution id is in database
|
||||
const databaseExecutionIds = await (
|
||||
await queryRunner.manager.find(Execution, {
|
||||
where: { id: In(chatMessageExecutionIds.map((chatMessageExecutionId) => chatMessageExecutionId.id)) }
|
||||
})
|
||||
).map((execution) => execution.id)
|
||||
chatMessageExecutionIds.forEach((item) => {
|
||||
if (databaseExecutionIds.includes(item.id)) {
|
||||
item.qty += 1
|
||||
}
|
||||
})
|
||||
|
||||
// step 4 - if executionIds not found replace with NULL
|
||||
const missingExecutionIds = chatMessageExecutionIds.filter((item) => item.qty === 0).map((item) => item.id)
|
||||
chatMessages.forEach((chatMessage) => {
|
||||
if (chatMessage.executionId && missingExecutionIds.includes(chatMessage.executionId)) {
|
||||
delete chatMessage.executionId
|
||||
}
|
||||
})
|
||||
|
||||
originalData.ChatMessage = chatMessages
|
||||
|
||||
return originalData
|
||||
} catch (error) {
|
||||
throw new InternalFlowiseError(
|
||||
StatusCodes.INTERNAL_SERVER_ERROR,
|
||||
`Error: exportImportService.replaceExecutionIdForChatMessage - ${getErrorMessage(error)}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
async function replaceDuplicateIdsForChatMessageFeedback(
|
||||
queryRunner: QueryRunner,
|
||||
originalData: ExportData,
|
||||
@@ -235,8 +298,9 @@ async function replaceDuplicateIdsForChatMessageFeedback(
|
||||
})
|
||||
const originalDataChatflowIds = [
|
||||
...originalData.AssistantFlow.map((assistantFlow) => assistantFlow.id),
|
||||
...originalData.AgentFlow.map((agentflow) => agentflow.id),
|
||||
...originalData.ChatFlow.map((chatflow) => chatflow.id)
|
||||
...originalData.AgentFlow.map((agentFlow) => agentFlow.id),
|
||||
...originalData.AgentFlowV2.map((agentFlowV2) => agentFlowV2.id),
|
||||
...originalData.ChatFlow.map((chatFlow) => chatFlow.id)
|
||||
]
|
||||
feedbackChatflowIds.forEach((item) => {
|
||||
if (originalDataChatflowIds.includes(item.id)) {
|
||||
@@ -412,6 +476,27 @@ async function replaceDuplicateIdsForVariable(queryRunner: QueryRunner, original
|
||||
}
|
||||
}
|
||||
|
||||
async function replaceDuplicateIdsForExecution(queryRunner: QueryRunner, originalData: ExportData, executions: Execution[]) {
|
||||
try {
|
||||
const ids = executions.map((execution) => execution.id)
|
||||
const records = await queryRunner.manager.find(Execution, {
|
||||
where: { id: In(ids) }
|
||||
})
|
||||
if (records.length < 0) return originalData
|
||||
for (let record of records) {
|
||||
const oldId = record.id
|
||||
const newId = uuidv4()
|
||||
originalData = JSON.parse(JSON.stringify(originalData).replaceAll(oldId, newId))
|
||||
}
|
||||
return originalData
|
||||
} catch (error) {
|
||||
throw new InternalFlowiseError(
|
||||
StatusCodes.INTERNAL_SERVER_ERROR,
|
||||
`Error: exportImportService.replaceDuplicateIdsForExecution - ${getErrorMessage(error)}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function reduceSpaceForChatflowFlowData(chatflows: ChatFlow[]) {
|
||||
return chatflows.map((chatflow) => {
|
||||
return { ...chatflow, flowData: JSON.stringify(JSON.parse(chatflow.flowData)) }
|
||||
@@ -429,6 +514,10 @@ const importData = async (importData: ExportData) => {
|
||||
importData.AgentFlow = reduceSpaceForChatflowFlowData(importData.AgentFlow)
|
||||
importData = await replaceDuplicateIdsForChatFlow(queryRunner, importData, importData.AgentFlow)
|
||||
}
|
||||
if (importData.AgentFlowV2.length > 0) {
|
||||
importData.AgentFlowV2 = reduceSpaceForChatflowFlowData(importData.AgentFlowV2)
|
||||
importData = await replaceDuplicateIdsForChatFlow(queryRunner, importData, importData.AgentFlowV2)
|
||||
}
|
||||
if (importData.AssistantCustom.length > 0)
|
||||
importData = await replaceDuplicateIdsForAssistant(queryRunner, importData, importData.AssistantCustom)
|
||||
if (importData.AssistantFlow.length > 0) {
|
||||
@@ -443,8 +532,10 @@ const importData = async (importData: ExportData) => {
|
||||
importData.ChatFlow = reduceSpaceForChatflowFlowData(importData.ChatFlow)
|
||||
importData = await replaceDuplicateIdsForChatFlow(queryRunner, importData, importData.ChatFlow)
|
||||
}
|
||||
if (importData.ChatMessage.length > 0)
|
||||
if (importData.ChatMessage.length > 0) {
|
||||
importData = await replaceDuplicateIdsForChatMessage(queryRunner, importData, importData.ChatMessage)
|
||||
importData = await replaceExecutionIdForChatMessage(queryRunner, importData, importData.ChatMessage)
|
||||
}
|
||||
if (importData.ChatMessageFeedback.length > 0)
|
||||
importData = await replaceDuplicateIdsForChatMessageFeedback(queryRunner, importData, importData.ChatMessageFeedback)
|
||||
if (importData.CustomTemplate.length > 0)
|
||||
@@ -454,12 +545,15 @@ const importData = async (importData: ExportData) => {
|
||||
if (importData.DocumentStoreFileChunk.length > 0)
|
||||
importData = await replaceDuplicateIdsForDocumentStoreFileChunk(queryRunner, importData, importData.DocumentStoreFileChunk)
|
||||
if (importData.Tool.length > 0) importData = await replaceDuplicateIdsForTool(queryRunner, importData, importData.Tool)
|
||||
if (importData.Execution.length > 0)
|
||||
importData = await replaceDuplicateIdsForExecution(queryRunner, importData, importData.Execution)
|
||||
if (importData.Variable.length > 0)
|
||||
importData = await replaceDuplicateIdsForVariable(queryRunner, importData, importData.Variable)
|
||||
|
||||
await queryRunner.startTransaction()
|
||||
|
||||
if (importData.AgentFlow.length > 0) await queryRunner.manager.save(ChatFlow, importData.AgentFlow)
|
||||
if (importData.AgentFlowV2.length > 0) await queryRunner.manager.save(ChatFlow, importData.AgentFlowV2)
|
||||
if (importData.AssistantFlow.length > 0) await queryRunner.manager.save(ChatFlow, importData.AssistantFlow)
|
||||
if (importData.AssistantCustom.length > 0) await queryRunner.manager.save(Assistant, importData.AssistantCustom)
|
||||
if (importData.AssistantOpenAI.length > 0) await queryRunner.manager.save(Assistant, importData.AssistantOpenAI)
|
||||
@@ -473,6 +567,7 @@ const importData = async (importData: ExportData) => {
|
||||
if (importData.DocumentStoreFileChunk.length > 0)
|
||||
await queryRunner.manager.save(DocumentStoreFileChunk, importData.DocumentStoreFileChunk)
|
||||
if (importData.Tool.length > 0) await queryRunner.manager.save(Tool, importData.Tool)
|
||||
if (importData.Execution.length > 0) await queryRunner.manager.save(Execution, importData.Execution)
|
||||
if (importData.Variable.length > 0) await queryRunner.manager.save(Variable, importData.Variable)
|
||||
|
||||
await queryRunner.commitTransaction()
|
||||
|
||||
@@ -7,6 +7,7 @@ import { IReactFlowEdge, IReactFlowNode } from '../../Interface'
|
||||
import { getRunningExpressApp } from '../../utils/getRunningExpressApp'
|
||||
import { DeleteResult } from 'typeorm'
|
||||
import { CustomTemplate } from '../../database/entities/CustomTemplate'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
import chatflowsService from '../chatflows'
|
||||
|
||||
@@ -29,13 +30,13 @@ const getAllTemplates = async () => {
|
||||
let marketplaceDir = path.join(__dirname, '..', '..', '..', 'marketplaces', 'chatflows')
|
||||
let jsonsInDir = fs.readdirSync(marketplaceDir).filter((file) => path.extname(file) === '.json')
|
||||
let templates: any[] = []
|
||||
jsonsInDir.forEach((file, index) => {
|
||||
jsonsInDir.forEach((file) => {
|
||||
const filePath = path.join(__dirname, '..', '..', '..', 'marketplaces', 'chatflows', file)
|
||||
const fileData = fs.readFileSync(filePath)
|
||||
const fileDataObj = JSON.parse(fileData.toString()) as ITemplate
|
||||
|
||||
const template = {
|
||||
id: index,
|
||||
id: uuidv4(),
|
||||
templateName: file.split('.json')[0],
|
||||
flowData: fileData.toString(),
|
||||
badge: fileDataObj?.badge,
|
||||
@@ -50,13 +51,13 @@ const getAllTemplates = async () => {
|
||||
|
||||
marketplaceDir = path.join(__dirname, '..', '..', '..', 'marketplaces', 'tools')
|
||||
jsonsInDir = fs.readdirSync(marketplaceDir).filter((file) => path.extname(file) === '.json')
|
||||
jsonsInDir.forEach((file, index) => {
|
||||
jsonsInDir.forEach((file) => {
|
||||
const filePath = path.join(__dirname, '..', '..', '..', 'marketplaces', 'tools', file)
|
||||
const fileData = fs.readFileSync(filePath)
|
||||
const fileDataObj = JSON.parse(fileData.toString())
|
||||
const template = {
|
||||
...fileDataObj,
|
||||
id: index,
|
||||
id: uuidv4(),
|
||||
type: 'Tool',
|
||||
framework: fileDataObj?.framework,
|
||||
badge: fileDataObj?.badge,
|
||||
@@ -69,12 +70,12 @@ const getAllTemplates = async () => {
|
||||
|
||||
marketplaceDir = path.join(__dirname, '..', '..', '..', 'marketplaces', 'agentflows')
|
||||
jsonsInDir = fs.readdirSync(marketplaceDir).filter((file) => path.extname(file) === '.json')
|
||||
jsonsInDir.forEach((file, index) => {
|
||||
jsonsInDir.forEach((file) => {
|
||||
const filePath = path.join(__dirname, '..', '..', '..', 'marketplaces', 'agentflows', file)
|
||||
const fileData = fs.readFileSync(filePath)
|
||||
const fileDataObj = JSON.parse(fileData.toString())
|
||||
const template = {
|
||||
id: index,
|
||||
id: uuidv4(),
|
||||
templateName: file.split('.json')[0],
|
||||
flowData: fileData.toString(),
|
||||
badge: fileDataObj?.badge,
|
||||
@@ -86,6 +87,26 @@ const getAllTemplates = async () => {
|
||||
}
|
||||
templates.push(template)
|
||||
})
|
||||
|
||||
marketplaceDir = path.join(__dirname, '..', '..', '..', 'marketplaces', 'agentflowsv2')
|
||||
jsonsInDir = fs.readdirSync(marketplaceDir).filter((file) => path.extname(file) === '.json')
|
||||
jsonsInDir.forEach((file) => {
|
||||
const filePath = path.join(__dirname, '..', '..', '..', 'marketplaces', 'agentflowsv2', file)
|
||||
const fileData = fs.readFileSync(filePath)
|
||||
const fileDataObj = JSON.parse(fileData.toString())
|
||||
const template = {
|
||||
id: uuidv4(),
|
||||
templateName: file.split('.json')[0],
|
||||
flowData: fileData.toString(),
|
||||
badge: fileDataObj?.badge,
|
||||
framework: fileDataObj?.framework,
|
||||
usecases: fileDataObj?.usecases,
|
||||
categories: getCategories(fileDataObj),
|
||||
type: 'AgentflowV2',
|
||||
description: fileDataObj?.description || ''
|
||||
}
|
||||
templates.push(template)
|
||||
})
|
||||
const sortedTemplates = templates.sort((a, b) => a.templateName.localeCompare(b.templateName))
|
||||
const FlowiseDocsQnAIndex = sortedTemplates.findIndex((tmp) => tmp.templateName === 'Flowise Docs QnA')
|
||||
if (FlowiseDocsQnAIndex > 0) {
|
||||
@@ -200,6 +221,9 @@ const _generateExportFlowData = (flowData: any) => {
|
||||
version: node.data.version,
|
||||
name: node.data.name,
|
||||
type: node.data.type,
|
||||
color: node.data.color,
|
||||
hideOutput: node.data.hideOutput,
|
||||
hideInput: node.data.hideInput,
|
||||
baseClasses: node.data.baseClasses,
|
||||
tags: node.data.tags,
|
||||
category: node.data.category,
|
||||
|
||||
@@ -97,7 +97,10 @@ const getSingleNodeAsyncOptions = async (nodeName: string, requestBody: any): Pr
|
||||
|
||||
const dbResponse: INodeOptionsValue[] = await nodeInstance.loadMethods![methodName]!.call(nodeInstance, nodeData, {
|
||||
appDataSource: appServer.AppDataSource,
|
||||
databaseEntities: databaseEntities
|
||||
databaseEntities: databaseEntities,
|
||||
componentNodes: appServer.nodesPool.componentNodes,
|
||||
previousNodes: requestBody.previousNodes,
|
||||
currentNode: requestBody.currentNode
|
||||
})
|
||||
|
||||
return dbResponse
|
||||
|
||||
@@ -24,7 +24,7 @@ const getAssistantVectorStore = async (credentialId: string, vectorStoreId: stri
|
||||
}
|
||||
|
||||
const openai = new OpenAI({ apiKey: openAIApiKey })
|
||||
const dbResponse = await openai.beta.vectorStores.retrieve(vectorStoreId)
|
||||
const dbResponse = await openai.vectorStores.retrieve(vectorStoreId)
|
||||
return dbResponse
|
||||
} catch (error) {
|
||||
throw new InternalFlowiseError(
|
||||
@@ -51,7 +51,7 @@ const listAssistantVectorStore = async (credentialId: string) => {
|
||||
}
|
||||
|
||||
const openai = new OpenAI({ apiKey: openAIApiKey })
|
||||
const dbResponse = await openai.beta.vectorStores.list()
|
||||
const dbResponse = await openai.vectorStores.list()
|
||||
return dbResponse.data
|
||||
} catch (error) {
|
||||
throw new InternalFlowiseError(
|
||||
@@ -61,7 +61,7 @@ const listAssistantVectorStore = async (credentialId: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
const createAssistantVectorStore = async (credentialId: string, obj: OpenAI.Beta.VectorStores.VectorStoreCreateParams) => {
|
||||
const createAssistantVectorStore = async (credentialId: string, obj: OpenAI.VectorStores.VectorStoreCreateParams) => {
|
||||
try {
|
||||
const appServer = getRunningExpressApp()
|
||||
const credential = await appServer.AppDataSource.getRepository(Credential).findOneBy({
|
||||
@@ -78,7 +78,7 @@ const createAssistantVectorStore = async (credentialId: string, obj: OpenAI.Beta
|
||||
}
|
||||
|
||||
const openai = new OpenAI({ apiKey: openAIApiKey })
|
||||
const dbResponse = await openai.beta.vectorStores.create(obj)
|
||||
const dbResponse = await openai.vectorStores.create(obj)
|
||||
return dbResponse
|
||||
} catch (error) {
|
||||
throw new InternalFlowiseError(
|
||||
@@ -91,7 +91,7 @@ const createAssistantVectorStore = async (credentialId: string, obj: OpenAI.Beta
|
||||
const updateAssistantVectorStore = async (
|
||||
credentialId: string,
|
||||
vectorStoreId: string,
|
||||
obj: OpenAI.Beta.VectorStores.VectorStoreUpdateParams
|
||||
obj: OpenAI.VectorStores.VectorStoreUpdateParams
|
||||
) => {
|
||||
try {
|
||||
const appServer = getRunningExpressApp()
|
||||
@@ -109,8 +109,8 @@ const updateAssistantVectorStore = async (
|
||||
}
|
||||
|
||||
const openai = new OpenAI({ apiKey: openAIApiKey })
|
||||
const dbResponse = await openai.beta.vectorStores.update(vectorStoreId, obj)
|
||||
const vectorStoreFiles = await openai.beta.vectorStores.files.list(vectorStoreId)
|
||||
const dbResponse = await openai.vectorStores.update(vectorStoreId, obj)
|
||||
const vectorStoreFiles = await openai.vectorStores.files.list(vectorStoreId)
|
||||
if (vectorStoreFiles.data?.length) {
|
||||
const files = []
|
||||
for (const file of vectorStoreFiles.data) {
|
||||
@@ -145,7 +145,7 @@ const deleteAssistantVectorStore = async (credentialId: string, vectorStoreId: s
|
||||
}
|
||||
|
||||
const openai = new OpenAI({ apiKey: openAIApiKey })
|
||||
const dbResponse = await openai.beta.vectorStores.del(vectorStoreId)
|
||||
const dbResponse = await openai.vectorStores.del(vectorStoreId)
|
||||
return dbResponse
|
||||
} catch (error) {
|
||||
throw new InternalFlowiseError(
|
||||
@@ -190,7 +190,7 @@ const uploadFilesToAssistantVectorStore = async (
|
||||
|
||||
const file_ids = [...uploadedFiles.map((file) => file.id)]
|
||||
|
||||
const res = await openai.beta.vectorStores.fileBatches.createAndPoll(vectorStoreId, {
|
||||
const res = await openai.vectorStores.fileBatches.createAndPoll(vectorStoreId, {
|
||||
file_ids
|
||||
})
|
||||
if (res.status === 'completed' && res.file_counts.completed === uploadedFiles.length) return uploadedFiles
|
||||
@@ -232,7 +232,7 @@ const deleteFilesFromAssistantVectorStore = async (credentialId: string, vectorS
|
||||
const deletedFileIds = []
|
||||
let count = 0
|
||||
for (const file of file_ids) {
|
||||
const res = await openai.beta.vectorStores.files.del(vectorStoreId, file)
|
||||
const res = await openai.vectorStores.files.del(vectorStoreId, file)
|
||||
if (res.deleted) {
|
||||
deletedFileIds.push(file)
|
||||
count += 1
|
||||
|
||||
@@ -68,10 +68,10 @@ const getSingleOpenaiAssistant = async (credentialId: string, assistantId: strin
|
||||
if (dbResponse.tool_resources?.file_search?.vector_store_ids?.length) {
|
||||
// Since there can only be 1 vector store per assistant
|
||||
const vectorStoreId = dbResponse.tool_resources.file_search.vector_store_ids[0]
|
||||
const vectorStoreFiles = await openai.beta.vectorStores.files.list(vectorStoreId)
|
||||
const vectorStoreFiles = await openai.vectorStores.files.list(vectorStoreId)
|
||||
const fileIds = vectorStoreFiles.data?.map((file) => file.id) ?? []
|
||||
;(dbResponse.tool_resources.file_search as any).files = [...existingFiles.filter((file) => fileIds.includes(file.id))]
|
||||
;(dbResponse.tool_resources.file_search as any).vector_store_object = await openai.beta.vectorStores.retrieve(vectorStoreId)
|
||||
;(dbResponse.tool_resources.file_search as any).vector_store_object = await openai.vectorStores.retrieve(vectorStoreId)
|
||||
}
|
||||
return dbResponse
|
||||
} catch (error) {
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
import { StatusCodes } from 'http-status-codes'
|
||||
import { InternalFlowiseError } from '../../errors/internalFlowiseError'
|
||||
import { getErrorMessage } from '../../errors/utils'
|
||||
import { getRunningExpressApp } from '../../utils/getRunningExpressApp'
|
||||
import { ChatFlow } from '../../database/entities/ChatFlow'
|
||||
import { INodeParams } from 'flowise-components'
|
||||
import { IReactFlowEdge, IReactFlowNode } from '../../Interface'
|
||||
|
||||
interface IValidationResult {
|
||||
id: string
|
||||
label: string
|
||||
name: string
|
||||
issues: string[]
|
||||
}
|
||||
|
||||
const checkFlowValidation = async (flowId: string): Promise<IValidationResult[]> => {
|
||||
try {
|
||||
const appServer = getRunningExpressApp()
|
||||
|
||||
const componentNodes = appServer.nodesPool.componentNodes
|
||||
|
||||
const flow = await appServer.AppDataSource.getRepository(ChatFlow).findOne({
|
||||
where: {
|
||||
id: flowId
|
||||
}
|
||||
})
|
||||
|
||||
if (!flow) {
|
||||
throw new InternalFlowiseError(StatusCodes.NOT_FOUND, `Error: validationService.checkFlowValidation - flow not found!`)
|
||||
}
|
||||
|
||||
const flowData = JSON.parse(flow.flowData)
|
||||
const nodes = flowData.nodes
|
||||
const edges = flowData.edges
|
||||
|
||||
// Store validation results
|
||||
const validationResults = []
|
||||
|
||||
// Create a map of connected nodes
|
||||
const connectedNodes = new Set<string>()
|
||||
edges.forEach((edge: IReactFlowEdge) => {
|
||||
connectedNodes.add(edge.source)
|
||||
connectedNodes.add(edge.target)
|
||||
})
|
||||
|
||||
// Validate each node
|
||||
for (const node of nodes) {
|
||||
if (node.data.name === 'stickyNoteAgentflow') continue
|
||||
|
||||
const nodeIssues = []
|
||||
|
||||
// Check if node is connected
|
||||
if (!connectedNodes.has(node.id)) {
|
||||
nodeIssues.push('This node is not connected to anything')
|
||||
}
|
||||
|
||||
// Validate input parameters
|
||||
if (node.data && node.data.inputParams && node.data.inputs) {
|
||||
for (const param of node.data.inputParams) {
|
||||
// Skip validation if the parameter has show condition that doesn't match
|
||||
if (param.show) {
|
||||
let shouldShow = true
|
||||
for (const [key, value] of Object.entries(param.show)) {
|
||||
if (node.data.inputs[key] !== value) {
|
||||
shouldShow = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!shouldShow) continue
|
||||
}
|
||||
|
||||
// Skip validation if the parameter has hide condition that matches
|
||||
if (param.hide) {
|
||||
let shouldHide = true
|
||||
for (const [key, value] of Object.entries(param.hide)) {
|
||||
if (node.data.inputs[key] !== value) {
|
||||
shouldHide = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if (shouldHide) continue
|
||||
}
|
||||
|
||||
// Check if required parameter has a value
|
||||
if (!param.optional) {
|
||||
const inputValue = node.data.inputs[param.name]
|
||||
if (inputValue === undefined || inputValue === null || inputValue === '') {
|
||||
nodeIssues.push(`${param.label} is required`)
|
||||
}
|
||||
}
|
||||
|
||||
// Check array type parameters (even if the array itself is optional)
|
||||
if (param.type === 'array' && Array.isArray(node.data.inputs[param.name])) {
|
||||
const inputValue = node.data.inputs[param.name]
|
||||
|
||||
// Only validate non-empty arrays (if array is required but empty, it's caught above)
|
||||
if (inputValue.length > 0) {
|
||||
// Check each item in the array
|
||||
inputValue.forEach((item: Record<string, any>, index: number) => {
|
||||
if (param.array) {
|
||||
param.array.forEach((arrayParam: INodeParams) => {
|
||||
// Evaluate if this parameter should be shown based on current values
|
||||
// First check show conditions
|
||||
let shouldValidate = true
|
||||
|
||||
if (arrayParam.show) {
|
||||
// Default to not showing unless conditions match
|
||||
shouldValidate = false
|
||||
|
||||
// Each key in show is a condition that must be satisfied
|
||||
for (const [conditionKey, expectedValue] of Object.entries(arrayParam.show)) {
|
||||
const isIndexCondition = conditionKey.includes('$index')
|
||||
let actualValue
|
||||
|
||||
if (isIndexCondition) {
|
||||
// Replace $index with actual index and evaluate
|
||||
const normalizedKey = conditionKey.replace(/conditions\[\$index\]\.(\w+)/, '$1')
|
||||
actualValue = item[normalizedKey]
|
||||
} else {
|
||||
// Direct property in the current item
|
||||
actualValue = item[conditionKey]
|
||||
}
|
||||
|
||||
// Check if condition is satisfied
|
||||
let conditionMet = false
|
||||
if (Array.isArray(expectedValue)) {
|
||||
conditionMet = expectedValue.includes(actualValue)
|
||||
} else {
|
||||
conditionMet = actualValue === expectedValue
|
||||
}
|
||||
|
||||
if (conditionMet) {
|
||||
shouldValidate = true
|
||||
break // One matching condition is enough
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Then check hide conditions (they override show conditions)
|
||||
if (shouldValidate && arrayParam.hide) {
|
||||
for (const [conditionKey, expectedValue] of Object.entries(arrayParam.hide)) {
|
||||
const isIndexCondition = conditionKey.includes('$index')
|
||||
let actualValue
|
||||
|
||||
if (isIndexCondition) {
|
||||
// Replace $index with actual index and evaluate
|
||||
const normalizedKey = conditionKey.replace(/conditions\[\$index\]\.(\w+)/, '$1')
|
||||
actualValue = item[normalizedKey]
|
||||
} else {
|
||||
// Direct property in the current item
|
||||
actualValue = item[conditionKey]
|
||||
}
|
||||
|
||||
// Check if hide condition is met
|
||||
let shouldHide = false
|
||||
if (Array.isArray(expectedValue)) {
|
||||
shouldHide = expectedValue.includes(actualValue)
|
||||
} else {
|
||||
shouldHide = actualValue === expectedValue
|
||||
}
|
||||
|
||||
if (shouldHide) {
|
||||
shouldValidate = false
|
||||
break // One matching hide condition is enough to hide
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only validate if field should be shown
|
||||
if (shouldValidate) {
|
||||
// Check if value is required and missing
|
||||
if (
|
||||
(arrayParam.optional === undefined || !arrayParam.optional) &&
|
||||
(item[arrayParam.name] === undefined ||
|
||||
item[arrayParam.name] === null ||
|
||||
item[arrayParam.name] === '' ||
|
||||
item[arrayParam.name] === '<p></p>')
|
||||
) {
|
||||
nodeIssues.push(`${param.label} item #${index + 1}: ${arrayParam.label} is required`)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Check for credential requirements
|
||||
if (param.name === 'credential' && !param.optional) {
|
||||
const credentialValue = node.data.inputs[param.name]
|
||||
if (!credentialValue) {
|
||||
nodeIssues.push(`Credential is required`)
|
||||
}
|
||||
}
|
||||
|
||||
// Check for nested config parameters
|
||||
const configKey = `${param.name}Config`
|
||||
if (node.data.inputs[configKey] && node.data.inputs[param.name]) {
|
||||
const componentName = node.data.inputs[param.name]
|
||||
const configValue = node.data.inputs[configKey]
|
||||
|
||||
// Check if the component exists in the componentNodes pool
|
||||
if (componentNodes[componentName] && componentNodes[componentName].inputs) {
|
||||
const componentInputParams = componentNodes[componentName].inputs
|
||||
|
||||
// Validate each required input parameter in the component
|
||||
for (const componentParam of componentInputParams) {
|
||||
// Skip validation if the parameter has show condition that doesn't match
|
||||
if (componentParam.show) {
|
||||
let shouldShow = true
|
||||
for (const [key, value] of Object.entries(componentParam.show)) {
|
||||
if (configValue[key] !== value) {
|
||||
shouldShow = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!shouldShow) continue
|
||||
}
|
||||
|
||||
// Skip validation if the parameter has hide condition that matches
|
||||
if (componentParam.hide) {
|
||||
let shouldHide = true
|
||||
for (const [key, value] of Object.entries(componentParam.hide)) {
|
||||
if (configValue[key] !== value) {
|
||||
shouldHide = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if (shouldHide) continue
|
||||
}
|
||||
|
||||
if (!componentParam.optional) {
|
||||
const nestedValue = configValue[componentParam.name]
|
||||
if (nestedValue === undefined || nestedValue === null || nestedValue === '') {
|
||||
nodeIssues.push(`${param.label} configuration: ${componentParam.label} is required`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for credential requirement in the component
|
||||
if (componentNodes[componentName].credential && !componentNodes[componentName].credential.optional) {
|
||||
if (!configValue.FLOWISE_CREDENTIAL_ID && !configValue.credential) {
|
||||
nodeIssues.push(`${param.label} requires a credential`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add node to validation results if it has issues
|
||||
if (nodeIssues.length > 0) {
|
||||
validationResults.push({
|
||||
id: node.id,
|
||||
label: node.data.label,
|
||||
name: node.data.name,
|
||||
issues: nodeIssues
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Check for hanging edges
|
||||
for (const edge of edges) {
|
||||
const sourceExists = nodes.some((node: IReactFlowNode) => node.id === edge.source)
|
||||
const targetExists = nodes.some((node: IReactFlowEdge) => node.id === edge.target)
|
||||
|
||||
if (!sourceExists || !targetExists) {
|
||||
// Find the existing node that is connected to this hanging edge
|
||||
if (!sourceExists && targetExists) {
|
||||
// Target exists but source doesn't - add issue to target node
|
||||
const targetNode = nodes.find((node: IReactFlowNode) => node.id === edge.target)
|
||||
const targetNodeResult = validationResults.find((result) => result.id === edge.target)
|
||||
|
||||
if (targetNodeResult) {
|
||||
// Add to existing validation result
|
||||
targetNodeResult.issues.push(`Connected to non-existent source node ${edge.source}`)
|
||||
} else {
|
||||
// Create new validation result for this node
|
||||
validationResults.push({
|
||||
id: targetNode.id,
|
||||
label: targetNode.data.label,
|
||||
name: targetNode.data.name,
|
||||
issues: [`Connected to non-existent source node ${edge.source}`]
|
||||
})
|
||||
}
|
||||
} else if (sourceExists && !targetExists) {
|
||||
// Source exists but target doesn't - add issue to source node
|
||||
const sourceNode = nodes.find((node: IReactFlowNode) => node.id === edge.source)
|
||||
const sourceNodeResult = validationResults.find((result) => result.id === edge.source)
|
||||
|
||||
if (sourceNodeResult) {
|
||||
// Add to existing validation result
|
||||
sourceNodeResult.issues.push(`Connected to non-existent target node ${edge.target}`)
|
||||
} else {
|
||||
// Create new validation result for this node
|
||||
validationResults.push({
|
||||
id: sourceNode.id,
|
||||
label: sourceNode.data.label,
|
||||
name: sourceNode.data.name,
|
||||
issues: [`Connected to non-existent target node ${edge.target}`]
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// Both source and target don't exist - create a generic edge issue
|
||||
validationResults.push({
|
||||
id: edge.id,
|
||||
label: `Edge ${edge.id}`,
|
||||
name: 'edge',
|
||||
issues: ['Disconnected edge - both source and target nodes do not exist']
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return validationResults
|
||||
} catch (error) {
|
||||
throw new InternalFlowiseError(
|
||||
StatusCodes.INTERNAL_SERVER_ERROR,
|
||||
`Error: validationService.checkFlowValidation - ${getErrorMessage(error)}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
checkFlowValidation
|
||||
}
|
||||
@@ -99,6 +99,16 @@ export class SSEStreamer implements IServerSideEventStreamer {
|
||||
client.response.write('message:\ndata:' + JSON.stringify(clientResponse) + '\n\n')
|
||||
}
|
||||
}
|
||||
streamCalledToolsEvent(chatId: string, data: any): void {
|
||||
const client = this.clients[chatId]
|
||||
if (client) {
|
||||
const clientResponse = {
|
||||
event: 'calledTools',
|
||||
data: data
|
||||
}
|
||||
client.response.write('message:\ndata:' + JSON.stringify(clientResponse) + '\n\n')
|
||||
}
|
||||
}
|
||||
streamFileAnnotationsEvent(chatId: string, data: any): void {
|
||||
const client = this.clients[chatId]
|
||||
if (client) {
|
||||
@@ -139,6 +149,36 @@ export class SSEStreamer implements IServerSideEventStreamer {
|
||||
client.response.write('message:\ndata:' + JSON.stringify(clientResponse) + '\n\n')
|
||||
}
|
||||
}
|
||||
streamAgentFlowEvent(chatId: string, data: any): void {
|
||||
const client = this.clients[chatId]
|
||||
if (client) {
|
||||
const clientResponse = {
|
||||
event: 'agentFlowEvent',
|
||||
data: data
|
||||
}
|
||||
client.response.write('message:\ndata:' + JSON.stringify(clientResponse) + '\n\n')
|
||||
}
|
||||
}
|
||||
streamAgentFlowExecutedDataEvent(chatId: string, data: any): void {
|
||||
const client = this.clients[chatId]
|
||||
if (client) {
|
||||
const clientResponse = {
|
||||
event: 'agentFlowExecutedData',
|
||||
data: data
|
||||
}
|
||||
client.response.write('message:\ndata:' + JSON.stringify(clientResponse) + '\n\n')
|
||||
}
|
||||
}
|
||||
streamNextAgentFlowEvent(chatId: string, data: any): void {
|
||||
const client = this.clients[chatId]
|
||||
if (client) {
|
||||
const clientResponse = {
|
||||
event: 'nextAgentFlow',
|
||||
data: data
|
||||
}
|
||||
client.response.write('message:\ndata:' + JSON.stringify(clientResponse) + '\n\n')
|
||||
}
|
||||
}
|
||||
streamActionEvent(chatId: string, data: any): void {
|
||||
const client = this.clients[chatId]
|
||||
if (client) {
|
||||
@@ -206,4 +246,15 @@ export class SSEStreamer implements IServerSideEventStreamer {
|
||||
this.streamCustomEvent(chatId, 'metadata', metadataJson)
|
||||
}
|
||||
}
|
||||
|
||||
streamUsageMetadataEvent(chatId: string, data: any): void {
|
||||
const client = this.clients[chatId]
|
||||
if (client) {
|
||||
const clientResponse = {
|
||||
event: 'usageMetadata',
|
||||
data: data
|
||||
}
|
||||
client.response.write('message:\ndata:' + JSON.stringify(clientResponse) + '\n\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -63,6 +63,7 @@ import { buildAgentGraph } from './buildAgentGraph'
|
||||
import { getErrorMessage } from '../errors/utils'
|
||||
import { FLOWISE_METRIC_COUNTERS, FLOWISE_COUNTER_STATUS, IMetricsProvider } from '../Interface.Metrics'
|
||||
import { OMIT_QUEUE_JOB_DATA } from './constants'
|
||||
import { executeAgentFlow } from './buildAgentflow'
|
||||
|
||||
/*
|
||||
* Initialize the ending node to be executed
|
||||
@@ -236,7 +237,8 @@ export const executeFlow = async ({
|
||||
baseURL,
|
||||
isInternal,
|
||||
files,
|
||||
signal
|
||||
signal,
|
||||
isTool
|
||||
}: IExecuteFlowParams) => {
|
||||
// Ensure incomingInput has all required properties with default values
|
||||
incomingInput = {
|
||||
@@ -260,8 +262,8 @@ export const executeFlow = async ({
|
||||
*/
|
||||
let fileUploads: IFileUpload[] = []
|
||||
let uploadedFilesContent = ''
|
||||
if (incomingInput.uploads) {
|
||||
fileUploads = incomingInput.uploads
|
||||
if (uploads) {
|
||||
fileUploads = uploads
|
||||
for (let i = 0; i < fileUploads.length; i += 1) {
|
||||
const upload = fileUploads[i]
|
||||
|
||||
@@ -373,6 +375,26 @@ export const executeFlow = async ({
|
||||
}
|
||||
}
|
||||
|
||||
const isAgentFlowV2 = chatflow.type === 'AGENTFLOW'
|
||||
if (isAgentFlowV2) {
|
||||
return executeAgentFlow({
|
||||
componentNodes,
|
||||
incomingInput,
|
||||
chatflow,
|
||||
chatId,
|
||||
appDataSource,
|
||||
telemetry,
|
||||
cachePool,
|
||||
sseStreamer,
|
||||
baseURL,
|
||||
isInternal,
|
||||
uploadedFilesContent,
|
||||
fileUploads,
|
||||
signal,
|
||||
isTool
|
||||
})
|
||||
}
|
||||
|
||||
/*** Get chatflows and prepare data ***/
|
||||
const flowData = chatflow.flowData
|
||||
const parsedFlowData: IReactFlowObject = JSON.parse(flowData)
|
||||
@@ -498,7 +520,7 @@ export const executeFlow = async ({
|
||||
memoryType,
|
||||
sessionId,
|
||||
createdDate: userMessageDateTime,
|
||||
fileUploads: incomingInput.uploads ? JSON.stringify(fileUploads) : undefined,
|
||||
fileUploads: uploads ? JSON.stringify(fileUploads) : undefined,
|
||||
leadEmail: incomingInput.leadEmail
|
||||
}
|
||||
await utilAddChatMessage(userMessage, appDataSource)
|
||||
@@ -819,12 +841,14 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals
|
||||
}
|
||||
|
||||
const isAgentFlow = chatflow.type === 'MULTIAGENT'
|
||||
|
||||
const httpProtocol = req.get('x-forwarded-proto') || req.protocol
|
||||
const baseURL = `${httpProtocol}://${req.get('host')}`
|
||||
const incomingInput: IncomingInput = req.body || {} // Ensure incomingInput is never undefined
|
||||
const chatId = incomingInput.chatId ?? incomingInput.overrideConfig?.sessionId ?? uuidv4()
|
||||
const files = (req.files as Express.Multer.File[]) || []
|
||||
const abortControllerId = `${chatflow.id}_${chatId}`
|
||||
const isTool = req.get('flowise-tool') === 'true'
|
||||
|
||||
try {
|
||||
// Validate API Key if its external API request
|
||||
@@ -846,7 +870,8 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals
|
||||
sseStreamer: appServer.sseStreamer,
|
||||
telemetry: appServer.telemetry,
|
||||
cachePool: appServer.cachePool,
|
||||
componentNodes: appServer.nodesPool.componentNodes
|
||||
componentNodes: appServer.nodesPool.componentNodes,
|
||||
isTool // used to disable streaming if incoming request its from ChatflowTool
|
||||
}
|
||||
|
||||
if (process.env.MODE === MODE.QUEUE) {
|
||||
@@ -868,7 +893,6 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals
|
||||
const signal = new AbortController()
|
||||
appServer.abortControllerPool.add(abortControllerId, signal)
|
||||
executeData.signal = signal
|
||||
|
||||
const result = await executeFlow(executeData)
|
||||
|
||||
appServer.abortControllerPool.remove(abortControllerId)
|
||||
|
||||
@@ -3,6 +3,7 @@ export const WHITELIST_URLS = [
|
||||
'/api/v1/chatflows/apikey/',
|
||||
'/api/v1/public-chatflows',
|
||||
'/api/v1/public-chatbotConfig',
|
||||
'/api/v1/public-executions',
|
||||
'/api/v1/prediction/',
|
||||
'/api/v1/vector/upsert/',
|
||||
'/api/v1/node-icon/',
|
||||
@@ -28,6 +29,7 @@ export const INPUT_PARAMS_TYPE = [
|
||||
'asyncMultiOptions',
|
||||
'options',
|
||||
'multiOptions',
|
||||
'array',
|
||||
'datagrid',
|
||||
'string',
|
||||
'number',
|
||||
|
||||
@@ -52,6 +52,7 @@ export const utilGetChatMessage = async ({
|
||||
|
||||
// do the join with chat message feedback based on messageId for each chat message in the chatflow
|
||||
query
|
||||
.leftJoinAndSelect('chat_message.execution', 'execution')
|
||||
.leftJoinAndMapOne('chat_message.feedback', ChatMessageFeedback, 'feedback', 'feedback.messageId = chat_message.id')
|
||||
.where('chat_message.chatflowid = :chatflowid', { chatflowid })
|
||||
|
||||
@@ -121,6 +122,9 @@ export const utilGetChatMessage = async ({
|
||||
createdDate: createdDateQuery,
|
||||
id: messageId ?? undefined
|
||||
},
|
||||
relations: {
|
||||
execution: true
|
||||
},
|
||||
order: {
|
||||
createdDate: sortOrder === 'DESC' ? 'DESC' : 'ASC'
|
||||
}
|
||||
|
||||
@@ -93,22 +93,43 @@ export const utilGetUploadsConfig = async (chatflowid: string): Promise<IUploadC
|
||||
'seqStart'
|
||||
]
|
||||
|
||||
if (nodes.some((node) => imgUploadAllowedNodes.includes(node.data.name))) {
|
||||
nodes.forEach((node: IReactFlowNode) => {
|
||||
const data = node.data
|
||||
if (data.category === 'Chat Models' && data.inputs?.['allowImageUploads'] === true) {
|
||||
// TODO: for now the maxUploadSize is hardcoded to 5MB, we need to add it to the node properties
|
||||
node.data.inputParams.map((param: INodeParams) => {
|
||||
if (param.name === 'allowImageUploads' && node.data.inputs?.['allowImageUploads']) {
|
||||
imgUploadSizeAndTypes.push({
|
||||
fileTypes: 'image/gif;image/jpeg;image/png;image/webp;'.split(';'),
|
||||
maxUploadSize: 5
|
||||
})
|
||||
isImageUploadAllowed = true
|
||||
}
|
||||
})
|
||||
const isAgentflow = nodes.some((node) => node.data.category === 'Agent Flows')
|
||||
|
||||
if (isAgentflow) {
|
||||
// check through all the nodes and check if any of the nodes data inputs agentModelConfig or llmModelConfig or conditionAgentModelConfig has allowImageUploads
|
||||
nodes.forEach((node) => {
|
||||
if (node.data.category === 'Agent Flows') {
|
||||
if (
|
||||
node.data.inputs?.agentModelConfig?.allowImageUploads ||
|
||||
node.data.inputs?.llmModelConfig?.allowImageUploads ||
|
||||
node.data.inputs?.conditionAgentModelConfig?.allowImageUploads
|
||||
) {
|
||||
imgUploadSizeAndTypes.push({
|
||||
fileTypes: 'image/gif;image/jpeg;image/png;image/webp;'.split(';'),
|
||||
maxUploadSize: 5
|
||||
})
|
||||
isImageUploadAllowed = true
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (nodes.some((node) => imgUploadAllowedNodes.includes(node.data.name))) {
|
||||
nodes.forEach((node: IReactFlowNode) => {
|
||||
const data = node.data
|
||||
if (data.category === 'Chat Models' && data.inputs?.['allowImageUploads'] === true) {
|
||||
// TODO: for now the maxUploadSize is hardcoded to 5MB, we need to add it to the node properties
|
||||
node.data.inputParams.map((param: INodeParams) => {
|
||||
if (param.name === 'allowImageUploads' && node.data.inputs?.['allowImageUploads']) {
|
||||
imgUploadSizeAndTypes.push({
|
||||
fileTypes: 'image/gif;image/jpeg;image/png;image/webp;'.split(';'),
|
||||
maxUploadSize: 5
|
||||
})
|
||||
isImageUploadAllowed = true
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -64,10 +64,11 @@ import {
|
||||
SecretsManagerClientConfig
|
||||
} from '@aws-sdk/client-secrets-manager'
|
||||
|
||||
const QUESTION_VAR_PREFIX = 'question'
|
||||
const FILE_ATTACHMENT_PREFIX = 'file_attachment'
|
||||
const CHAT_HISTORY_VAR_PREFIX = 'chat_history'
|
||||
const REDACTED_CREDENTIAL_VALUE = '_FLOWISE_BLANK_07167752-1a71-43b1-bf8f-4f32252165db'
|
||||
export const QUESTION_VAR_PREFIX = 'question'
|
||||
export const FILE_ATTACHMENT_PREFIX = 'file_attachment'
|
||||
export const CHAT_HISTORY_VAR_PREFIX = 'chat_history'
|
||||
export const RUNTIME_MESSAGES_LENGTH_VAR_PREFIX = 'runtime_messages_length'
|
||||
export const REDACTED_CREDENTIAL_VALUE = '_FLOWISE_BLANK_07167752-1a71-43b1-bf8f-4f32252165db'
|
||||
|
||||
let secretsManagerClient: SecretsManagerClient | null = null
|
||||
const USE_AWS_SECRETS_MANAGER = process.env.SECRETKEY_STORAGE_TYPE === 'aws'
|
||||
@@ -238,6 +239,22 @@ export const getStartingNodes = (graph: INodeDirectedGraph, endNodeId: string) =
|
||||
return { startingNodeIds, depthQueue: depthQueueReversed }
|
||||
}
|
||||
|
||||
/**
|
||||
* Get starting node and check if flow is valid
|
||||
* @param {INodeDependencies} nodeDependencies
|
||||
*/
|
||||
export const getStartingNode = (nodeDependencies: INodeDependencies) => {
|
||||
// Find starting node
|
||||
const startingNodeIds = [] as string[]
|
||||
Object.keys(nodeDependencies).forEach((nodeId) => {
|
||||
if (nodeDependencies[nodeId] === 0) {
|
||||
startingNodeIds.push(nodeId)
|
||||
}
|
||||
})
|
||||
|
||||
return { startingNodeIds }
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all connected nodes from startnode
|
||||
* @param {INodeDependencies} graph
|
||||
@@ -763,7 +780,7 @@ export const clearSessionMemory = async (
|
||||
}
|
||||
}
|
||||
|
||||
const getGlobalVariable = async (
|
||||
export const getGlobalVariable = async (
|
||||
overrideConfig?: ICommonObject,
|
||||
availableVariables: IVariable[] = [],
|
||||
variableOverrides: ICommonObject[] = []
|
||||
@@ -990,7 +1007,6 @@ export const resolveVariables = async (
|
||||
variableOverrides: ICommonObject[] = []
|
||||
): Promise<INodeData> => {
|
||||
let flowNodeData = cloneDeep(reactFlowNodeData)
|
||||
const types = 'inputs'
|
||||
|
||||
const getParamValues = async (paramsObj: ICommonObject) => {
|
||||
for (const key in paramsObj) {
|
||||
@@ -1030,7 +1046,7 @@ export const resolveVariables = async (
|
||||
}
|
||||
}
|
||||
|
||||
const paramsObj = flowNodeData[types] ?? {}
|
||||
const paramsObj = flowNodeData['inputs'] ?? {}
|
||||
await getParamValues(paramsObj)
|
||||
|
||||
return flowNodeData
|
||||
@@ -1244,7 +1260,8 @@ export const findAvailableConfigs = (reactFlowNodes: IReactFlowNode[], component
|
||||
|
||||
for (const flowNode of reactFlowNodes) {
|
||||
for (const inputParam of flowNode.data.inputParams) {
|
||||
let obj: IOverrideConfig
|
||||
let obj: IOverrideConfig | undefined
|
||||
|
||||
if (inputParam.type === 'file') {
|
||||
obj = {
|
||||
node: flowNode.data.label,
|
||||
@@ -1285,6 +1302,34 @@ export const findAvailableConfigs = (reactFlowNodes: IReactFlowNode[], component
|
||||
}
|
||||
}
|
||||
continue
|
||||
} else if (inputParam.type === 'array') {
|
||||
// get array item schema
|
||||
const arrayItem = inputParam.array
|
||||
if (Array.isArray(arrayItem)) {
|
||||
const arraySchema = []
|
||||
// Each array item is a field definition
|
||||
for (const item of arrayItem) {
|
||||
let itemType = item.type
|
||||
if (itemType === 'options') {
|
||||
const availableOptions = item.options?.map((option) => option.name).join(', ')
|
||||
itemType = `(${availableOptions})`
|
||||
} else if (itemType === 'file') {
|
||||
itemType = item.fileType ?? item.type
|
||||
}
|
||||
arraySchema.push({
|
||||
name: item.name,
|
||||
type: itemType
|
||||
})
|
||||
}
|
||||
obj = {
|
||||
node: flowNode.data.label,
|
||||
nodeId: flowNode.data.id,
|
||||
label: inputParam.label,
|
||||
name: inputParam.name,
|
||||
type: inputParam.type,
|
||||
schema: arraySchema
|
||||
}
|
||||
}
|
||||
} else {
|
||||
obj = {
|
||||
node: flowNode.data.label,
|
||||
@@ -1294,7 +1339,7 @@ export const findAvailableConfigs = (reactFlowNodes: IReactFlowNode[], component
|
||||
type: inputParam.type === 'password' ? 'string' : inputParam.type
|
||||
}
|
||||
}
|
||||
if (!configs.some((config) => JSON.stringify(config) === JSON.stringify(obj))) {
|
||||
if (obj && !configs.some((config) => JSON.stringify(config) === JSON.stringify(obj))) {
|
||||
configs.push(obj)
|
||||
}
|
||||
}
|
||||
@@ -1814,3 +1859,70 @@ export const getMulterStorage = () => {
|
||||
return multer({ dest: getUploadPath() })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate depth of each node from starting nodes
|
||||
* @param {INodeDirectedGraph} graph
|
||||
* @param {string[]} startingNodeIds
|
||||
* @returns {Record<string, number>} Map of nodeId to its depth
|
||||
*/
|
||||
export const calculateNodesDepth = (graph: INodeDirectedGraph, startingNodeIds: string[]): Record<string, number> => {
|
||||
const depths: Record<string, number> = {}
|
||||
const visited = new Set<string>()
|
||||
|
||||
// Initialize all nodes with depth -1 (unvisited)
|
||||
for (const nodeId in graph) {
|
||||
depths[nodeId] = -1
|
||||
}
|
||||
|
||||
// BFS queue with [nodeId, depth]
|
||||
const queue: [string, number][] = startingNodeIds.map((id) => [id, 0])
|
||||
|
||||
// Set starting nodes depth to 0
|
||||
startingNodeIds.forEach((id) => {
|
||||
depths[id] = 0
|
||||
})
|
||||
|
||||
while (queue.length > 0) {
|
||||
const [currentNode, currentDepth] = queue.shift()!
|
||||
|
||||
if (visited.has(currentNode)) continue
|
||||
visited.add(currentNode)
|
||||
|
||||
// Process all neighbors
|
||||
for (const neighbor of graph[currentNode]) {
|
||||
if (!visited.has(neighbor)) {
|
||||
// Update depth if unvisited or found shorter path
|
||||
if (depths[neighbor] === -1 || depths[neighbor] > currentDepth + 1) {
|
||||
depths[neighbor] = currentDepth + 1
|
||||
}
|
||||
queue.push([neighbor, currentDepth + 1])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return depths
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to get all nodes in a path starting from a node
|
||||
* @param {INodeDirectedGraph} graph
|
||||
* @param {string} startNode
|
||||
* @returns {string[]}
|
||||
*/
|
||||
export const getAllNodesInPath = (startNode: string, graph: INodeDirectedGraph): string[] => {
|
||||
const nodes = new Set<string>()
|
||||
const queue = [startNode]
|
||||
|
||||
while (queue.length > 0) {
|
||||
const current = queue.shift()!
|
||||
if (nodes.has(current)) continue
|
||||
|
||||
nodes.add(current)
|
||||
if (graph[current]) {
|
||||
queue.push(...graph[current])
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(nodes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user