Feature/lang graph (#2319)

* add langgraph

* datasource: initial commit

* datasource: datasource details and chunks

* datasource: Document Store Node

* more changes

* Document Store - Base functionality

* Document Store Loader Component

* Document Store Loader Component

* before merging the modularity PR

* after merging the modularity PR

* preview mode

* initial draft PR

* fixes

* minor updates and  fixes

* preview with loader and splitter

* preview with credential

* show stored chunks

* preview update...

* edit config

* save, preview and other changes

* save, preview and other changes

* save, process and other changes

* save, process and other changes

* alpha1 - for internal testing

* rerouting urls

* bug fix on new leader create

* pagination support for chunks

* delete document store

* Update pnpm-lock.yaml

* doc store card view

* Update store files to use updated storage functions, Document Store Table View and other changes

* ui changes

* add expanded chunk dialog, improve ui

* change throw Error to InternalError

* Bug Fixes and removal of subFolder, adding of view chunks for store

* lint fixes

* merge changes

* DocumentStoreStatus component

* ui changes for doc store

* add remove metadata key field, add custom document loader

* add chatflows used doc store chips

* add types/interfaces to DocumentStore Services

* document loader list dialog title bar color change

* update interfaces

* Whereused Chatflow Name and Added chunkNo to retain order of created chunks.

* use typeorm order chunkNo, ui changes

* update tabler icons react

* cleanup agents

* add pysandbox tool

* add abort functionality, loading next agent

* add empty view svg

* update chatflow tool with chatId

* rename to agentflows

* update worker for prompt input values

* update dashboard to agentflows, agentcanvas

* fix marketplace use template

* add agentflow templates

* resolve merge conflict

* update baseURL

---------

Co-authored-by: vinodkiran <vinodkiran@usa.net>
Co-authored-by: Vinod Paidimarry <vinodkiran@outlook.in>
This commit is contained in:
Henry Heng
2024-05-21 16:36:42 +01:00
committed by GitHub
parent 95f1090bed
commit 8ebc4dcfd5
92 changed files with 7216 additions and 701 deletions
@@ -0,0 +1,975 @@
{
"description": "Customer support team consisting of Support Representative and Quality Assurance Specialist to handle support tickets",
"nodes": [
{
"id": "supervisor_0",
"position": {
"x": 343.59847938459717,
"y": 124.00657409829381
},
"type": "customNode",
"data": {
"id": "supervisor_0",
"label": "Supervisor",
"version": 1,
"name": "supervisor",
"type": "Supervisor",
"baseClasses": ["Supervisor"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Supervisor Name",
"name": "supervisorName",
"type": "string",
"placeholder": "Supervisor",
"default": "Supervisor",
"id": "supervisor_0-input-supervisorName-string"
},
{
"label": "Supervisor Prompt",
"name": "supervisorPrompt",
"type": "string",
"description": "Prompt must contains {team_members}",
"rows": 4,
"default": "You are a supervisor tasked with managing a conversation between the following workers: {team_members}.\nGiven the following user request, respond with the worker to act next.\nEach worker will perform a task and respond with their results and status.\nWhen finished, respond with FINISH.\nSelect strategically to minimize the number of steps taken.",
"additionalParams": true,
"id": "supervisor_0-input-supervisorPrompt-string"
},
{
"label": "Recursion Limit",
"name": "recursionLimit",
"type": "number",
"description": "Maximum number of times a call can recurse. If not provided, defaults to 100.",
"default": 100,
"additionalParams": true,
"id": "supervisor_0-input-recursionLimit-number"
}
],
"inputAnchors": [
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, GroqChat. Best result with GPT-4 model",
"id": "supervisor_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": "supervisor_0-input-inputModeration-Moderation"
}
],
"inputs": {
"supervisorName": "Supervisor",
"supervisorPrompt": "You are a supervisor tasked with managing a conversation between the following workers: {team_members}.\nGiven the following user request, respond with the worker to act next.\nEach worker will perform a task and respond with their results and status.\nWhen finished, respond with FINISH.\nSelect strategically to minimize the number of steps taken.",
"model": "{{chatOpenAI_0.data.instance}}",
"recursionLimit": 100,
"inputModeration": ""
},
"outputAnchors": [
{
"id": "supervisor_0-output-supervisor-Supervisor",
"name": "supervisor",
"label": "Supervisor",
"description": "",
"type": "Supervisor"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 431,
"selected": false,
"positionAbsolute": {
"x": 343.59847938459717,
"y": 124.00657409829381
},
"dragging": false
},
{
"id": "worker_0",
"position": {
"x": 848.0791314419789,
"y": 550.1251435439353
},
"type": "customNode",
"data": {
"id": "worker_0",
"label": "Worker",
"version": 1,
"name": "worker",
"type": "Worker",
"baseClasses": ["Worker"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Worker Name",
"name": "workerName",
"type": "string",
"placeholder": "Worker",
"id": "worker_0-input-workerName-string"
},
{
"label": "Worker Prompt",
"name": "workerPrompt",
"type": "string",
"rows": 4,
"default": "You are a research assistant who can search for up-to-date info using search engine.",
"id": "worker_0-input-workerPrompt-string"
},
{
"label": "Format Prompt Values",
"name": "promptValues",
"type": "json",
"optional": true,
"acceptVariable": true,
"list": true,
"id": "worker_0-input-promptValues-json"
},
{
"label": "Max Iterations",
"name": "maxIterations",
"type": "number",
"optional": true,
"id": "worker_0-input-maxIterations-number"
}
],
"inputAnchors": [
{
"label": "Tools",
"name": "tools",
"type": "Tool",
"list": true,
"optional": true,
"id": "worker_0-input-tools-Tool"
},
{
"label": "Supervisor",
"name": "supervisor",
"type": "Supervisor",
"id": "worker_0-input-supervisor-Supervisor"
},
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"optional": true,
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, ChatVertexAI, GroqChat. If not specified, supervisor's model will be used",
"id": "worker_0-input-model-BaseChatModel"
}
],
"inputs": {
"workerName": "Quality Assurance Specialist",
"workerPrompt": "You are working at {company} and are now collaborating with your team on a customer request. Your task is to ensure that the support representative delivers the best possible support. It's crucial that the representative provides complete, accurate answers without making any assumptions.\n\nYour objective is to maintain top-tier support quality assurance within your team.\n\nReview the response drafted by the support representative for the customer's inquiry. Make sure the answer is thorough, accurate, and meets the high standards expected in customer support. Confirm that every aspect of the customer's question is addressed comprehensively, with a friendly and helpful tone. Verify that all references and sources used to find the information are included, ensuring the response is well-supported and leaves no questions unanswered.\n\nOnce your review is complete, return it to the Support Representative for finalization.",
"tools": "",
"supervisor": "{{supervisor_0.data.instance}}",
"model": "",
"promptValues": "{\"company\":\"Flowise Inc\"}",
"maxIterations": ""
},
"outputAnchors": [
{
"id": "worker_0-output-worker-Worker",
"name": "worker",
"label": "Worker",
"description": "",
"type": "Worker"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 808,
"positionAbsolute": {
"x": 848.0791314419789,
"y": 550.1251435439353
},
"selected": false,
"dragging": false
},
{
"id": "worker_1",
"position": {
"x": 1573.2919579833303,
"y": -234.22598124451474
},
"type": "customNode",
"data": {
"id": "worker_1",
"label": "Worker",
"version": 1,
"name": "worker",
"type": "Worker",
"baseClasses": ["Worker"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Worker Name",
"name": "workerName",
"type": "string",
"placeholder": "Worker",
"id": "worker_1-input-workerName-string"
},
{
"label": "Worker Prompt",
"name": "workerPrompt",
"type": "string",
"rows": 4,
"default": "You are a research assistant who can search for up-to-date info using search engine.",
"id": "worker_1-input-workerPrompt-string"
},
{
"label": "Format Prompt Values",
"name": "promptValues",
"type": "json",
"optional": true,
"acceptVariable": true,
"list": true,
"id": "worker_1-input-promptValues-json"
},
{
"label": "Max Iterations",
"name": "maxIterations",
"type": "number",
"optional": true,
"id": "worker_1-input-maxIterations-number"
}
],
"inputAnchors": [
{
"label": "Tools",
"name": "tools",
"type": "Tool",
"list": true,
"optional": true,
"id": "worker_1-input-tools-Tool"
},
{
"label": "Supervisor",
"name": "supervisor",
"type": "Supervisor",
"id": "worker_1-input-supervisor-Supervisor"
},
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"optional": true,
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, ChatVertexAI, GroqChat. If not specified, supervisor's model will be used",
"id": "worker_1-input-model-BaseChatModel"
}
],
"inputs": {
"workerName": "Support Representative",
"workerPrompt": "As a representative at {company}, your role is to deliver exceptional customer support. Your objective is to provide the highest quality assistance, ensuring that your answers are comprehensive and based on facts without any assumptions.\n\nYour goal is to strive to be the most friendly and helpful support representative on your team.\n\nHere is your previous conversation with the customer:\n{conversation}\n\nCraft a detailed and informative response to the customer's inquiry, addressing all aspects of their question. Your response should include references to all sources used to find the answer, including external data or solutions. Ensure your answer is thorough, leaving no questions unanswered, while maintaining a friendly and supportive tone throughout.\n\nAlways use the tool provided - search_docs to look for answers. Check if you need to pass the result to Quality Assurance Specialist for review.",
"tools": ["{{retrieverTool_0.data.instance}}"],
"supervisor": "{{supervisor_0.data.instance}}",
"model": "",
"promptValues": "{\"company\":\"Flowise Inc\",\"conversation\":\"{{customFunction_0.data.instance}}\"}",
"maxIterations": ""
},
"outputAnchors": [
{
"id": "worker_1-output-worker-Worker",
"name": "worker",
"label": "Worker",
"description": "",
"type": "Worker"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 808,
"positionAbsolute": {
"x": 1573.2919579833303,
"y": -234.22598124451474
},
"selected": false,
"dragging": false
},
{
"id": "retrieverTool_0",
"position": {
"x": 1136.3773214513722,
"y": -661.7020929797668
},
"type": "customNode",
"data": {
"id": "retrieverTool_0",
"label": "Retriever Tool",
"version": 2,
"name": "retrieverTool",
"type": "RetrieverTool",
"baseClasses": ["RetrieverTool", "DynamicTool", "Tool", "StructuredTool", "Runnable"],
"category": "Tools",
"description": "Use a retriever as allowed tool for agent",
"inputParams": [
{
"label": "Retriever Name",
"name": "name",
"type": "string",
"placeholder": "search_state_of_union",
"id": "retrieverTool_0-input-name-string"
},
{
"label": "Retriever Description",
"name": "description",
"type": "string",
"description": "When should agent uses to retrieve documents",
"rows": 3,
"placeholder": "Searches and returns documents regarding the state-of-the-union.",
"id": "retrieverTool_0-input-description-string"
},
{
"label": "Return Source Documents",
"name": "returnSourceDocuments",
"type": "boolean",
"optional": true,
"id": "retrieverTool_0-input-returnSourceDocuments-boolean"
}
],
"inputAnchors": [
{
"label": "Retriever",
"name": "retriever",
"type": "BaseRetriever",
"id": "retrieverTool_0-input-retriever-BaseRetriever"
}
],
"inputs": {
"name": "search_docs",
"description": "Search and return documents about any issue or bugfix. Always give priority to this tool",
"retriever": "{{pinecone_0.data.instance}}",
"returnSourceDocuments": ""
},
"outputAnchors": [
{
"id": "retrieverTool_0-output-retrieverTool-RetrieverTool|DynamicTool|Tool|StructuredTool|Runnable",
"name": "retrieverTool",
"label": "RetrieverTool",
"description": "Use a retriever as allowed tool for agent",
"type": "RetrieverTool | DynamicTool | Tool | StructuredTool | Runnable"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 602,
"selected": false,
"positionAbsolute": {
"x": 1136.3773214513722,
"y": -661.7020929797668
},
"dragging": false
},
{
"id": "pinecone_0",
"position": {
"x": 767.1744633865214,
"y": -634.6870559540365
},
"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": "flowiseindex",
"pineconeNamespace": "pinecone-flowise-docs",
"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
},
"width": 300,
"height": 604,
"selected": false,
"positionAbsolute": {
"x": 767.1744633865214,
"y": -634.6870559540365
},
"dragging": false
},
{
"id": "openAIEmbeddings_0",
"position": {
"x": 373.4730229546882,
"y": -480.5312248256105
},
"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
},
"width": 300,
"height": 423,
"selected": false,
"positionAbsolute": {
"x": 373.4730229546882,
"y": -480.5312248256105
},
"dragging": false
},
{
"id": "customFunction_0",
"position": {
"x": 1214.8704502141265,
"y": 109.13589410824264
},
"type": "customNode",
"data": {
"id": "customFunction_0",
"label": "Custom JS Function",
"version": 1,
"name": "customFunction",
"type": "CustomFunction",
"baseClasses": ["CustomFunction", "Utilities"],
"category": "Utilities",
"description": "Execute custom javascript function",
"inputParams": [
{
"label": "Input Variables",
"name": "functionInputVariables",
"description": "Input variables can be used in the function with prefix $. For example: $var",
"type": "json",
"optional": true,
"acceptVariable": true,
"list": true,
"id": "customFunction_0-input-functionInputVariables-json"
},
{
"label": "Function Name",
"name": "functionName",
"type": "string",
"optional": true,
"placeholder": "My Function",
"id": "customFunction_0-input-functionName-string"
},
{
"label": "Javascript Function",
"name": "javascriptFunction",
"type": "code",
"id": "customFunction_0-input-javascriptFunction-code"
}
],
"inputAnchors": [],
"inputs": {
"functionInputVariables": "",
"functionName": "",
"javascriptFunction": "// Simulating fetching conversation between system and customer\nconst conversations =[\n {\n \"role\": \"bot\",\n \"content\": \"Hey how can I help you?\",\n },\n {\n \"role\": \"user\",\n \"content\": \"There is a bug when installing Flowise\",\n },\n {\n \"role\": \"bot\",\n \"content\": \"Can you tell me what was the error?\",\n }\n];\n\nreturn conversations;"
},
"outputAnchors": [
{
"name": "output",
"label": "Output",
"type": "options",
"description": "",
"options": [
{
"id": "customFunction_0-output-output-string|number|boolean|json|array",
"name": "output",
"label": "Output",
"description": "",
"type": "string | number | boolean | json | array"
},
{
"id": "customFunction_0-output-EndingNode-CustomFunction",
"name": "EndingNode",
"label": "Ending Node",
"description": "",
"type": "CustomFunction"
}
],
"default": "output"
}
],
"outputs": {
"output": "output"
},
"selected": false
},
"width": 300,
"height": 669,
"selected": false,
"positionAbsolute": {
"x": 1214.8704502141265,
"y": 109.13589410824264
},
"dragging": false
},
{
"id": "chatOpenAI_0",
"position": {
"x": -29.209923556934555,
"y": -53.48197675171315
},
"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-asyncOptions"
},
{
"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-4o",
"temperature": "0",
"maxTokens": "",
"topP": "",
"frequencyPenalty": "",
"presencePenalty": "",
"timeout": "",
"basepath": "",
"baseOptions": "",
"allowImageUploads": "",
"imageResolution": "low"
},
"outputAnchors": [
{
"id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
"name": "chatOpenAI",
"label": "ChatOpenAI",
"description": "Wrapper around OpenAI large language models that use the Chat endpoint",
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 669,
"selected": false,
"positionAbsolute": {
"x": -29.209923556934555,
"y": -53.48197675171315
},
"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"
},
{
"source": "pinecone_0",
"sourceHandle": "pinecone_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever",
"target": "retrieverTool_0",
"targetHandle": "retrieverTool_0-input-retriever-BaseRetriever",
"type": "buttonedge",
"id": "pinecone_0-pinecone_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever-retrieverTool_0-retrieverTool_0-input-retriever-BaseRetriever"
},
{
"source": "retrieverTool_0",
"sourceHandle": "retrieverTool_0-output-retrieverTool-RetrieverTool|DynamicTool|Tool|StructuredTool|Runnable",
"target": "worker_1",
"targetHandle": "worker_1-input-tools-Tool",
"type": "buttonedge",
"id": "retrieverTool_0-retrieverTool_0-output-retrieverTool-RetrieverTool|DynamicTool|Tool|StructuredTool|Runnable-worker_1-worker_1-input-tools-Tool"
},
{
"source": "supervisor_0",
"sourceHandle": "supervisor_0-output-supervisor-Supervisor",
"target": "worker_1",
"targetHandle": "worker_1-input-supervisor-Supervisor",
"type": "buttonedge",
"id": "supervisor_0-supervisor_0-output-supervisor-Supervisor-worker_1-worker_1-input-supervisor-Supervisor"
},
{
"source": "supervisor_0",
"sourceHandle": "supervisor_0-output-supervisor-Supervisor",
"target": "worker_0",
"targetHandle": "worker_0-input-supervisor-Supervisor",
"type": "buttonedge",
"id": "supervisor_0-supervisor_0-output-supervisor-Supervisor-worker_0-worker_0-input-supervisor-Supervisor"
},
{
"source": "customFunction_0",
"sourceHandle": "customFunction_0-output-output-string|number|boolean|json|array",
"target": "worker_1",
"targetHandle": "worker_1-input-promptValues-json",
"type": "buttonedge",
"id": "customFunction_0-customFunction_0-output-output-string|number|boolean|json|array-worker_1-worker_1-input-promptValues-json"
},
{
"source": "chatOpenAI_0",
"sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
"target": "supervisor_0",
"targetHandle": "supervisor_0-input-model-BaseChatModel",
"type": "buttonedge",
"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-supervisor_0-supervisor_0-input-model-BaseChatModel"
}
]
}
@@ -0,0 +1,560 @@
{
"description": "Research leads and create personalized email drafts for sales team",
"nodes": [
{
"id": "supervisor_0",
"position": {
"x": 528,
"y": 241
},
"type": "customNode",
"data": {
"id": "supervisor_0",
"label": "Supervisor",
"version": 1,
"name": "supervisor",
"type": "Supervisor",
"baseClasses": ["Supervisor"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Supervisor Name",
"name": "supervisorName",
"type": "string",
"placeholder": "Supervisor",
"default": "Supervisor",
"id": "supervisor_0-input-supervisorName-string"
},
{
"label": "Supervisor Prompt",
"name": "supervisorPrompt",
"type": "string",
"description": "Prompt must contains {team_members}",
"rows": 4,
"default": "You are a supervisor tasked with managing a conversation between the following workers: {team_members}.\nGiven the following user request, respond with the worker to act next.\nEach worker will perform a task and respond with their results and status.\nWhen finished, respond with FINISH.\nSelect strategically to minimize the number of steps taken.",
"additionalParams": true,
"id": "supervisor_0-input-supervisorPrompt-string"
},
{
"label": "Recursion Limit",
"name": "recursionLimit",
"type": "number",
"description": "Maximum number of times a call can recurse. If not provided, defaults to 100.",
"default": 100,
"additionalParams": true,
"id": "supervisor_0-input-recursionLimit-number"
}
],
"inputAnchors": [
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, GroqChat. Best result with GPT-4 model",
"id": "supervisor_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": "supervisor_0-input-inputModeration-Moderation"
}
],
"inputs": {
"supervisorName": "Supervisor",
"supervisorPrompt": "You are a supervisor tasked with managing a conversation between the following workers: {team_members}.\nGiven the following user request, respond with the worker to act next.\nEach worker will perform a task and respond with their results and status.\nWhen finished, respond with FINISH.\nSelect strategically to minimize the number of steps taken.",
"model": "{{chatOpenAI_0.data.instance}}",
"recursionLimit": 100,
"inputModeration": ""
},
"outputAnchors": [
{
"id": "supervisor_0-output-supervisor-Supervisor",
"name": "supervisor",
"label": "Supervisor",
"description": "",
"type": "Supervisor"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 431,
"positionAbsolute": {
"x": 528,
"y": 241
},
"selected": false
},
{
"id": "chatOpenAI_0",
"position": {
"x": 141.20413030236358,
"y": 37.29175117907283
},
"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-asyncOptions"
},
{
"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-4o",
"temperature": 0.9,
"maxTokens": "",
"topP": "",
"frequencyPenalty": "",
"presencePenalty": "",
"timeout": "",
"basepath": "",
"baseOptions": "",
"allowImageUploads": "",
"imageResolution": "low"
},
"outputAnchors": [
{
"id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
"name": "chatOpenAI",
"label": "ChatOpenAI",
"description": "Wrapper around OpenAI large language models that use the Chat endpoint",
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 669,
"selected": false,
"positionAbsolute": {
"x": 141.20413030236358,
"y": 37.29175117907283
},
"dragging": false
},
{
"id": "worker_0",
"position": {
"x": 918.2245199532538,
"y": 112.34294138561228
},
"type": "customNode",
"data": {
"id": "worker_0",
"label": "Worker",
"version": 1,
"name": "worker",
"type": "Worker",
"baseClasses": ["Worker"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Worker Name",
"name": "workerName",
"type": "string",
"placeholder": "Worker",
"id": "worker_0-input-workerName-string"
},
{
"label": "Worker Prompt",
"name": "workerPrompt",
"type": "string",
"rows": 4,
"default": "You are a research assistant who can search for up-to-date info using search engine.",
"id": "worker_0-input-workerPrompt-string"
},
{
"label": "Format Prompt Values",
"name": "promptValues",
"type": "json",
"optional": true,
"acceptVariable": true,
"list": true,
"id": "worker_0-input-promptValues-json"
},
{
"label": "Max Iterations",
"name": "maxIterations",
"type": "number",
"optional": true,
"id": "worker_0-input-maxIterations-number"
}
],
"inputAnchors": [
{
"label": "Tools",
"name": "tools",
"type": "Tool",
"list": true,
"optional": true,
"id": "worker_0-input-tools-Tool"
},
{
"label": "Supervisor",
"name": "supervisor",
"type": "Supervisor",
"id": "worker_0-input-supervisor-Supervisor"
},
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"optional": true,
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, ChatVertexAI, GroqChat. If not specified, supervisor's model will be used",
"id": "worker_0-input-model-BaseChatModel"
}
],
"inputs": {
"workerName": "Lead Research",
"workerPrompt": "As a member of the sales team at {company}, your mission is to explore the digital landscape for potential leads. Equipped with advanced tools and a strategic approach, you analyze data, trends, and interactions to discover opportunities that others might miss. Your efforts are vital in creating pathways for meaningful engagements and driving the company's growth.\n\nYour goal is to identify high-value leads that align with our ideal customer profile.\n\nPerform a thorough analysis of {lead_company}, a company that has recently shown interest in our solutions. Use all available data sources to create a detailed profile, concentrating on key decision-makers, recent business developments, and potential needs that match our offerings. This task is essential for effectively customizing our engagement strategy.\n\nAvoid making assumptions and only use information you are certain about.\n\nYou should produce a comprehensive report on {lead_person}, including company background, key personnel, recent milestones, and identified needs. Emphasize potential areas where our solutions can add value and suggest tailored engagement strategies. Pass the info to Lead Sales Representative.",
"tools": ["{{googleCustomSearch_0.data.instance}}"],
"supervisor": "{{supervisor_0.data.instance}}",
"model": "",
"promptValues": "{\"company\":\"Flowise Inc\",\"lead_company\":\"Langchain\",\"lead_person\":\"Harrison Chase\"}",
"maxIterations": ""
},
"outputAnchors": [
{
"id": "worker_0-output-worker-Worker",
"name": "worker",
"label": "Worker",
"description": "",
"type": "Worker"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 808,
"selected": false,
"positionAbsolute": {
"x": 918.2245199532538,
"y": 112.34294138561228
},
"dragging": false
},
{
"id": "worker_1",
"position": {
"x": 1318.2245199532538,
"y": 112.34294138561228
},
"type": "customNode",
"data": {
"id": "worker_1",
"label": "Worker",
"version": 1,
"name": "worker",
"type": "Worker",
"baseClasses": ["Worker"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Worker Name",
"name": "workerName",
"type": "string",
"placeholder": "Worker",
"id": "worker_1-input-workerName-string"
},
{
"label": "Worker Prompt",
"name": "workerPrompt",
"type": "string",
"rows": 4,
"default": "You are a research assistant who can search for up-to-date info using search engine.",
"id": "worker_1-input-workerPrompt-string"
},
{
"label": "Format Prompt Values",
"name": "promptValues",
"type": "json",
"optional": true,
"acceptVariable": true,
"list": true,
"id": "worker_1-input-promptValues-json"
},
{
"label": "Max Iterations",
"name": "maxIterations",
"type": "number",
"optional": true,
"id": "worker_1-input-maxIterations-number"
}
],
"inputAnchors": [
{
"label": "Tools",
"name": "tools",
"type": "Tool",
"list": true,
"optional": true,
"id": "worker_1-input-tools-Tool"
},
{
"label": "Supervisor",
"name": "supervisor",
"type": "Supervisor",
"id": "worker_1-input-supervisor-Supervisor"
},
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"optional": true,
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, ChatVertexAI, GroqChat. If not specified, supervisor's model will be used",
"id": "worker_1-input-model-BaseChatModel"
}
],
"inputs": {
"workerName": "Lead Sales Representative",
"workerPrompt": "You play a crucial role within {company} as the link between potential clients and the solutions they need. By crafting engaging, personalized messages, you not only inform leads about our company offerings but also make them feel valued and understood. Your role is essential in transforming interest into action, guiding leads from initial curiosity to committed engagement.\n\nYour goal is to nurture leads with tailored, compelling communications.\n\nLeveraging the insights from the lead profiling report on {lead_company}, create a personalized outreach campaign targeting {lead_person}, the {position} of {lead_company}. he campaign should highlight their recent {lead_activity} and demonstrate how our solutions can support their objectives. Your communication should align with {lead_company}'s company culture and values, showcasing a thorough understanding of their business and needs. Avoid making assumptions and use only verified information.\n\nThe output should be a series of personalized email drafts customized for {lead_company}, specifically addressing {lead_person}. Each draft should present a compelling narrative that connects our solutions to their recent accomplishments and future goals. Ensure the tone is engaging, professional, and consistent with {lead_company}'s corporate identity. Keep in natural, don't use strange and fancy words.",
"tools": "",
"supervisor": "{{supervisor_0.data.instance}}",
"model": "",
"promptValues": "{\"company\":\"Flowise Inc\",\"lead_company\":\"Langchain\",\"lead_person\":\"Harrison Chase\",\"position\":\"CEO\",\"lead_activity\":\"Langgraph launch\"}",
"maxIterations": ""
},
"outputAnchors": [
{
"id": "worker_1-output-worker-Worker",
"name": "worker",
"label": "Worker",
"description": "",
"type": "Worker"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 808,
"selected": false,
"positionAbsolute": {
"x": 1318.2245199532538,
"y": 112.34294138561228
},
"dragging": false
},
{
"id": "googleCustomSearch_0",
"position": {
"x": 542.5920618578143,
"y": -102.36639408227376
},
"type": "customNode",
"data": {
"id": "googleCustomSearch_0",
"label": "Google Custom Search",
"version": 1,
"name": "googleCustomSearch",
"type": "GoogleCustomSearchAPI",
"baseClasses": ["GoogleCustomSearchAPI", "Tool", "StructuredTool", "Runnable"],
"category": "Tools",
"description": "Wrapper around Google Custom Search API - a real-time API to access Google search results",
"inputParams": [
{
"label": "Connect Credential",
"name": "credential",
"type": "credential",
"credentialNames": ["googleCustomSearchApi"],
"id": "googleCustomSearch_0-input-credential-credential"
}
],
"inputAnchors": [],
"inputs": {},
"outputAnchors": [
{
"id": "googleCustomSearch_0-output-googleCustomSearch-GoogleCustomSearchAPI|Tool|StructuredTool|Runnable",
"name": "googleCustomSearch",
"label": "GoogleCustomSearchAPI",
"description": "Wrapper around Google Custom Search API - a real-time API to access Google search results",
"type": "GoogleCustomSearchAPI | Tool | StructuredTool | Runnable"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 275,
"selected": false,
"positionAbsolute": {
"x": 542.5920618578143,
"y": -102.36639408227376
},
"dragging": false
}
],
"edges": [
{
"source": "supervisor_0",
"sourceHandle": "supervisor_0-output-supervisor-Supervisor",
"target": "worker_0",
"targetHandle": "worker_0-input-supervisor-Supervisor",
"type": "buttonedge",
"id": "supervisor_0-supervisor_0-output-supervisor-Supervisor-worker_0-worker_0-input-supervisor-Supervisor"
},
{
"source": "supervisor_0",
"sourceHandle": "supervisor_0-output-supervisor-Supervisor",
"target": "worker_1",
"targetHandle": "worker_1-input-supervisor-Supervisor",
"type": "buttonedge",
"id": "supervisor_0-supervisor_0-output-supervisor-Supervisor-worker_1-worker_1-input-supervisor-Supervisor"
},
{
"source": "googleCustomSearch_0",
"sourceHandle": "googleCustomSearch_0-output-googleCustomSearch-GoogleCustomSearchAPI|Tool|StructuredTool|Runnable",
"target": "worker_0",
"targetHandle": "worker_0-input-tools-Tool",
"type": "buttonedge",
"id": "googleCustomSearch_0-googleCustomSearch_0-output-googleCustomSearch-GoogleCustomSearchAPI|Tool|StructuredTool|Runnable-worker_0-worker_0-input-tools-Tool"
},
{
"source": "chatOpenAI_0",
"sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
"target": "supervisor_0",
"targetHandle": "supervisor_0-input-model-BaseChatModel",
"type": "buttonedge",
"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-supervisor_0-supervisor_0-input-model-BaseChatModel"
}
]
}
@@ -0,0 +1,783 @@
{
"description": "A team of portfolio manager, financial analyst, and risk manager working together to optimize an investment portfolio.",
"nodes": [
{
"id": "supervisor_0",
"position": {
"x": 242.0267719253082,
"y": 185.62152813526978
},
"type": "customNode",
"data": {
"id": "supervisor_0",
"label": "Supervisor",
"version": 1,
"name": "supervisor",
"type": "Supervisor",
"baseClasses": ["Supervisor"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Supervisor Name",
"name": "supervisorName",
"type": "string",
"placeholder": "Supervisor",
"default": "Supervisor",
"id": "supervisor_0-input-supervisorName-string"
},
{
"label": "Supervisor Prompt",
"name": "supervisorPrompt",
"type": "string",
"description": "Prompt must contains {team_members}",
"rows": 4,
"default": "You are a supervisor tasked with managing a conversation between the following workers: {team_members}.\nGiven the following user request, respond with the worker to act next.\nEach worker will perform a task and respond with their results and status.\nWhen finished, respond with FINISH.\nSelect strategically to minimize the number of steps taken.",
"additionalParams": true,
"id": "supervisor_0-input-supervisorPrompt-string"
},
{
"label": "Recursion Limit",
"name": "recursionLimit",
"type": "number",
"description": "Maximum number of times a call can recurse. If not provided, defaults to 100.",
"default": 100,
"additionalParams": true,
"id": "supervisor_0-input-recursionLimit-number"
}
],
"inputAnchors": [
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, GroqChat. Best result with GPT-4 model",
"id": "supervisor_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": "supervisor_0-input-inputModeration-Moderation"
}
],
"inputs": {
"supervisorName": "Supervisor",
"supervisorPrompt": "You are a supervisor tasked with managing a conversation between the following workers: {team_members}.\nGiven the following user request, respond with the worker to act next.\nEach worker will perform a task and respond with their results and status.\nWhen finished, respond with FINISH.\nSelect strategically to minimize the number of steps taken.",
"model": "{{chatOpenAI_0.data.instance}}",
"recursionLimit": 100,
"inputModeration": ""
},
"outputAnchors": [
{
"id": "supervisor_0-output-supervisor-Supervisor",
"name": "supervisor",
"label": "Supervisor",
"description": "",
"type": "Supervisor"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 431,
"selected": false,
"positionAbsolute": {
"x": 242.0267719253082,
"y": 185.62152813526978
},
"dragging": false
},
{
"id": "worker_0",
"position": {
"x": 637.3247841463353,
"y": 115.189653148269
},
"type": "customNode",
"data": {
"id": "worker_0",
"label": "Worker",
"version": 1,
"name": "worker",
"type": "Worker",
"baseClasses": ["Worker"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Worker Name",
"name": "workerName",
"type": "string",
"placeholder": "Worker",
"id": "worker_0-input-workerName-string"
},
{
"label": "Worker Prompt",
"name": "workerPrompt",
"type": "string",
"rows": 4,
"default": "You are a research assistant who can search for up-to-date info using search engine.",
"id": "worker_0-input-workerPrompt-string"
},
{
"label": "Format Prompt Values",
"name": "promptValues",
"type": "json",
"optional": true,
"acceptVariable": true,
"list": true,
"id": "worker_0-input-promptValues-json"
},
{
"label": "Max Iterations",
"name": "maxIterations",
"type": "number",
"optional": true,
"id": "worker_0-input-maxIterations-number"
}
],
"inputAnchors": [
{
"label": "Tools",
"name": "tools",
"type": "Tool",
"list": true,
"optional": true,
"id": "worker_0-input-tools-Tool"
},
{
"label": "Supervisor",
"name": "supervisor",
"type": "Supervisor",
"id": "worker_0-input-supervisor-Supervisor"
},
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"optional": true,
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, ChatVertexAI, GroqChat. If not specified, supervisor's model will be used",
"id": "worker_0-input-model-BaseChatModel"
}
],
"inputs": {
"workerName": "Portfolio Manager",
"workerPrompt": "As the Portfolio Manager at {company}, you play a crucial role in overseeing and optimizing our investment portfolio. Your expertise in market analysis, strategic planning, and risk management is essential for making informed investment decisions that drive our financial growth.\n\nYour goal is to develop and implement effective investment strategies that align with our clients' financial goals and risk tolerance.\n\nAnalyze market trends, economic data, and financial reports to identify potential investment opportunities. Collaborate with the Financial Analyst and Risk Manager to ensure that your strategies are well-informed and balanced. Continuously monitor the portfolio's performance and make adjustments as necessary to maximize returns while managing risk.\n\nYour task is to create a comprehensive investment strategy for {portfolio_name}, taking into account the client's financial objectives and risk tolerance. Ensure that your strategy is backed by thorough market research and financial analysis, and includes a plan for regular performance reviews and adjustments.\n\nThe output should be a detailed investment strategy report for {portfolio_name}, including market analysis, recommended investments, risk management approaches, and performance monitoring plans. Ensure that the strategy is designed to achieve the client's financial goals while maintaining an appropriate risk level.",
"tools": ["{{googleCustomSearch_0.data.instance}}"],
"supervisor": "{{supervisor_0.data.instance}}",
"model": "",
"promptValues": "{\"company\":\"Flowise Inc\",\"portfolio_name\":\"Tesla Inc\"}",
"maxIterations": ""
},
"outputAnchors": [
{
"id": "worker_0-output-worker-Worker",
"name": "worker",
"label": "Worker",
"description": "",
"type": "Worker"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 808,
"selected": false,
"positionAbsolute": {
"x": 637.3247841463353,
"y": 115.189653148269
},
"dragging": false
},
{
"id": "worker_1",
"position": {
"x": 1037.3247841463353,
"y": 115.189653148269
},
"type": "customNode",
"data": {
"id": "worker_1",
"label": "Worker",
"version": 1,
"name": "worker",
"type": "Worker",
"baseClasses": ["Worker"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Worker Name",
"name": "workerName",
"type": "string",
"placeholder": "Worker",
"id": "worker_1-input-workerName-string"
},
{
"label": "Worker Prompt",
"name": "workerPrompt",
"type": "string",
"rows": 4,
"default": "You are a research assistant who can search for up-to-date info using search engine.",
"id": "worker_1-input-workerPrompt-string"
},
{
"label": "Format Prompt Values",
"name": "promptValues",
"type": "json",
"optional": true,
"acceptVariable": true,
"list": true,
"id": "worker_1-input-promptValues-json"
},
{
"label": "Max Iterations",
"name": "maxIterations",
"type": "number",
"optional": true,
"id": "worker_1-input-maxIterations-number"
}
],
"inputAnchors": [
{
"label": "Tools",
"name": "tools",
"type": "Tool",
"list": true,
"optional": true,
"id": "worker_1-input-tools-Tool"
},
{
"label": "Supervisor",
"name": "supervisor",
"type": "Supervisor",
"id": "worker_1-input-supervisor-Supervisor"
},
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"optional": true,
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, ChatVertexAI, GroqChat. If not specified, supervisor's model will be used",
"id": "worker_1-input-model-BaseChatModel"
}
],
"inputs": {
"workerName": "Financial Analyst",
"workerPrompt": "As a Financial Analyst at {company}, you are a vital member of our portfolio management team, providing in-depth research and analysis to support informed investment decisions. Your analytical skills and market insights are key to identifying profitable opportunities and enhancing the overall performance of our portfolio.\n\nYour goal is to conduct thorough financial analysis and market research to support the Portfolio Manager in developing effective investment strategies.\n\nAnalyze financial data, market trends, and economic indicators to identify potential investment opportunities. Prepare detailed reports and presentations that highlight your findings and recommendations. Collaborate closely with the Portfolio Manager and Risk Manager to ensure that your analyses contribute to well-informed and balanced investment strategies.\n\nYour task is to perform a comprehensive analysis of {investment_opportunity} for inclusion in {portfolio_name}. Use various financial metrics and market data to evaluate the potential risks and returns. Provide clear, actionable insights and recommendations based on your analysis.\n\nThe output should be a detailed financial analysis report for {investment_opportunity}, including key financial metrics, market trends, risk assessment, and your investment recommendation. Ensure that the report is well-supported by data and provides valuable insights to inform the Portfolio Manager's decision-making process.",
"tools": ["{{googleCustomSearch_1.data.instance}}"],
"supervisor": "{{supervisor_0.data.instance}}",
"model": "",
"promptValues": "{\"company\":\"Flowise Inc\",\"investment_opportunity\":\"Tech Summit Fund\",\"portfolio_name\":\"Tesla Inc\"}",
"maxIterations": ""
},
"outputAnchors": [
{
"id": "worker_1-output-worker-Worker",
"name": "worker",
"label": "Worker",
"description": "",
"type": "Worker"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 808,
"selected": false,
"positionAbsolute": {
"x": 1037.3247841463353,
"y": 115.189653148269
},
"dragging": false
},
{
"id": "worker_2",
"position": {
"x": 1482.836195011232,
"y": 119.54481208270889
},
"type": "customNode",
"data": {
"id": "worker_2",
"label": "Worker",
"version": 1,
"name": "worker",
"type": "Worker",
"baseClasses": ["Worker"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Worker Name",
"name": "workerName",
"type": "string",
"placeholder": "Worker",
"id": "worker_2-input-workerName-string"
},
{
"label": "Worker Prompt",
"name": "workerPrompt",
"type": "string",
"rows": 4,
"default": "You are a research assistant who can search for up-to-date info using search engine.",
"id": "worker_2-input-workerPrompt-string"
},
{
"label": "Format Prompt Values",
"name": "promptValues",
"type": "json",
"optional": true,
"acceptVariable": true,
"list": true,
"id": "worker_2-input-promptValues-json"
},
{
"label": "Max Iterations",
"name": "maxIterations",
"type": "number",
"optional": true,
"id": "worker_2-input-maxIterations-number"
}
],
"inputAnchors": [
{
"label": "Tools",
"name": "tools",
"type": "Tool",
"list": true,
"optional": true,
"id": "worker_2-input-tools-Tool"
},
{
"label": "Supervisor",
"name": "supervisor",
"type": "Supervisor",
"id": "worker_2-input-supervisor-Supervisor"
},
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"optional": true,
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, ChatVertexAI, GroqChat. If not specified, supervisor's model will be used",
"id": "worker_2-input-model-BaseChatModel"
}
],
"inputs": {
"workerName": "Risk Manager",
"workerPrompt": "As the Risk Manager at {company}, you play a pivotal role in ensuring the stability and resilience of our investment portfolio. Your expertise in risk assessment and mitigation is essential for maintaining an appropriate balance between risk and return, aligning with our clients' risk tolerance and financial goals.\n\nYour goal is to identify, assess, and mitigate risks associated with the investment portfolio to safeguard its performance and align with our clients' risk tolerance.\n\nEvaluate potential risks for current and prospective investments using quantitative and qualitative analysis. Collaborate with the Portfolio Manager and Financial Analyst to integrate risk management strategies into the overall investment approach. Continuously monitor the portfolio to identify emerging risks and implement measures to mitigate them.\n\nYour task is to perform a comprehensive risk assessment for {portfolio_name}, focusing on potential market, credit, and operational risks. Develop and recommend risk mitigation strategies that align with the client's risk tolerance and investment objectives.\n\nThe output should be a detailed risk assessment report for {portfolio_name}, including identification of key risks, risk metrics, and recommended mitigation strategies. Ensure that the report provides actionable insights and supports the Portfolio Manager in maintaining a balanced and resilient portfolio.",
"tools": ["{{googleCustomSearch_2.data.instance}}"],
"supervisor": "{{supervisor_0.data.instance}}",
"model": "",
"promptValues": "{\"company\":\"Flowise Inc\",\"portfolio_name\":\"Tesla Inc\"}",
"maxIterations": ""
},
"outputAnchors": [
{
"id": "worker_2-output-worker-Worker",
"name": "worker",
"label": "Worker",
"description": "",
"type": "Worker"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 808,
"selected": false,
"positionAbsolute": {
"x": 1482.836195011232,
"y": 119.54481208270889
},
"dragging": false
},
{
"id": "chatOpenAI_0",
"position": {
"x": -120.80560304817006,
"y": 71.63806380387018
},
"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-asyncOptions"
},
{
"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-4o",
"temperature": "0",
"maxTokens": "",
"topP": "",
"frequencyPenalty": "",
"presencePenalty": "",
"timeout": "",
"basepath": "",
"baseOptions": "",
"allowImageUploads": "",
"imageResolution": "low"
},
"outputAnchors": [
{
"id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
"name": "chatOpenAI",
"label": "ChatOpenAI",
"description": "Wrapper around OpenAI large language models that use the Chat endpoint",
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 669,
"selected": false,
"positionAbsolute": {
"x": -120.80560304817006,
"y": 71.63806380387018
},
"dragging": false
},
{
"id": "googleCustomSearch_0",
"position": {
"x": 268.39206549032804,
"y": -209.224097209214
},
"type": "customNode",
"data": {
"id": "googleCustomSearch_0",
"label": "Google Custom Search",
"version": 1,
"name": "googleCustomSearch",
"type": "GoogleCustomSearchAPI",
"baseClasses": ["GoogleCustomSearchAPI", "Tool", "StructuredTool", "Runnable"],
"category": "Tools",
"description": "Wrapper around Google Custom Search API - a real-time API to access Google search results",
"inputParams": [
{
"label": "Connect Credential",
"name": "credential",
"type": "credential",
"credentialNames": ["googleCustomSearchApi"],
"id": "googleCustomSearch_0-input-credential-credential"
}
],
"inputAnchors": [],
"inputs": {},
"outputAnchors": [
{
"id": "googleCustomSearch_0-output-googleCustomSearch-GoogleCustomSearchAPI|Tool|StructuredTool|Runnable",
"name": "googleCustomSearch",
"label": "GoogleCustomSearchAPI",
"description": "Wrapper around Google Custom Search API - a real-time API to access Google search results",
"type": "GoogleCustomSearchAPI | Tool | StructuredTool | Runnable"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 275,
"selected": false,
"positionAbsolute": {
"x": 268.39206549032804,
"y": -209.224097209214
},
"dragging": false
},
{
"id": "googleCustomSearch_1",
"position": {
"x": 708.2007597123056,
"y": -214.21906914647434
},
"type": "customNode",
"data": {
"id": "googleCustomSearch_1",
"label": "Google Custom Search",
"version": 1,
"name": "googleCustomSearch",
"type": "GoogleCustomSearchAPI",
"baseClasses": ["GoogleCustomSearchAPI", "Tool", "StructuredTool", "Runnable"],
"category": "Tools",
"description": "Wrapper around Google Custom Search API - a real-time API to access Google search results",
"inputParams": [
{
"label": "Connect Credential",
"name": "credential",
"type": "credential",
"credentialNames": ["googleCustomSearchApi"],
"id": "googleCustomSearch_1-input-credential-credential"
}
],
"inputAnchors": [],
"inputs": {},
"outputAnchors": [
{
"id": "googleCustomSearch_1-output-googleCustomSearch-GoogleCustomSearchAPI|Tool|StructuredTool|Runnable",
"name": "googleCustomSearch",
"label": "GoogleCustomSearchAPI",
"description": "Wrapper around Google Custom Search API - a real-time API to access Google search results",
"type": "GoogleCustomSearchAPI | Tool | StructuredTool | Runnable"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 275,
"selected": false,
"positionAbsolute": {
"x": 708.2007597123056,
"y": -214.21906914647434
},
"dragging": false
},
{
"id": "googleCustomSearch_2",
"position": {
"x": 1148.6913242910439,
"y": -216.29397639610963
},
"type": "customNode",
"data": {
"id": "googleCustomSearch_2",
"label": "Google Custom Search",
"version": 1,
"name": "googleCustomSearch",
"type": "GoogleCustomSearchAPI",
"baseClasses": ["GoogleCustomSearchAPI", "Tool", "StructuredTool", "Runnable"],
"category": "Tools",
"description": "Wrapper around Google Custom Search API - a real-time API to access Google search results",
"inputParams": [
{
"label": "Connect Credential",
"name": "credential",
"type": "credential",
"credentialNames": ["googleCustomSearchApi"],
"id": "googleCustomSearch_2-input-credential-credential"
}
],
"inputAnchors": [],
"inputs": {},
"outputAnchors": [
{
"id": "googleCustomSearch_2-output-googleCustomSearch-GoogleCustomSearchAPI|Tool|StructuredTool|Runnable",
"name": "googleCustomSearch",
"label": "GoogleCustomSearchAPI",
"description": "Wrapper around Google Custom Search API - a real-time API to access Google search results",
"type": "GoogleCustomSearchAPI | Tool | StructuredTool | Runnable"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 275,
"selected": false,
"positionAbsolute": {
"x": 1148.6913242910439,
"y": -216.29397639610963
},
"dragging": false
}
],
"edges": [
{
"source": "googleCustomSearch_0",
"sourceHandle": "googleCustomSearch_0-output-googleCustomSearch-GoogleCustomSearchAPI|Tool|StructuredTool|Runnable",
"target": "worker_0",
"targetHandle": "worker_0-input-tools-Tool",
"type": "buttonedge",
"id": "googleCustomSearch_0-googleCustomSearch_0-output-googleCustomSearch-GoogleCustomSearchAPI|Tool|StructuredTool|Runnable-worker_0-worker_0-input-tools-Tool"
},
{
"source": "googleCustomSearch_1",
"sourceHandle": "googleCustomSearch_1-output-googleCustomSearch-GoogleCustomSearchAPI|Tool|StructuredTool|Runnable",
"target": "worker_1",
"targetHandle": "worker_1-input-tools-Tool",
"type": "buttonedge",
"id": "googleCustomSearch_1-googleCustomSearch_1-output-googleCustomSearch-GoogleCustomSearchAPI|Tool|StructuredTool|Runnable-worker_1-worker_1-input-tools-Tool"
},
{
"source": "googleCustomSearch_2",
"sourceHandle": "googleCustomSearch_2-output-googleCustomSearch-GoogleCustomSearchAPI|Tool|StructuredTool|Runnable",
"target": "worker_2",
"targetHandle": "worker_2-input-tools-Tool",
"type": "buttonedge",
"id": "googleCustomSearch_2-googleCustomSearch_2-output-googleCustomSearch-GoogleCustomSearchAPI|Tool|StructuredTool|Runnable-worker_2-worker_2-input-tools-Tool"
},
{
"source": "chatOpenAI_0",
"sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
"target": "supervisor_0",
"targetHandle": "supervisor_0-input-model-BaseChatModel",
"type": "buttonedge",
"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-supervisor_0-supervisor_0-input-model-BaseChatModel"
},
{
"source": "supervisor_0",
"sourceHandle": "supervisor_0-output-supervisor-Supervisor",
"target": "worker_0",
"targetHandle": "worker_0-input-supervisor-Supervisor",
"type": "buttonedge",
"id": "supervisor_0-supervisor_0-output-supervisor-Supervisor-worker_0-worker_0-input-supervisor-Supervisor"
},
{
"source": "supervisor_0",
"sourceHandle": "supervisor_0-output-supervisor-Supervisor",
"target": "worker_1",
"targetHandle": "worker_1-input-supervisor-Supervisor",
"type": "buttonedge",
"id": "supervisor_0-supervisor_0-output-supervisor-Supervisor-worker_1-worker_1-input-supervisor-Supervisor"
},
{
"source": "supervisor_0",
"sourceHandle": "supervisor_0-output-supervisor-Supervisor",
"target": "worker_2",
"targetHandle": "worker_2-input-supervisor-Supervisor",
"type": "buttonedge",
"id": "supervisor_0-supervisor_0-output-supervisor-Supervisor-worker_2-worker_2-input-supervisor-Supervisor"
}
]
}
@@ -0,0 +1,504 @@
{
"description": "Software engineering team working together to build a feature, solve a problem, or complete a task.",
"nodes": [
{
"id": "supervisor_0",
"position": {
"x": 577,
"y": 156
},
"type": "customNode",
"data": {
"id": "supervisor_0",
"label": "Supervisor",
"version": 1,
"name": "supervisor",
"type": "Supervisor",
"baseClasses": ["Supervisor"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Supervisor Name",
"name": "supervisorName",
"type": "string",
"placeholder": "Supervisor",
"default": "Supervisor",
"id": "supervisor_0-input-supervisorName-string"
},
{
"label": "Supervisor Prompt",
"name": "supervisorPrompt",
"type": "string",
"description": "Prompt must contains {team_members}",
"rows": 4,
"default": "You are a supervisor tasked with managing a conversation between the following workers: {team_members}.\nGiven the following user request, respond with the worker to act next.\nEach worker will perform a task and respond with their results and status.\nWhen finished, respond with FINISH.\nSelect strategically to minimize the number of steps taken.",
"additionalParams": true,
"id": "supervisor_0-input-supervisorPrompt-string"
},
{
"label": "Recursion Limit",
"name": "recursionLimit",
"type": "number",
"description": "Maximum number of times a call can recurse. If not provided, defaults to 100.",
"default": 100,
"additionalParams": true,
"id": "supervisor_0-input-recursionLimit-number"
}
],
"inputAnchors": [
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, GroqChat. Best result with GPT-4 model",
"id": "supervisor_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": "supervisor_0-input-inputModeration-Moderation"
}
],
"inputs": {
"supervisorName": "Supervisor",
"supervisorPrompt": "You are a supervisor tasked with managing a conversation between the following workers: {team_members}.\nGiven the following user request, respond with the worker to act next.\nEach worker will perform a task and respond with their results and status.\nWhen finished, respond with FINISH.\nSelect strategically to minimize the number of steps taken.",
"model": "{{chatOpenAI_0.data.instance}}",
"recursionLimit": 100,
"inputModeration": ""
},
"outputAnchors": [
{
"id": "supervisor_0-output-supervisor-Supervisor",
"name": "supervisor",
"label": "Supervisor",
"description": "",
"type": "Supervisor"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 431,
"positionAbsolute": {
"x": 577,
"y": 156
},
"selected": false
},
{
"id": "worker_0",
"position": {
"x": 969.3717362716295,
"y": 77.52271438462338
},
"type": "customNode",
"data": {
"id": "worker_0",
"label": "Worker",
"version": 1,
"name": "worker",
"type": "Worker",
"baseClasses": ["Worker"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Worker Name",
"name": "workerName",
"type": "string",
"placeholder": "Worker",
"id": "worker_0-input-workerName-string"
},
{
"label": "Worker Prompt",
"name": "workerPrompt",
"type": "string",
"rows": 4,
"default": "You are a research assistant who can search for up-to-date info using search engine.",
"id": "worker_0-input-workerPrompt-string"
},
{
"label": "Format Prompt Values",
"name": "promptValues",
"type": "json",
"optional": true,
"acceptVariable": true,
"list": true,
"id": "worker_0-input-promptValues-json"
},
{
"label": "Max Iterations",
"name": "maxIterations",
"type": "number",
"optional": true,
"id": "worker_0-input-maxIterations-number"
}
],
"inputAnchors": [
{
"label": "Tools",
"name": "tools",
"type": "Tool",
"list": true,
"optional": true,
"id": "worker_0-input-tools-Tool"
},
{
"label": "Supervisor",
"name": "supervisor",
"type": "Supervisor",
"id": "worker_0-input-supervisor-Supervisor"
},
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"optional": true,
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, ChatVertexAI, GroqChat. If not specified, supervisor's model will be used",
"id": "worker_0-input-model-BaseChatModel"
}
],
"inputs": {
"workerName": "Senior Software Engineer",
"workerPrompt": "As a Senior Software Engineer at {company}, you are a pivotal part of our innovative development team. Your expertise and leadership drive the creation of robust, scalable software solutions that meet the needs of our diverse clientele. By applying best practices in software development, you ensure that our products are reliable, efficient, and maintainable.\n\nYour goal is to lead the development of high-quality software solutions.\n\nUtilize your deep technical knowledge and experience to architect, design, and implement software systems that address complex problems. Collaborate closely with other engineers, reviewers to ensure that the solutions you develop align with business objectives and user needs.\n\nDesign and implement new feature for the given task, ensuring it integrates seamlessly with existing systems and meets performance requirements. Use your understanding of {technology} to build this feature. Make sure to adhere to our coding standards and follow best practices.\n\nThe output should be a fully functional, well-documented feature that enhances our product's capabilities. Include detailed comments in the code. Pass the code to Quality Assurance Engineer for review if neccessary. Once ther review is good enough, produce a finalized version of the code.",
"tools": "",
"supervisor": "{{supervisor_0.data.instance}}",
"model": "",
"promptValues": "{\"company\":\"Flowise Inc\",\"technology\":\"React, NodeJS, ExpressJS, Tailwindcss\"}",
"maxIterations": ""
},
"outputAnchors": [
{
"id": "worker_0-output-worker-Worker",
"name": "worker",
"label": "Worker",
"description": "",
"type": "Worker"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 808,
"selected": false,
"positionAbsolute": {
"x": 969.3717362716295,
"y": 77.52271438462338
},
"dragging": false
},
{
"id": "worker_1",
"position": {
"x": 1369.3717362716295,
"y": 77.52271438462338
},
"type": "customNode",
"data": {
"id": "worker_1",
"label": "Worker",
"version": 1,
"name": "worker",
"type": "Worker",
"baseClasses": ["Worker"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Worker Name",
"name": "workerName",
"type": "string",
"placeholder": "Worker",
"id": "worker_1-input-workerName-string"
},
{
"label": "Worker Prompt",
"name": "workerPrompt",
"type": "string",
"rows": 4,
"default": "You are a research assistant who can search for up-to-date info using search engine.",
"id": "worker_1-input-workerPrompt-string"
},
{
"label": "Format Prompt Values",
"name": "promptValues",
"type": "json",
"optional": true,
"acceptVariable": true,
"list": true,
"id": "worker_1-input-promptValues-json"
},
{
"label": "Max Iterations",
"name": "maxIterations",
"type": "number",
"optional": true,
"id": "worker_1-input-maxIterations-number"
}
],
"inputAnchors": [
{
"label": "Tools",
"name": "tools",
"type": "Tool",
"list": true,
"optional": true,
"id": "worker_1-input-tools-Tool"
},
{
"label": "Supervisor",
"name": "supervisor",
"type": "Supervisor",
"id": "worker_1-input-supervisor-Supervisor"
},
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"optional": true,
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, ChatVertexAI, GroqChat. If not specified, supervisor's model will be used",
"id": "worker_1-input-model-BaseChatModel"
}
],
"inputs": {
"workerName": "Code Reviewer",
"workerPrompt": "As a Quality Assurance Engineer at {company}, you are an integral part of our development team, ensuring that our software products are of the highest quality. Your meticulous attention to detail and expertise in testing methodologies are crucial in identifying defects and ensuring that our code meets the highest standards.\n\nYour goal is to ensure the delivery of high-quality software through thorough code review and testing.\n\nReview the codebase for the new feature designed and implemented by the Senior Software Engineer. Your expertise goes beyond mere code inspection; you are adept at ensuring that developments not only function as intended but also adhere to the team's coding standards, enhance maintainability, and seamlessly integrate with existing systems. \n\nWith a deep appreciation for collaborative development, you provide constructive feedback, guiding contributors towards best practices and fostering a culture of continuous improvement. Your meticulous approach to reviewing code, coupled with your ability to foresee potential issues and recommend proactive solutions, ensures the delivery of high-quality software that is robust, scalable, and aligned with the team's strategic goals.\n\nAlways pass back the review and feedback to Senior Software Engineer.",
"tools": "",
"supervisor": "{{supervisor_0.data.instance}}",
"model": "",
"promptValues": "{\"company\":\"Flowise Inc\"}",
"maxIterations": ""
},
"outputAnchors": [
{
"id": "worker_1-output-worker-Worker",
"name": "worker",
"label": "Worker",
"description": "",
"type": "Worker"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 808,
"selected": false,
"positionAbsolute": {
"x": 1369.3717362716295,
"y": 77.52271438462338
},
"dragging": false
},
{
"id": "chatOpenAI_0",
"position": {
"x": 201.1230948105134,
"y": 70.78573663723421
},
"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-asyncOptions"
},
{
"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-4o",
"temperature": "0",
"maxTokens": "",
"topP": "",
"frequencyPenalty": "",
"presencePenalty": "",
"timeout": "",
"basepath": "",
"baseOptions": "",
"allowImageUploads": "",
"imageResolution": "low"
},
"outputAnchors": [
{
"id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
"name": "chatOpenAI",
"label": "ChatOpenAI",
"description": "Wrapper around OpenAI large language models that use the Chat endpoint",
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 669,
"selected": false,
"positionAbsolute": {
"x": 201.1230948105134,
"y": 70.78573663723421
},
"dragging": false
}
],
"edges": [
{
"source": "chatOpenAI_0",
"sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
"target": "supervisor_0",
"targetHandle": "supervisor_0-input-model-BaseChatModel",
"type": "buttonedge",
"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-supervisor_0-supervisor_0-input-model-BaseChatModel"
},
{
"source": "supervisor_0",
"sourceHandle": "supervisor_0-output-supervisor-Supervisor",
"target": "worker_1",
"targetHandle": "worker_1-input-supervisor-Supervisor",
"type": "buttonedge",
"id": "supervisor_0-supervisor_0-output-supervisor-Supervisor-worker_1-worker_1-input-supervisor-Supervisor"
},
{
"source": "supervisor_0",
"sourceHandle": "supervisor_0-output-supervisor-Supervisor",
"target": "worker_0",
"targetHandle": "worker_0-input-supervisor-Supervisor",
"type": "buttonedge",
"id": "supervisor_0-supervisor_0-output-supervisor-Supervisor-worker_0-worker_0-input-supervisor-Supervisor"
}
]
}
@@ -0,0 +1,768 @@
{
"description": "Text to SQL query process using team of 3 agents: SQL Expert, SQL Reviewer, and SQL Executor",
"nodes": [
{
"id": "supervisor_0",
"position": {
"x": -275.4818449163403,
"y": 462.4424369159454
},
"type": "customNode",
"data": {
"id": "supervisor_0",
"label": "Supervisor",
"version": 1,
"name": "supervisor",
"type": "Supervisor",
"baseClasses": ["Supervisor"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Supervisor Name",
"name": "supervisorName",
"type": "string",
"placeholder": "Supervisor",
"default": "Supervisor",
"id": "supervisor_0-input-supervisorName-string"
},
{
"label": "Supervisor Prompt",
"name": "supervisorPrompt",
"type": "string",
"description": "Prompt must contains {team_members}",
"rows": 4,
"default": "You are a supervisor tasked with managing a conversation between the following workers: {team_members}.\nGiven the following user request, respond with the worker to act next.\nEach worker will perform a task and respond with their results and status.\nWhen finished, respond with FINISH.\nSelect strategically to minimize the number of steps taken.",
"additionalParams": true,
"id": "supervisor_0-input-supervisorPrompt-string"
},
{
"label": "Recursion Limit",
"name": "recursionLimit",
"type": "number",
"description": "Maximum number of times a call can recurse. If not provided, defaults to 100.",
"default": 100,
"additionalParams": true,
"id": "supervisor_0-input-recursionLimit-number"
}
],
"inputAnchors": [
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, GroqChat. Best result with GPT-4 model",
"id": "supervisor_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": "supervisor_0-input-inputModeration-Moderation"
}
],
"inputs": {
"supervisorName": "Supervisor",
"supervisorPrompt": "You are a supervisor tasked with managing a conversation between the following workers: {team_members}.\nGiven the following user request, respond with the worker to act next.\nEach worker will perform a task and respond with their results and status.\nWhen finished, respond with FINISH.\nSelect strategically to minimize the number of steps taken.",
"model": "{{chatOpenAI_0.data.instance}}",
"recursionLimit": 100,
"inputModeration": ""
},
"outputAnchors": [
{
"id": "supervisor_0-output-supervisor-Supervisor",
"name": "supervisor",
"label": "Supervisor",
"description": "",
"type": "Supervisor"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 431,
"selected": false,
"positionAbsolute": {
"x": -275.4818449163403,
"y": 462.4424369159454
},
"dragging": false
},
{
"id": "worker_0",
"position": {
"x": 483.6310212673076,
"y": 304.6138109554939
},
"type": "customNode",
"data": {
"id": "worker_0",
"label": "Worker",
"version": 1,
"name": "worker",
"type": "Worker",
"baseClasses": ["Worker"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Worker Name",
"name": "workerName",
"type": "string",
"placeholder": "Worker",
"id": "worker_0-input-workerName-string"
},
{
"label": "Worker Prompt",
"name": "workerPrompt",
"type": "string",
"rows": 4,
"default": "You are a research assistant who can search for up-to-date info using search engine.",
"id": "worker_0-input-workerPrompt-string"
},
{
"label": "Format Prompt Values",
"name": "promptValues",
"type": "json",
"optional": true,
"acceptVariable": true,
"list": true,
"id": "worker_0-input-promptValues-json"
},
{
"label": "Max Iterations",
"name": "maxIterations",
"type": "number",
"optional": true,
"id": "worker_0-input-maxIterations-number"
}
],
"inputAnchors": [
{
"label": "Tools",
"name": "tools",
"type": "Tool",
"list": true,
"optional": true,
"id": "worker_0-input-tools-Tool"
},
{
"label": "Supervisor",
"name": "supervisor",
"type": "Supervisor",
"id": "worker_0-input-supervisor-Supervisor"
},
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"optional": true,
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, ChatVertexAI, GroqChat. If not specified, supervisor's model will be used",
"id": "worker_0-input-model-BaseChatModel"
}
],
"inputs": {
"workerName": "SQL Expert",
"workerPrompt": "As an SQL Expert at {company}, you are a critical member of our data team, responsible for designing, optimizing, and maintaining our database systems. Your expertise in SQL and database management ensures that our data is accurate, accessible, and efficiently processed.\n\nYour goal is to develop and optimize complex SQL queries to answer the question.\n\nYou are given the following schema:\n{schema}\n\nYour task is to use the provided schema, and produce the SQL query needed to answer user question. Collaborate with SQL Reviewer and SQL Executor for feedback and review, ensuring that your SQL solutions is correct and follow best practices in database design and query optimization to enhance performance and reliability.\n\nThe output should be a an optimized SQL query. Ensure that your output only contains SQL query, nothing else. Remember, only output SQL query.",
"tools": [],
"supervisor": "{{supervisor_0.data.instance}}",
"model": "",
"promptValues": "{\"company\":\"Flowise Inc\",\"schema\":\"{{customFunction_0.data.instance}}\"}",
"maxIterations": ""
},
"outputAnchors": [
{
"id": "worker_0-output-worker-Worker",
"name": "worker",
"label": "Worker",
"description": "",
"type": "Worker"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 808,
"selected": false,
"positionAbsolute": {
"x": 483.6310212673076,
"y": 304.6138109554939
},
"dragging": false
},
{
"id": "worker_1",
"position": {
"x": 1214.157684503848,
"y": 248.8294849061827
},
"type": "customNode",
"data": {
"id": "worker_1",
"label": "Worker",
"version": 1,
"name": "worker",
"type": "Worker",
"baseClasses": ["Worker"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Worker Name",
"name": "workerName",
"type": "string",
"placeholder": "Worker",
"id": "worker_1-input-workerName-string"
},
{
"label": "Worker Prompt",
"name": "workerPrompt",
"type": "string",
"rows": 4,
"default": "You are a research assistant who can search for up-to-date info using search engine.",
"id": "worker_1-input-workerPrompt-string"
},
{
"label": "Format Prompt Values",
"name": "promptValues",
"type": "json",
"optional": true,
"acceptVariable": true,
"list": true,
"id": "worker_1-input-promptValues-json"
},
{
"label": "Max Iterations",
"name": "maxIterations",
"type": "number",
"optional": true,
"id": "worker_1-input-maxIterations-number"
}
],
"inputAnchors": [
{
"label": "Tools",
"name": "tools",
"type": "Tool",
"list": true,
"optional": true,
"id": "worker_1-input-tools-Tool"
},
{
"label": "Supervisor",
"name": "supervisor",
"type": "Supervisor",
"id": "worker_1-input-supervisor-Supervisor"
},
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"optional": true,
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, ChatVertexAI, GroqChat. If not specified, supervisor's model will be used",
"id": "worker_1-input-model-BaseChatModel"
}
],
"inputs": {
"workerName": "SQL Executor",
"workerPrompt": "As an SQL Executor at {company}, you must ensure the SQL query can be executed with no error.\n\nYou must use the execute_sql tool to execute the SQL query provided by SQL Expert and get the result. Verify the result is indeed correct and error-free. Collaborate with the SQL Expert and SQL Reviewer to make sure the SQL query is valid and successfully fetches back the right information.\n\nREMEMBER, always use the execute_sql tool!",
"tools": ["{{customTool_0.data.instance}}"],
"supervisor": "{{supervisor_0.data.instance}}",
"model": "",
"promptValues": "{\"company\":\"Flowise Inc\"}",
"maxIterations": ""
},
"outputAnchors": [
{
"id": "worker_1-output-worker-Worker",
"name": "worker",
"label": "Worker",
"description": "",
"type": "Worker"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 808,
"selected": false,
"positionAbsolute": {
"x": 1214.157684503848,
"y": 248.8294849061827
},
"dragging": false
},
{
"id": "chatOpenAI_0",
"position": {
"x": -636.2452233568264,
"y": 233.06616199339652
},
"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-asyncOptions"
},
{
"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-4o",
"temperature": "0",
"maxTokens": "",
"topP": "",
"frequencyPenalty": "",
"presencePenalty": "",
"timeout": "",
"basepath": "",
"baseOptions": "",
"allowImageUploads": "",
"imageResolution": "low"
},
"outputAnchors": [
{
"id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
"name": "chatOpenAI",
"label": "ChatOpenAI",
"description": "Wrapper around OpenAI large language models that use the Chat endpoint",
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 669,
"selected": false,
"positionAbsolute": {
"x": -636.2452233568264,
"y": 233.06616199339652
},
"dragging": false
},
{
"id": "customFunction_0",
"position": {
"x": 90.45254468977657,
"y": 626.487889256008
},
"type": "customNode",
"data": {
"id": "customFunction_0",
"label": "Custom JS Function",
"version": 1,
"name": "customFunction",
"type": "CustomFunction",
"baseClasses": ["CustomFunction", "Utilities"],
"category": "Utilities",
"description": "Execute custom javascript function",
"inputParams": [
{
"label": "Input Variables",
"name": "functionInputVariables",
"description": "Input variables can be used in the function with prefix $. For example: $var",
"type": "json",
"optional": true,
"acceptVariable": true,
"list": true,
"id": "customFunction_0-input-functionInputVariables-json"
},
{
"label": "Function Name",
"name": "functionName",
"type": "string",
"optional": true,
"placeholder": "My Function",
"id": "customFunction_0-input-functionName-string"
},
{
"label": "Javascript Function",
"name": "javascriptFunction",
"type": "code",
"id": "customFunction_0-input-javascriptFunction-code"
}
],
"inputAnchors": [],
"inputs": {
"functionInputVariables": "",
"functionName": "",
"javascriptFunction": "// Fetch schema info\nconst sqlSchema = `CREATE TABLE customers (\n customerNumber int NOT NULL,\n customerName varchar(50) NOT NULL,\n contactLastName varchar(50) NOT NULL,\n contactFirstName varchar(50) NOT NULL,\n phone varchar(50) NOT NULL,\n addressLine1 varchar(50) NOT NULL,\n addressLine2 varchar(50) DEFAULT NULL,\n city varchar(50) NOT NULL,\n state varchar(50) DEFAULT NULL,\n postalCode varchar(15) DEFAULT NULL,\n country varchar(50) NOT NULL,\n salesRepEmployeeNumber int DEFAULT NULL,\n creditLimit decimal(10,2) DEFAULT NULL,\n)`\n\nreturn sqlSchema;"
},
"outputAnchors": [
{
"name": "output",
"label": "Output",
"type": "options",
"description": "",
"options": [
{
"id": "customFunction_0-output-output-string|number|boolean|json|array",
"name": "output",
"label": "Output",
"description": "",
"type": "string | number | boolean | json | array"
},
{
"id": "customFunction_0-output-EndingNode-CustomFunction",
"name": "EndingNode",
"label": "Ending Node",
"description": "",
"type": "CustomFunction"
}
],
"default": "output"
}
],
"outputs": {
"output": "output"
},
"selected": false
},
"width": 300,
"height": 669,
"selected": false,
"positionAbsolute": {
"x": 90.45254468977657,
"y": 626.487889256008
},
"dragging": false
},
{
"id": "customTool_0",
"position": {
"x": 823.759726626879,
"y": 87.97240806811993
},
"type": "customNode",
"data": {
"id": "customTool_0",
"label": "Custom Tool",
"version": 1,
"name": "customTool",
"type": "CustomTool",
"baseClasses": ["CustomTool", "Tool", "StructuredTool", "Runnable"],
"category": "Tools",
"description": "Use custom tool you've created in Flowise within chatflow",
"inputParams": [
{
"label": "Select Tool",
"name": "selectedTool",
"type": "asyncOptions",
"loadMethod": "listTools",
"id": "customTool_0-input-selectedTool-asyncOptions"
}
],
"inputAnchors": [],
"inputs": {
"selectedTool": "4d723d69-e854-4351-90c0-6385ce908213"
},
"outputAnchors": [
{
"id": "customTool_0-output-customTool-CustomTool|Tool|StructuredTool|Runnable",
"name": "customTool",
"label": "CustomTool",
"description": "Use custom tool you've created in Flowise within chatflow",
"type": "CustomTool | Tool | StructuredTool | Runnable"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 285,
"selected": false,
"positionAbsolute": {
"x": 823.759726626879,
"y": 87.97240806811993
},
"dragging": false
},
{
"id": "worker_2",
"position": {
"x": 1643.1366621404572,
"y": 253.12633995235484
},
"type": "customNode",
"data": {
"id": "worker_2",
"label": "Worker",
"version": 1,
"name": "worker",
"type": "Worker",
"baseClasses": ["Worker"],
"category": "Multi Agents",
"inputParams": [
{
"label": "Worker Name",
"name": "workerName",
"type": "string",
"placeholder": "Worker",
"id": "worker_2-input-workerName-string"
},
{
"label": "Worker Prompt",
"name": "workerPrompt",
"type": "string",
"rows": 4,
"default": "You are a research assistant who can search for up-to-date info using search engine.",
"id": "worker_2-input-workerPrompt-string"
},
{
"label": "Format Prompt Values",
"name": "promptValues",
"type": "json",
"optional": true,
"acceptVariable": true,
"list": true,
"id": "worker_2-input-promptValues-json"
},
{
"label": "Max Iterations",
"name": "maxIterations",
"type": "number",
"optional": true,
"id": "worker_2-input-maxIterations-number"
}
],
"inputAnchors": [
{
"label": "Tools",
"name": "tools",
"type": "Tool",
"list": true,
"optional": true,
"id": "worker_2-input-tools-Tool"
},
{
"label": "Supervisor",
"name": "supervisor",
"type": "Supervisor",
"id": "worker_2-input-supervisor-Supervisor"
},
{
"label": "Tool Calling Chat Model",
"name": "model",
"type": "BaseChatModel",
"optional": true,
"description": "Only compatible with models that are capable of function calling: ChatOpenAI, ChatMistral, ChatAnthropic, ChatGoogleGenerativeAI, ChatVertexAI, GroqChat. If not specified, supervisor's model will be used",
"id": "worker_2-input-model-BaseChatModel"
}
],
"inputs": {
"workerName": "SQL Reviewer",
"workerPrompt": "As an SQL Code Reviewer at {company}, you play a crucial role in ensuring the accuracy, efficiency, and reliability of our SQL queries and database systems. Your expertise in SQL and best practices in database management is essential for maintaining high standards in our data operations.\n\nYour goal is to thoroughly review and validate the SQL queries developed by the SQL Expert to ensure they meet our performance and accuracy standards. Check for potential issues such as syntax errors, performance bottlenecks, and logical inaccuracies. Collaborate with the SQL Expert and SQL Executor to provide constructive feedback and suggest improvements where necessary.\n\nThe output should be a detailed code review report that includes an assessment of each SQL query's accuracy, performance, and correctness. Provide actionable feedback and suggestions to enhance the quality of the SQL code, ensuring it supports our data-driven initiatives effectively.",
"tools": [],
"supervisor": "{{supervisor_0.data.instance}}",
"model": "",
"promptValues": "{\"company\":\"Flowise Inc\"}",
"maxIterations": ""
},
"outputAnchors": [
{
"id": "worker_2-output-worker-Worker",
"name": "worker",
"label": "Worker",
"description": "",
"type": "Worker"
}
],
"outputs": {},
"selected": false
},
"width": 300,
"height": 808,
"selected": false,
"positionAbsolute": {
"x": 1643.1366621404572,
"y": 253.12633995235484
},
"dragging": false
}
],
"edges": [
{
"source": "chatOpenAI_0",
"sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
"target": "supervisor_0",
"targetHandle": "supervisor_0-input-model-BaseChatModel",
"type": "buttonedge",
"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-supervisor_0-supervisor_0-input-model-BaseChatModel"
},
{
"source": "customFunction_0",
"sourceHandle": "customFunction_0-output-output-string|number|boolean|json|array",
"target": "worker_0",
"targetHandle": "worker_0-input-promptValues-json",
"type": "buttonedge",
"id": "customFunction_0-customFunction_0-output-output-string|number|boolean|json|array-worker_0-worker_0-input-promptValues-json"
},
{
"source": "supervisor_0",
"sourceHandle": "supervisor_0-output-supervisor-Supervisor",
"target": "worker_0",
"targetHandle": "worker_0-input-supervisor-Supervisor",
"type": "buttonedge",
"id": "supervisor_0-supervisor_0-output-supervisor-Supervisor-worker_0-worker_0-input-supervisor-Supervisor"
},
{
"source": "supervisor_0",
"sourceHandle": "supervisor_0-output-supervisor-Supervisor",
"target": "worker_1",
"targetHandle": "worker_1-input-supervisor-Supervisor",
"type": "buttonedge",
"id": "supervisor_0-supervisor_0-output-supervisor-Supervisor-worker_1-worker_1-input-supervisor-Supervisor"
},
{
"source": "customTool_0",
"sourceHandle": "customTool_0-output-customTool-CustomTool|Tool|StructuredTool|Runnable",
"target": "worker_1",
"targetHandle": "worker_1-input-tools-Tool",
"type": "buttonedge",
"id": "customTool_0-customTool_0-output-customTool-CustomTool|Tool|StructuredTool|Runnable-worker_1-worker_1-input-tools-Tool"
},
{
"source": "supervisor_0",
"sourceHandle": "supervisor_0-output-supervisor-Supervisor",
"target": "worker_2",
"targetHandle": "worker_2-input-supervisor-Supervisor",
"type": "buttonedge",
"id": "supervisor_0-supervisor_0-output-supervisor-Supervisor-worker_2-worker_2-input-supervisor-Supervisor"
}
]
}
@@ -1,5 +1,7 @@
{
"description": "Return response as a JSON structure as specified by a Zod schema",
"categories": "AdvancedStructuredOutputParser,ChatOpenAI,LLM Chain,Langchain",
"framework": "Langchain",
"badge": "NEW",
"nodes": [
{
+6 -1
View File
@@ -2,6 +2,8 @@ import { ICommonObject, IFileUpload, INode, INodeData as INodeDataFromComponent,
export type MessageType = 'apiMessage' | 'userMessage'
export type ChatflowType = 'CHATFLOW' | 'MULTIAGENT'
export enum chatType {
INTERNAL = 'INTERNAL',
EXTERNAL = 'EXTERNAL'
@@ -25,7 +27,9 @@ export interface IChatFlow {
apikeyid?: string
analytic?: string
chatbotConfig?: string
apiConfig?: any
apiConfig?: string
category?: string
type?: ChatflowType
}
export interface IChatMessage {
@@ -36,6 +40,7 @@ export interface IChatMessage {
sourceDocuments?: string
usedTools?: string
fileAnnotations?: string
agentReasoning?: string
fileUploads?: string
chatType: string
chatId: string
@@ -150,9 +150,25 @@ const removeAllChatMessages = async (req: Request, res: Response, next: NextFunc
}
}
const abortChatMessage = async (req: Request, res: Response, next: NextFunction) => {
try {
if (typeof req.params === 'undefined' || !req.params.chatflowid || !req.params.chatid) {
throw new InternalFlowiseError(
StatusCodes.PRECONDITION_FAILED,
`Error: chatMessagesController.abortChatMessage - chatflowid or chatid not provided!`
)
}
await chatMessagesService.abortChatMessage(req.params.chatid, req.params.chatflowid)
return res.json({ status: 200, message: 'Chat message aborted' })
} catch (error) {
next(error)
}
}
export default {
createChatMessage,
getAllChatMessages,
getAllInternalChatMessages,
removeAllChatMessages
removeAllChatMessages,
abortChatMessage
}
@@ -5,6 +5,7 @@ import { createRateLimiter } from '../../utils/rateLimit'
import { getApiKey } from '../../utils/apiKey'
import { InternalFlowiseError } from '../../errors/internalFlowiseError'
import { StatusCodes } from 'http-status-codes'
import { ChatflowType } from '../../Interface'
const checkIfChatflowIsValidForStreaming = async (req: Request, res: Response, next: NextFunction) => {
try {
@@ -50,7 +51,7 @@ const deleteChatflow = async (req: Request, res: Response, next: NextFunction) =
const getAllChatflows = async (req: Request, res: Response, next: NextFunction) => {
try {
const apiResponse = await chatflowsService.getAllChatflows()
const apiResponse = await chatflowsService.getAllChatflows(req.query?.type as ChatflowType)
return res.json(apiResponse)
} catch (error) {
next(error)
@@ -60,17 +61,17 @@ const getAllChatflows = async (req: Request, res: Response, next: NextFunction)
// Get specific chatflow via api key
const getChatflowByApiKey = async (req: Request, res: Response, next: NextFunction) => {
try {
if (typeof req.params === 'undefined' || !req.params.apiKey) {
if (typeof req.params === 'undefined' || !req.params.apikey) {
throw new InternalFlowiseError(
StatusCodes.PRECONDITION_FAILED,
`Error: chatflowsRouter.getChatflowByApiKey - apiKey not provided!`
`Error: chatflowsRouter.getChatflowByApiKey - apikey not provided!`
)
}
const apiKey = await getApiKey(req.params.apiKey)
if (!apiKey) {
const apikey = await getApiKey(req.params.apikey)
if (!apikey) {
return res.status(401).send('Unauthorized')
}
const apiResponse = await chatflowsService.getChatflowByApiKey(apiKey.id)
const apiResponse = await chatflowsService.getChatflowByApiKey(apikey.id)
return res.json(apiResponse)
} catch (error) {
next(error)
@@ -1,6 +1,6 @@
/* eslint-disable */
import { Entity, Column, CreateDateColumn, UpdateDateColumn, PrimaryGeneratedColumn } from 'typeorm'
import { IChatFlow } from '../../Interface'
import { ChatflowType, IChatFlow } from '../../Interface'
@Entity()
export class ChatFlow implements IChatFlow {
@@ -34,6 +34,12 @@ export class ChatFlow implements IChatFlow {
@Column({ nullable: true, type: 'text' })
speechToText?: string
@Column({ nullable: true, type: 'text' })
category?: string
@Column({ nullable: true, type: 'text' })
type?: ChatflowType
@Column({ type: 'timestamp' })
@CreateDateColumn()
createdDate: Date
@@ -41,7 +47,4 @@ export class ChatFlow implements IChatFlow {
@Column({ type: 'timestamp' })
@UpdateDateColumn()
updatedDate: Date
@Column({ nullable: true, type: 'text' })
category?: string
}
@@ -26,6 +26,9 @@ export class ChatMessage implements IChatMessage {
@Column({ nullable: true, type: 'text' })
fileAnnotations?: string
@Column({ nullable: true, type: 'text' })
agentReasoning?: string
@Column({ nullable: true, type: 'text' })
fileUploads?: string
@@ -0,0 +1,12 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddAgentReasoningToChatMessage1714679514451 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
const columnExists = await queryRunner.hasColumn('chat_message', 'agentReasoning')
if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_message\` ADD COLUMN \`agentReasoning\` LONGTEXT;`)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`chat_message\` DROP COLUMN \`agentReasoning\`;`)
}
}
@@ -0,0 +1,12 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddTypeToChatFlow1766759476232 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
const columnExists = await queryRunner.hasColumn('chat_flow', 'type')
if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`type\` TEXT;`)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`chat_flow\` DROP COLUMN \`type\`;`)
}
}
@@ -18,6 +18,8 @@ import { AddFeedback1707213626553 } from './1707213626553-AddFeedback'
import { AddDocumentStore1711637331047 } from './1711637331047-AddDocumentStore'
import { AddLead1710832127079 } from './1710832127079-AddLead'
import { AddLeadToChatMessage1711538023578 } from './1711538023578-AddLeadToChatMessage'
import { AddAgentReasoningToChatMessage1714679514451 } from './1714679514451-AddAgentReasoningToChatMessage'
import { AddTypeToChatFlow1766759476232 } from './1766759476232-AddTypeToChatFlow'
export const mysqlMigrations = [
Init1693840429259,
@@ -32,12 +34,14 @@ export const mysqlMigrations = [
AddUsedToolsToChatMessage1699481607341,
AddCategoryToChatFlow1699900910291,
AddFileAnnotationsToChatMessage1700271021237,
AddFileUploadsToChatMessage1701788586491,
AddVariableEntity1699325775451,
AddFileUploadsToChatMessage1701788586491,
AddSpeechToText1706364937060,
AddUpsertHistoryEntity1709814301358,
AddFeedback1707213626553,
AddDocumentStore1711637331047,
AddLead1710832127079,
AddLeadToChatMessage1711538023578
AddLeadToChatMessage1711538023578,
AddAgentReasoningToChatMessage1714679514451,
AddTypeToChatFlow1766759476232
]
@@ -0,0 +1,11 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddAgentReasoningToChatMessage1714679514451 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "chat_message" ADD COLUMN IF NOT EXISTS "agentReasoning" TEXT;`)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "chat_message" DROP COLUMN "agentReasoning";`)
}
}
@@ -0,0 +1,11 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddTypeToChatFlow1766759476232 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "chat_flow" ADD COLUMN IF NOT EXISTS "type" TEXT;`)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "chat_flow" DROP COLUMN "type";`)
}
}
@@ -19,6 +19,8 @@ import { FieldTypes1710497452584 } from './1710497452584-FieldTypes'
import { AddDocumentStore1711637331047 } from './1711637331047-AddDocumentStore'
import { AddLead1710832137905 } from './1710832137905-AddLead'
import { AddLeadToChatMessage1711538016098 } from './1711538016098-AddLeadToChatMessage'
import { AddAgentReasoningToChatMessage1714679514451 } from './1714679514451-AddAgentReasoningToChatMessage'
import { AddTypeToChatFlow1766759476232 } from './1766759476232-AddTypeToChatFlow'
export const postgresMigrations = [
Init1693891895163,
@@ -33,13 +35,15 @@ export const postgresMigrations = [
AddUsedToolsToChatMessage1699481607341,
AddCategoryToChatFlow1699900910291,
AddFileAnnotationsToChatMessage1700271021237,
AddFileUploadsToChatMessage1701788586491,
AddVariableEntity1699325775451,
AddFileUploadsToChatMessage1701788586491,
AddSpeechToText1706364937060,
AddUpsertHistoryEntity1709814301358,
AddFeedback1707213601923,
FieldTypes1710497452584,
AddDocumentStore1711637331047,
AddLead1710832137905,
AddLeadToChatMessage1711538016098
AddLeadToChatMessage1711538016098,
AddAgentReasoningToChatMessage1714679514451,
AddTypeToChatFlow1766759476232
]
@@ -0,0 +1,11 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddAgentReasoningToChatMessage1714679514451 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "chat_message" ADD COLUMN "agentReasoning" TEXT;`)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "chat_message" DROP COLUMN "agentReasoning";`)
}
}
@@ -0,0 +1,11 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddTypeToChatFlow1766759476232 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "chat_flow" ADD COLUMN "type" TEXT;`)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "chat_flow" DROP COLUMN "type";`)
}
}
@@ -18,6 +18,8 @@ import { AddFeedback1707213619308 } from './1707213619308-AddFeedback'
import { AddDocumentStore1711637331047 } from './1711637331047-AddDocumentStore'
import { AddLead1710832117612 } from './1710832117612-AddLead'
import { AddLeadToChatMessage1711537986113 } from './1711537986113-AddLeadToChatMessage'
import { AddAgentReasoningToChatMessage1714679514451 } from './1714679514451-AddAgentReasoningToChatMessage'
import { AddTypeToChatFlow1766759476232 } from './1766759476232-AddTypeToChatFlow'
export const sqliteMigrations = [
Init1693835579790,
@@ -32,12 +34,14 @@ export const sqliteMigrations = [
AddUsedToolsToChatMessage1699481607341,
AddCategoryToChatFlow1699900910291,
AddFileAnnotationsToChatMessage1700271021237,
AddFileUploadsToChatMessage1701788586491,
AddVariableEntity1699325775451,
AddFileUploadsToChatMessage1701788586491,
AddSpeechToText1706364937060,
AddUpsertHistoryEntity1709814301358,
AddFeedback1707213619308,
AddDocumentStore1711637331047,
AddLead1710832117612,
AddLeadToChatMessage1711537986113
AddLeadToChatMessage1711537986113,
AddAgentReasoningToChatMessage1714679514451,
AddTypeToChatFlow1766759476232
]
@@ -9,6 +9,7 @@ router.post(['/', '/:id'], chatMessageController.createChatMessage)
router.get(['/', '/:id'], chatMessageController.getAllChatMessages)
// UPDATE
router.put(['/abort/', '/abort/:chatflowid/:chatid'], chatMessageController.abortChatMessage)
// DELETE
router.delete(['/', '/:id'], chatMessageController.removeAllChatMessages)
+1 -1
View File
@@ -46,7 +46,7 @@ const deleteApiKey = async (id: string) => {
}
}
const verifyApiKey = async (paramApiKey: string): Promise<any> => {
const verifyApiKey = async (paramApiKey: string): Promise<string> => {
try {
const apiKey = await getApiKey(paramApiKey)
if (!apiKey) {
@@ -1,4 +1,4 @@
import { FindOptionsWhere } from 'typeorm'
import { DeleteResult, FindOptionsWhere } from 'typeorm'
import { StatusCodes } from 'http-status-codes'
import { chatType, IChatMessage } from '../../Interface'
import { utilGetChatMessage } from '../../utils/getChatMessage'
@@ -36,7 +36,7 @@ const getAllChatMessages = async (
endDate?: string,
messageId?: string,
feedback?: boolean
): Promise<any> => {
): Promise<ChatMessage[]> => {
try {
const dbResponse = await utilGetChatMessage(
chatflowId,
@@ -71,7 +71,7 @@ const getAllInternalChatMessages = async (
endDate?: string,
messageId?: string,
feedback?: boolean
): Promise<any> => {
): Promise<ChatMessage[]> => {
try {
const dbResponse = await utilGetChatMessage(
chatflowId,
@@ -94,7 +94,11 @@ const getAllInternalChatMessages = async (
}
}
const removeAllChatMessages = async (chatId: string, chatflowid: string, deleteOptions: FindOptionsWhere<ChatMessage>): Promise<any> => {
const removeAllChatMessages = async (
chatId: string,
chatflowid: string,
deleteOptions: FindOptionsWhere<ChatMessage>
): Promise<DeleteResult> => {
try {
const appServer = getRunningExpressApp()
@@ -120,9 +124,32 @@ const removeAllChatMessages = async (chatId: string, chatflowid: string, deleteO
}
}
const abortChatMessage = async (chatId: string, chatflowid: string) => {
try {
const appServer = getRunningExpressApp()
const endingNodeData = appServer.chatflowPool.activeChatflows[`${chatflowid}_${chatId}`]?.endingNodeData as any
if (endingNodeData && endingNodeData.signal) {
try {
endingNodeData.signal.abort()
await appServer.chatflowPool.remove(`${chatflowid}_${chatId}`)
} catch (e) {
logger.error(`[server]: Error aborting chat message for ${chatflowid}, chatId ${chatId}: ${e}`)
}
}
} catch (error) {
throw new InternalFlowiseError(
StatusCodes.INTERNAL_SERVER_ERROR,
`Error: chatMessagesService.abortChatMessage - ${getErrorMessage(error)}`
)
}
}
export default {
createChatMessage,
getAllChatMessages,
getAllInternalChatMessages,
removeAllChatMessages
removeAllChatMessages,
abortChatMessage
}
@@ -1,7 +1,7 @@
import { StatusCodes } from 'http-status-codes'
import { InternalFlowiseError } from '../../errors/internalFlowiseError'
import { getRunningExpressApp } from '../../utils/getRunningExpressApp'
import { IChatFlow } from '../../Interface'
import { ChatflowType, IChatFlow } from '../../Interface'
import { ChatFlow } from '../../database/entities/ChatFlow'
import { getAppVersion, getTelemetryFlowObj, isFlowValidForStream, constructGraphs, getEndingNodes } from '../../utils'
import logger from '../../utils/logger'
@@ -47,6 +47,11 @@ const checkIfChatflowIsValidForStreaming = async (chatflowId: string): Promise<a
isStreaming = isFlowValidForStream(nodes, endingNodeData)
}
// If it is a Multi Agents, always enable streaming
if (endingNodes.filter((node) => node.data.category === 'Multi Agents').length > 0) {
return { isStreaming: true }
}
const dbResponse = { isStreaming: isStreaming }
return dbResponse
} catch (error) {
@@ -99,11 +104,14 @@ const deleteChatflow = async (chatflowId: string): Promise<any> => {
}
}
const getAllChatflows = async (): Promise<IChatFlow[]> => {
const getAllChatflows = async (type?: ChatflowType): Promise<IChatFlow[]> => {
try {
const appServer = getRunningExpressApp()
const dbResponse = await appServer.AppDataSource.getRepository(ChatFlow).find()
return dbResponse
if (type === 'MULTIAGENT') {
return dbResponse.filter((chatflow) => chatflow.type === type)
}
return dbResponse.filter((chatflow) => chatflow.type === 'CHATFLOW' || !chatflow.type)
} catch (error) {
throw new InternalFlowiseError(
StatusCodes.INTERNAL_SERVER_ERROR,
@@ -114,6 +122,7 @@ const getAllChatflows = async (): Promise<IChatFlow[]> => {
const getChatflowByApiKey = async (apiKeyId: string): Promise<any> => {
try {
// Here we only get chatflows that are bounded by the apikeyid and chatflows that are not bounded by any apikey
const appServer = getRunningExpressApp()
const dbResponse = await appServer.AppDataSource.getRepository(ChatFlow)
.createQueryBuilder('cf')
@@ -44,6 +44,25 @@ const getAllTemplates = async () => {
}
templates.push(template)
})
marketplaceDir = path.join(__dirname, '..', '..', '..', 'marketplaces', 'agentflows')
jsonsInDir = fs.readdirSync(marketplaceDir).filter((file) => path.extname(file) === '.json')
jsonsInDir.forEach((file, index) => {
const filePath = path.join(__dirname, '..', '..', '..', 'marketplaces', 'agentflows', file)
const fileData = fs.readFileSync(filePath)
const fileDataObj = JSON.parse(fileData.toString())
const template = {
id: index,
templateName: file.split('.json')[0],
flowData: fileData.toString(),
badge: fileDataObj?.badge,
framework: fileDataObj?.framework,
categories: fileDataObj?.categories,
type: 'Agentflow',
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) {
@@ -0,0 +1,345 @@
import {
ICommonObject,
IMultiAgentNode,
IAgentReasoning,
ITeamState,
ConsoleCallbackHandler,
additionalCallbacks
} from 'flowise-components'
import { IChatFlow, IComponentNodes, IDepthQueue, IReactFlowNode, IReactFlowObject } from '../Interface'
import { Server } from 'socket.io'
import { buildFlow, getStartingNodes, getEndingNodes, constructGraphs, databaseEntities } from '../utils'
import { getRunningExpressApp } from './getRunningExpressApp'
import logger from './logger'
import { StateGraph, END } from '@langchain/langgraph'
import { BaseMessage, HumanMessage } from '@langchain/core/messages'
import { cloneDeep, flatten } from 'lodash'
import { replaceInputsWithConfig, resolveVariables } from '.'
import { StatusCodes } from 'http-status-codes'
import { InternalFlowiseError } from '../errors/internalFlowiseError'
import { getErrorMessage } from '../errors/utils'
/**
* Build Agent Graph
* @param {IChatFlow} chatflow
* @param {string} chatId
* @param {string} sessionId
* @param {ICommonObject} incomingInput
* @param {string} baseURL
* @param {Server} socketIO
*/
export const buildAgentGraph = async (
chatflow: IChatFlow,
chatId: string,
sessionId: string,
incomingInput: ICommonObject,
baseURL?: string,
socketIO?: Server
): Promise<any> => {
try {
const appServer = getRunningExpressApp()
const chatflowid = chatflow.id
/*** Get chatflows and prepare data ***/
const flowData = chatflow.flowData
const parsedFlowData: IReactFlowObject = JSON.parse(flowData)
const nodes = parsedFlowData.nodes
const edges = parsedFlowData.edges
/*** Get Ending Node with Directed Graph ***/
const { graph, nodeDependencies } = constructGraphs(nodes, edges)
const directedGraph = graph
const endingNodes = getEndingNodes(nodeDependencies, directedGraph, nodes)
/*** Get Starting Nodes with Reversed Graph ***/
const constructedObj = constructGraphs(nodes, edges, { isReversed: true })
const nonDirectedGraph = constructedObj.graph
let startingNodeIds: string[] = []
let depthQueue: IDepthQueue = {}
const endingNodeIds = endingNodes.map((n) => n.id)
for (const endingNodeId of endingNodeIds) {
const resx = getStartingNodes(nonDirectedGraph, endingNodeId)
startingNodeIds.push(...resx.startingNodeIds)
depthQueue = Object.assign(depthQueue, resx.depthQueue)
}
startingNodeIds = [...new Set(startingNodeIds)]
// Initialize nodes like ChatModels, Tools, etc.
const reactFlowNodes = await buildFlow(
startingNodeIds,
nodes,
edges,
graph,
depthQueue,
appServer.nodesPool.componentNodes,
incomingInput.question,
[],
chatId,
sessionId,
chatflowid,
appServer.AppDataSource,
incomingInput?.overrideConfig,
appServer.cachePool,
false,
undefined,
incomingInput.uploads,
baseURL
)
const options = {
chatId,
sessionId,
chatflowid,
logger,
analytic: chatflow.analytic,
appDataSource: appServer.AppDataSource,
databaseEntities: databaseEntities,
cachePool: appServer.cachePool,
uploads: incomingInput.uploads,
baseURL,
signal: new AbortController()
}
let streamResults
let finalResult = ''
let agentReasoning: IAgentReasoning[] = []
const workerNodes: IReactFlowNode[] = reactFlowNodes.filter((node: IReactFlowNode) => node.data.name === 'worker')
const supervisorNodes: IReactFlowNode[] = reactFlowNodes.filter((node: IReactFlowNode) => node.data.name === 'supervisor')
const mapNameToLabel: Record<string, string> = {}
for (const node of [...workerNodes, ...supervisorNodes]) {
mapNameToLabel[node.data.instance.name] = node.data.instance.label
}
try {
streamResults = await compileGraph(
chatflow,
mapNameToLabel,
reactFlowNodes,
endingNodeIds,
appServer.nodesPool.componentNodes,
options,
startingNodeIds,
incomingInput.question,
incomingInput?.overrideConfig
)
if (streamResults) {
let isStreamingStarted = false
for await (const output of await streamResults) {
if (!output?.__end__) {
const agentName = Object.keys(output)[0]
const usedTools = output[agentName]?.messages
? output[agentName].messages.map((msg: any) => msg.additional_kwargs?.usedTools)
: []
const sourceDocuments = output[agentName]?.messages
? output[agentName].messages.map((msg: any) => msg.additional_kwargs?.sourceDocuments)
: []
const messages = output[agentName]?.messages ? output[agentName].messages.map((msg: any) => msg.content) : []
const reasoning = {
agentName: mapNameToLabel[agentName],
messages,
next: output[agentName]?.next,
instructions: output[agentName]?.instructions,
usedTools: flatten(usedTools),
sourceDocuments: flatten(sourceDocuments)
}
agentReasoning.push(reasoning)
if (socketIO && incomingInput.socketIOClientId) {
if (!isStreamingStarted) {
isStreamingStarted = true
socketIO.to(incomingInput.socketIOClientId).emit('start', JSON.stringify(agentReasoning))
}
socketIO.to(incomingInput.socketIOClientId).emit('agentReasoning', JSON.stringify(agentReasoning))
// Send loading next agent indicator
if (reasoning.next && reasoning.next !== 'FINISH' && reasoning.next !== 'END') {
socketIO
.to(incomingInput.socketIOClientId)
.emit('nextAgent', mapNameToLabel[reasoning.next] || reasoning.next)
}
}
} else {
finalResult = output.__end__.messages.length ? output.__end__.messages.pop()?.content : ''
if (Array.isArray(finalResult)) finalResult = output.__end__.instructions
if (finalResult === incomingInput.question) {
const supervisorNode = reactFlowNodes.find((node: IReactFlowNode) => node.data.name === 'supervisor')
const llm = supervisorNode?.data?.instance?.llm
if (llm) {
const res = await llm.invoke(incomingInput.question)
finalResult = res?.content
}
}
if (socketIO && incomingInput.socketIOClientId) {
socketIO.to(incomingInput.socketIOClientId).emit('token', finalResult)
}
}
}
return { finalResult, agentReasoning }
}
} catch (e) {
if (socketIO && incomingInput.socketIOClientId) {
socketIO.to(incomingInput.socketIOClientId).emit('abort')
}
return { finalResult, agentReasoning }
}
return streamResults
} catch (e) {
logger.error('[server]: Error:', e)
throw new InternalFlowiseError(StatusCodes.INTERNAL_SERVER_ERROR, `Error buildAgentGraph - ${getErrorMessage(e)}`)
}
}
/**
* Compile Graph
* @param {IChatFlow} chatflow
* @param {Record<string, string>} mapNameToLabel
* @param {IReactFlowNode[]} reactflowNodes
* @param {string[]} workerNodeIds
* @param {IComponentNodes} componentNodes
* @param {ICommonObject} options
* @param {string[]} startingNodeIds
* @param {string} question
* @param {ICommonObject} overrideConfig
*/
const compileGraph = async (
chatflow: IChatFlow,
mapNameToLabel: Record<string, string>,
reactflowNodes: IReactFlowNode[] = [],
workerNodeIds: string[],
componentNodes: IComponentNodes,
options: ICommonObject,
startingNodeIds: string[],
question: string,
overrideConfig?: ICommonObject
) => {
const appServer = getRunningExpressApp()
const channels: ITeamState = {
messages: {
value: (x: BaseMessage[], y: BaseMessage[]) => x.concat(y),
default: () => []
},
next: 'initialState',
instructions: "Solve the user's request.",
team_members: []
}
const workflowGraph = new StateGraph<ITeamState>({
//@ts-ignore
channels
})
const workerNodes = reactflowNodes.filter((node) => workerNodeIds.includes(node.data.id))
let supervisorWorkers: { [key: string]: IMultiAgentNode[] } = {}
// Init worker nodes
for (const workerNode of workerNodes) {
const nodeInstanceFilePath = componentNodes[workerNode.data.name].filePath as string
const nodeModule = await import(nodeInstanceFilePath)
const newNodeInstance = new nodeModule.nodeClass()
let flowNodeData = cloneDeep(workerNode.data)
if (overrideConfig) flowNodeData = replaceInputsWithConfig(flowNodeData, overrideConfig)
flowNodeData = resolveVariables(flowNodeData, reactflowNodes, question, [])
try {
const workerResult: IMultiAgentNode = await newNodeInstance.init(flowNodeData, question, options)
const parentSupervisor = workerResult.parentSupervisorName
if (!parentSupervisor || workerResult.type !== 'worker') continue
if (Object.prototype.hasOwnProperty.call(supervisorWorkers, parentSupervisor)) {
supervisorWorkers[parentSupervisor].push(workerResult)
} else {
supervisorWorkers[parentSupervisor] = [workerResult]
}
workflowGraph.addNode(workerResult.name, workerResult.node)
} catch (e) {
throw new InternalFlowiseError(StatusCodes.INTERNAL_SERVER_ERROR, `Error initialize worker nodes - ${getErrorMessage(e)}`)
}
}
// Init supervisor nodes
for (const supervisor in supervisorWorkers) {
const supervisorInputLabel = mapNameToLabel[supervisor]
const supervisorNode = reactflowNodes.find((node) => supervisorInputLabel === node.data.inputs?.supervisorName)
if (!supervisorNode) continue
const nodeInstanceFilePath = componentNodes[supervisorNode.data.name].filePath as string
const nodeModule = await import(nodeInstanceFilePath)
const newNodeInstance = new nodeModule.nodeClass()
let flowNodeData = cloneDeep(supervisorNode.data)
if (overrideConfig) flowNodeData = replaceInputsWithConfig(flowNodeData, overrideConfig)
flowNodeData = resolveVariables(flowNodeData, reactflowNodes, question, [])
if (flowNodeData.inputs) flowNodeData.inputs.workerNodes = supervisorWorkers[supervisor]
try {
const supervisorResult: IMultiAgentNode = await newNodeInstance.init(flowNodeData, question, options)
if (!supervisorResult.workers?.length) continue
if (supervisorResult.moderations && supervisorResult.moderations.length > 0) {
try {
for (const moderation of supervisorResult.moderations) {
question = await moderation.checkForViolations(question)
}
} catch (e) {
throw new InternalFlowiseError(StatusCodes.INTERNAL_SERVER_ERROR, getErrorMessage(e))
}
}
workflowGraph.addNode(supervisorResult.name, supervisorResult.node)
for (const worker of supervisorResult.workers) {
workflowGraph.addEdge(worker, supervisorResult.name)
}
let conditionalEdges: { [key: string]: string } = {}
for (let i = 0; i < supervisorResult.workers.length; i++) {
conditionalEdges[supervisorResult.workers[i]] = supervisorResult.workers[i]
}
workflowGraph.addConditionalEdges(supervisorResult.name, (x: ITeamState) => x.next, {
...conditionalEdges,
FINISH: END
})
workflowGraph.setEntryPoint(supervisorResult.name)
// Add agentflow to pool
;(workflowGraph as any).signal = options.signal
appServer.chatflowPool.add(
`${chatflow.id}_${options.chatId}`,
workflowGraph as any,
reactflowNodes.filter((node) => startingNodeIds.includes(node.id)),
overrideConfig
)
// TODO: add persistence
// const memory = new MemorySaver()
const graph = workflowGraph.compile()
const loggerHandler = new ConsoleCallbackHandler(logger)
const callbacks = await additionalCallbacks(flowNodeData, options)
// Return stream result as we should only have 1 supervisor
return await graph.stream(
{
messages: [new HumanMessage({ content: question })]
},
{ recursionLimit: supervisorResult?.recursionLimit ?? 100, callbacks: [loggerHandler, ...callbacks] }
)
} catch (e) {
throw new InternalFlowiseError(StatusCodes.INTERNAL_SERVER_ERROR, `Error initialize supervisor nodes - ${getErrorMessage(e)}`)
}
}
}
+127 -14
View File
@@ -1,7 +1,18 @@
import { Request } from 'express'
import { IFileUpload, convertSpeechToText, ICommonObject, addSingleFileToStorage, addArrayFilesToStorage } from 'flowise-components'
import { StatusCodes } from 'http-status-codes'
import { IncomingInput, IMessage, INodeData, IReactFlowObject, IReactFlowNode, IDepthQueue, chatType, IChatMessage } from '../Interface'
import {
IncomingInput,
IMessage,
INodeData,
IReactFlowObject,
IReactFlowNode,
IDepthQueue,
chatType,
IChatMessage,
IChatFlow,
IReactFlowEdge
} from '../Interface'
import { InternalFlowiseError } from '../errors/internalFlowiseError'
import { ChatFlow } from '../database/entities/ChatFlow'
import { Server } from 'socket.io'
@@ -30,6 +41,8 @@ import { omit } from 'lodash'
import * as fs from 'fs'
import logger from './logger'
import { utilAddChatMessage } from './addChatMesage'
import { buildAgentGraph } from './buildAgentGraph'
import { getErrorMessage } from '../errors/utils'
/**
* Build Chatflow
@@ -41,6 +54,8 @@ export const utilBuildChatflow = async (req: Request, socketIO?: Server, isInter
try {
const appServer = getRunningExpressApp()
const chatflowid = req.params.id
const baseURL = `${req.protocol}://${req.get('host')}`
let incomingInput: IncomingInput = req.body
let nodeToExecuteData: INodeData
const chatflow = await appServer.AppDataSource.getRepository(ChatFlow).findOneBy({
@@ -140,11 +155,34 @@ export const utilBuildChatflow = async (req: Request, socketIO?: Server, isInter
const nodes = parsedFlowData.nodes
const edges = parsedFlowData.edges
// Get session ID
/*** Get session ID ***/
const memoryNode = findMemoryNode(nodes, edges)
const memoryType = memoryNode?.data.label
let sessionId = getMemorySessionId(memoryNode, incomingInput, chatId, isInternal)
/*** Get Ending Node with Directed Graph ***/
const { graph, nodeDependencies } = constructGraphs(nodes, edges)
const directedGraph = graph
const endingNodes = getEndingNodes(nodeDependencies, directedGraph, nodes)
/*** If the graph is an agent graph, build the agent response ***/
if (endingNodes.filter((node) => node.data.category === 'Multi Agents').length) {
return await utilBuildAgentResponse(
chatflow,
isInternal,
chatId,
memoryType ?? '',
sessionId,
userMessageDateTime,
fileUploads,
incomingInput,
nodes,
edges,
socketIO,
baseURL
)
}
// Get prepend messages
const prependMessages = incomingInput.history
@@ -153,7 +191,6 @@ export const utilBuildChatflow = async (req: Request, socketIO?: Server, isInter
* - Still in sync (i.e the flow has not been modified since)
* - Existing overrideConfig and new overrideConfig are the same
* - Flow doesn't start with/contain nodes that depend on incomingInput.question
* TODO: convert overrideConfig to hash when we no longer store base64 string but filepath
***/
const isFlowReusable = () => {
return (
@@ -176,13 +213,7 @@ export const utilBuildChatflow = async (req: Request, socketIO?: Server, isInter
`[server]: Reuse existing chatflow ${chatflowid} with ending node ${nodeToExecuteData.label} (${nodeToExecuteData.id})`
)
} else {
/*** Get Ending Node with Directed Graph ***/
const { graph, nodeDependencies } = constructGraphs(nodes, edges)
const directedGraph = graph
const endingNodes = getEndingNodes(nodeDependencies, directedGraph, nodes)
let isCustomFunctionEndingNode = endingNodes.some((node) => node.data?.outputs?.output === 'EndingNode')
const isCustomFunctionEndingNode = endingNodes.some((node) => node.data?.outputs?.output === 'EndingNode')
for (const endingNode of endingNodes) {
const endingNodeData = endingNode.data
@@ -268,7 +299,10 @@ export const utilBuildChatflow = async (req: Request, socketIO?: Server, isInter
appServer.cachePool,
false,
undefined,
incomingInput.uploads
incomingInput.uploads,
baseURL,
socketIO,
incomingInput.socketIOClientId
)
const nodeToExecute =
@@ -372,13 +406,92 @@ export const utilBuildChatflow = async (req: Request, socketIO?: Server, isInter
// this is used when input text is empty but question is in audio format
result.question = incomingInput.question
result.chatId = chatId
result.chatMessageId = chatMessage.id
result.chatMessageId = chatMessage?.id
if (sessionId) result.sessionId = sessionId
if (memoryType) result.memoryType = memoryType
return result
} catch (e: any) {
} catch (e) {
logger.error('[server]: Error:', e)
throw new InternalFlowiseError(StatusCodes.INTERNAL_SERVER_ERROR, e.message)
throw new InternalFlowiseError(StatusCodes.INTERNAL_SERVER_ERROR, getErrorMessage(e))
}
}
const utilBuildAgentResponse = async (
chatflow: IChatFlow,
isInternal: boolean,
chatId: string,
memoryType: string,
sessionId: string,
userMessageDateTime: Date,
fileUploads: IFileUpload[],
incomingInput: ICommonObject,
nodes: IReactFlowNode[],
edges: IReactFlowEdge[],
socketIO?: Server,
baseURL?: string
) => {
try {
const appServer = getRunningExpressApp()
const streamResults = await buildAgentGraph(chatflow, chatId, sessionId, incomingInput, baseURL, socketIO)
if (streamResults) {
const { finalResult, agentReasoning } = streamResults
const userMessage: Omit<IChatMessage, 'id'> = {
role: 'userMessage',
content: incomingInput.question,
chatflowid: chatflow.id,
chatType: isInternal ? chatType.INTERNAL : chatType.EXTERNAL,
chatId,
memoryType,
sessionId,
createdDate: userMessageDateTime,
fileUploads: incomingInput.uploads ? JSON.stringify(fileUploads) : undefined,
leadEmail: incomingInput.leadEmail
}
await utilAddChatMessage(userMessage)
const apiMessage: Omit<IChatMessage, 'id' | 'createdDate'> = {
role: 'apiMessage',
content: finalResult,
chatflowid: chatflow.id,
chatType: isInternal ? chatType.INTERNAL : chatType.EXTERNAL,
chatId,
memoryType,
sessionId
}
if (agentReasoning.length) apiMessage.agentReasoning = JSON.stringify(agentReasoning)
const chatMessage = await utilAddChatMessage(apiMessage)
await appServer.telemetry.sendTelemetry('prediction_sent', {
version: await getAppVersion(),
chatlowId: chatflow.id,
chatId,
type: isInternal ? chatType.INTERNAL : chatType.EXTERNAL,
flowGraph: getTelemetryFlowObj(nodes, edges)
})
// Prepare response
let result: ICommonObject = {}
result.text = finalResult
result.question = incomingInput.question
result.chatId = chatId
result.chatMessageId = chatMessage?.id
if (sessionId) result.sessionId = sessionId
if (memoryType) result.memoryType = memoryType
if (agentReasoning.length) result.agentReasoning = agentReasoning
await appServer.telemetry.sendTelemetry('graph_compiled', {
version: await getAppVersion(),
graphId: chatflow.id,
type: isInternal ? chatType.INTERNAL : chatType.EXTERNAL,
flowGraph: getTelemetryFlowObj(nodes, edges)
})
return result
}
return undefined
} catch (e) {
logger.error('[server]: Error:', e)
throw new InternalFlowiseError(StatusCodes.INTERNAL_SERVER_ERROR, getErrorMessage(e))
}
}
@@ -18,7 +18,7 @@ export const utilGetUploadsConfig = async (chatflowid: string): Promise<any> =>
throw new InternalFlowiseError(StatusCodes.NOT_FOUND, `Chatflow ${chatflowid} not found`)
}
const uploadAllowedNodes = ['llmChain', 'conversationChain', 'reactAgentChat', 'conversationalAgent', 'toolAgent']
const uploadAllowedNodes = ['llmChain', 'conversationChain', 'reactAgentChat', 'conversationalAgent', 'toolAgent', 'supervisor']
const uploadProcessingNodes = ['chatOpenAI', 'chatAnthropic', 'awsChatBedrock', 'azureChatOpenAI', 'chatGoogleGenerativeAI']
const flowObj = JSON.parse(chatflow.flowData)
+16 -6
View File
@@ -1,6 +1,7 @@
import path from 'path'
import fs from 'fs'
import logger from './logger'
import { Server } from 'socket.io'
import {
IComponentCredentials,
IComponentNodes,
@@ -267,9 +268,10 @@ export const getEndingNodes = (
endingNodeData &&
endingNodeData.category !== 'Chains' &&
endingNodeData.category !== 'Agents' &&
endingNodeData.category !== 'Engine'
endingNodeData.category !== 'Engine' &&
endingNodeData.category !== 'Multi Agents'
) {
error = new InternalFlowiseError(StatusCodes.INTERNAL_SERVER_ERROR, `Ending node must be either a Chain or Agent`)
error = new InternalFlowiseError(StatusCodes.INTERNAL_SERVER_ERROR, `Ending node must be either a Chain or Agent or Engine`)
continue
}
}
@@ -443,7 +445,10 @@ export const buildFlow = async (
cachePool?: CachePool,
isUpsert?: boolean,
stopNodeId?: string,
uploads?: IFileUpload[]
uploads?: IFileUpload[],
baseURL?: string,
socketIO?: Server,
socketIOClientId?: string
) => {
const flowNodes = cloneDeep(reactFlowNodes)
@@ -496,7 +501,10 @@ export const buildFlow = async (
databaseEntities,
cachePool,
dynamicVariables,
uploads
uploads,
baseURL,
socketIO,
socketIOClientId
})
if (indexResult) upsertHistory['result'] = indexResult
logger.debug(`[server]: Finished upserting ${reactFlowNode.data.label} (${reactFlowNode.data.id})`)
@@ -520,7 +528,10 @@ export const buildFlow = async (
cachePool,
isUpsert,
dynamicVariables,
uploads
uploads,
baseURL,
socketIO,
socketIOClientId
})
// Save dynamic variables
@@ -1048,7 +1059,6 @@ export const findAvailableConfigs = (reactFlowNodes: IReactFlowNode[], component
}
}
}
return configs
}