diff --git a/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts b/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts
index 4c7408747..1cbcb5473 100644
--- a/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts
+++ b/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts
@@ -42,6 +42,14 @@ class OpenAIFunctionAgent_Agents implements INode {
description:
'Only works with gpt-3.5-turbo-0613 and gpt-4-0613. Refer docs for more info',
type: 'BaseChatModel'
+ },
+ {
+ label: 'System Message',
+ name: 'systemMessage',
+ type: 'string',
+ rows: 4,
+ optional: true,
+ additionalParams: true
}
]
}
@@ -49,13 +57,17 @@ class OpenAIFunctionAgent_Agents implements INode {
async init(nodeData: INodeData): Promise {
const model = nodeData.inputs?.model as BaseLanguageModel
const memory = nodeData.inputs?.memory as BaseChatMemory
+ const systemMessage = nodeData.inputs?.systemMessage as string
let tools = nodeData.inputs?.tools
tools = flatten(tools)
const executor = await initializeAgentExecutorWithOptions(tools, model, {
agentType: 'openai-functions',
- verbose: process.env.DEBUG === 'true' ? true : false
+ verbose: process.env.DEBUG === 'true' ? true : false,
+ agentArgs: {
+ prefix: systemMessage ?? `You are a helpful AI assistant.`
+ }
})
if (memory) executor.memory = memory
diff --git a/packages/server/marketplaces/OpenAI Agent.json b/packages/server/marketplaces/OpenAI Agent.json
index 7e6855462..75dc1527f 100644
--- a/packages/server/marketplaces/OpenAI Agent.json
+++ b/packages/server/marketplaces/OpenAI Agent.json
@@ -6,8 +6,8 @@
"height": 524,
"id": "chatOpenAI_0",
"position": {
- "x": 373.8366297840716,
- "y": 448.58765780622326
+ "x": 648.7470970481406,
+ "y": 462.3331811694268
},
"type": "customNode",
"data": {
@@ -34,33 +34,29 @@
"label": "gpt-4",
"name": "gpt-4"
},
+ {
+ "label": "gpt-4-0314",
+ "name": "gpt-4-0314"
+ },
+ {
+ "label": "gpt-4-32k-0314",
+ "name": "gpt-4-32k-0314"
+ },
{
"label": "gpt-4-0613",
"name": "gpt-4-0613"
},
- {
- "label": "gpt-4-32k",
- "name": "gpt-4-32k"
- },
- {
- "label": "gpt-4-32k-0613",
- "name": "gpt-4-32k-0613"
- },
{
"label": "gpt-3.5-turbo",
"name": "gpt-3.5-turbo"
},
+ {
+ "label": "gpt-3.5-turbo-0301",
+ "name": "gpt-3.5-turbo-0301"
+ },
{
"label": "gpt-3.5-turbo-0613",
"name": "gpt-3.5-turbo-0613"
- },
- {
- "label": "gpt-3.5-turbo-16k",
- "name": "gpt-3.5-turbo-16k"
- },
- {
- "label": "gpt-3.5-turbo-16k-0613",
- "name": "gpt-3.5-turbo-16k-0613"
}
],
"default": "gpt-3.5-turbo",
@@ -148,64 +144,8 @@
},
"selected": false,
"positionAbsolute": {
- "x": 373.8366297840716,
- "y": 448.58765780622326
- },
- "dragging": false
- },
- {
- "width": 300,
- "height": 280,
- "id": "openAIFunctionAgent_0",
- "position": {
- "x": 1084.5405852317417,
- "y": 384.4653768834282
- },
- "type": "customNode",
- "data": {
- "id": "openAIFunctionAgent_0",
- "label": "OpenAI Function Agent",
- "name": "openAIFunctionAgent",
- "type": "AgentExecutor",
- "baseClasses": ["AgentExecutor", "BaseChain", "BaseLangChain", "Serializable"],
- "category": "Agents",
- "description": "An agent that uses OpenAI's Function Calling functionality to pick the tool and args to call",
- "inputParams": [],
- "inputAnchors": [
- {
- "label": "Allowed Tools",
- "name": "tools",
- "type": "Tool",
- "list": true,
- "id": "openAIFunctionAgent_0-input-tools-Tool"
- },
- {
- "label": "OpenAI Chat Model",
- "name": "model",
- "description": "Only works with gpt-3.5-turbo-0613 and gpt-4-0613. Refer docs for more info",
- "type": "BaseChatModel",
- "id": "openAIFunctionAgent_0-input-model-BaseChatModel"
- }
- ],
- "inputs": {
- "tools": ["{{calculator_0.data.instance}}", "{{serper_0.data.instance}}"],
- "model": "{{chatOpenAI_0.data.instance}}"
- },
- "outputAnchors": [
- {
- "id": "openAIFunctionAgent_0-output-openAIFunctionAgent-AgentExecutor|BaseChain|BaseLangChain|Serializable",
- "name": "openAIFunctionAgent",
- "label": "AgentExecutor",
- "type": "AgentExecutor | BaseChain | BaseLangChain | Serializable"
- }
- ],
- "outputs": {},
- "selected": false
- },
- "selected": false,
- "positionAbsolute": {
- "x": 1084.5405852317417,
- "y": 384.4653768834282
+ "x": 648.7470970481406,
+ "y": 462.3331811694268
},
"dragging": false
},
@@ -214,8 +154,8 @@
"height": 278,
"id": "serper_0",
"position": {
- "x": 691.7580226065319,
- "y": 34.00444633899792
+ "x": 486.27248799490576,
+ "y": 4.465900738576664
},
"type": "customNode",
"data": {
@@ -249,8 +189,8 @@
},
"selected": false,
"positionAbsolute": {
- "x": 691.7580226065319,
- "y": 34.00444633899792
+ "x": 486.27248799490576,
+ "y": 4.465900738576664
},
"dragging": false
},
@@ -259,8 +199,8 @@
"height": 143,
"id": "calculator_0",
"position": {
- "x": 341.63347110886497,
- "y": 261.6753474034481
+ "x": 286.4092336819905,
+ "y": 304.05673891709597
},
"type": "customNode",
"data": {
@@ -287,20 +227,198 @@
},
"selected": false,
"positionAbsolute": {
- "x": 341.63347110886497,
- "y": 261.6753474034481
+ "x": 286.4092336819905,
+ "y": 304.05673891709597
+ },
+ "dragging": false
+ },
+ {
+ "width": 300,
+ "height": 383,
+ "id": "openAIFunctionAgent_0",
+ "position": {
+ "x": 1341.2259105169032,
+ "y": 318.35651549722945
+ },
+ "type": "customNode",
+ "data": {
+ "id": "openAIFunctionAgent_0",
+ "label": "OpenAI Function Agent",
+ "name": "openAIFunctionAgent",
+ "type": "AgentExecutor",
+ "baseClasses": ["AgentExecutor", "BaseChain"],
+ "category": "Agents",
+ "description": "An agent that uses OpenAI's Function Calling functionality to pick the tool and args to call",
+ "inputParams": [
+ {
+ "label": "System Message",
+ "name": "systemMessage",
+ "type": "string",
+ "rows": 4,
+ "optional": true,
+ "additionalParams": true,
+ "id": "openAIFunctionAgent_0-input-systemMessage-string"
+ }
+ ],
+ "inputAnchors": [
+ {
+ "label": "Allowed Tools",
+ "name": "tools",
+ "type": "Tool",
+ "list": true,
+ "id": "openAIFunctionAgent_0-input-tools-Tool"
+ },
+ {
+ "label": "Memory",
+ "name": "memory",
+ "type": "BaseChatMemory",
+ "id": "openAIFunctionAgent_0-input-memory-BaseChatMemory"
+ },
+ {
+ "label": "OpenAI Chat Model",
+ "name": "model",
+ "description": "Only works with gpt-3.5-turbo-0613 and gpt-4-0613. Refer docs for more info",
+ "type": "BaseChatModel",
+ "id": "openAIFunctionAgent_0-input-model-BaseChatModel"
+ }
+ ],
+ "inputs": {
+ "tools": ["{{serper_0.data.instance}}", "{{calculator_0.data.instance}}", "{{customTool_0.data.instance}}"],
+ "memory": "{{bufferMemory_0.data.instance}}",
+ "model": "{{chatOpenAI_0.data.instance}}",
+ "systemMessage": ""
+ },
+ "outputAnchors": [
+ {
+ "id": "openAIFunctionAgent_0-output-openAIFunctionAgent-AgentExecutor|BaseChain",
+ "name": "openAIFunctionAgent",
+ "label": "AgentExecutor",
+ "type": "AgentExecutor | BaseChain"
+ }
+ ],
+ "outputs": {},
+ "selected": false
+ },
+ "selected": false,
+ "positionAbsolute": {
+ "x": 1341.2259105169032,
+ "y": 318.35651549722945
+ },
+ "dragging": false
+ },
+ {
+ "width": 300,
+ "height": 376,
+ "id": "bufferMemory_0",
+ "position": {
+ "x": 285.7750469157585,
+ "y": 465.1140427303788
+ },
+ "type": "customNode",
+ "data": {
+ "id": "bufferMemory_0",
+ "label": "Buffer Memory",
+ "name": "bufferMemory",
+ "type": "BufferMemory",
+ "baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"],
+ "category": "Memory",
+ "description": "Remembers previous conversational back and forths directly",
+ "inputParams": [
+ {
+ "label": "Memory Key",
+ "name": "memoryKey",
+ "type": "string",
+ "default": "chat_history",
+ "id": "bufferMemory_0-input-memoryKey-string"
+ },
+ {
+ "label": "Input Key",
+ "name": "inputKey",
+ "type": "string",
+ "default": "input",
+ "id": "bufferMemory_0-input-inputKey-string"
+ }
+ ],
+ "inputAnchors": [],
+ "inputs": {
+ "memoryKey": "chat_history",
+ "inputKey": "input"
+ },
+ "outputAnchors": [
+ {
+ "id": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory",
+ "name": "bufferMemory",
+ "label": "BufferMemory",
+ "type": "BufferMemory | BaseChatMemory | BaseMemory"
+ }
+ ],
+ "outputs": {},
+ "selected": false
+ },
+ "selected": false,
+ "positionAbsolute": {
+ "x": 285.7750469157585,
+ "y": 465.1140427303788
+ },
+ "dragging": false
+ },
+ {
+ "width": 300,
+ "height": 277,
+ "id": "customTool_0",
+ "position": {
+ "x": 883.9529939431576,
+ "y": -32.32503903826486
+ },
+ "type": "customNode",
+ "data": {
+ "id": "customTool_0",
+ "label": "Custom Tool",
+ "name": "customTool",
+ "type": "CustomTool",
+ "baseClasses": ["CustomTool", "Tool", "StructuredTool"],
+ "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": ""
+ },
+ "outputAnchors": [
+ {
+ "id": "customTool_0-output-customTool-CustomTool|Tool|StructuredTool",
+ "name": "customTool",
+ "label": "CustomTool",
+ "type": "CustomTool | Tool | StructuredTool"
+ }
+ ],
+ "outputs": {},
+ "selected": false
+ },
+ "selected": false,
+ "positionAbsolute": {
+ "x": 883.9529939431576,
+ "y": -32.32503903826486
},
"dragging": false
}
],
"edges": [
{
- "source": "chatOpenAI_0",
- "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain|Serializable",
+ "source": "serper_0",
+ "sourceHandle": "serper_0-output-serper-Serper|Tool|StructuredTool|BaseLangChain|Serializable",
"target": "openAIFunctionAgent_0",
- "targetHandle": "openAIFunctionAgent_0-input-model-BaseChatModel",
+ "targetHandle": "openAIFunctionAgent_0-input-tools-Tool",
"type": "buttonedge",
- "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain|Serializable-openAIFunctionAgent_0-openAIFunctionAgent_0-input-model-BaseChatModel",
+ "id": "serper_0-serper_0-output-serper-Serper|Tool|StructuredTool|BaseLangChain|Serializable-openAIFunctionAgent_0-openAIFunctionAgent_0-input-tools-Tool",
"data": {
"label": ""
}
@@ -317,12 +435,34 @@
}
},
{
- "source": "serper_0",
- "sourceHandle": "serper_0-output-serper-Serper|Tool|StructuredTool|BaseLangChain|Serializable",
+ "source": "chatOpenAI_0",
+ "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain|Serializable",
+ "target": "openAIFunctionAgent_0",
+ "targetHandle": "openAIFunctionAgent_0-input-model-BaseChatModel",
+ "type": "buttonedge",
+ "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain|Serializable-openAIFunctionAgent_0-openAIFunctionAgent_0-input-model-BaseChatModel",
+ "data": {
+ "label": ""
+ }
+ },
+ {
+ "source": "bufferMemory_0",
+ "sourceHandle": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory",
+ "target": "openAIFunctionAgent_0",
+ "targetHandle": "openAIFunctionAgent_0-input-memory-BaseChatMemory",
+ "type": "buttonedge",
+ "id": "bufferMemory_0-bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory-openAIFunctionAgent_0-openAIFunctionAgent_0-input-memory-BaseChatMemory",
+ "data": {
+ "label": ""
+ }
+ },
+ {
+ "source": "customTool_0",
+ "sourceHandle": "customTool_0-output-customTool-CustomTool|Tool|StructuredTool",
"target": "openAIFunctionAgent_0",
"targetHandle": "openAIFunctionAgent_0-input-tools-Tool",
"type": "buttonedge",
- "id": "serper_0-serper_0-output-serper-Serper|Tool|StructuredTool|BaseLangChain|Serializable-openAIFunctionAgent_0-openAIFunctionAgent_0-input-tools-Tool",
+ "id": "customTool_0-customTool_0-output-customTool-CustomTool|Tool|StructuredTool-openAIFunctionAgent_0-openAIFunctionAgent_0-input-tools-Tool",
"data": {
"label": ""
}