From be048ebdc2a46bf20426f3d856e78d2fbe104a4d Mon Sep 17 00:00:00 2001 From: Jean IBARZ Date: Sun, 8 Dec 2024 02:02:43 +0100 Subject: [PATCH 1/8] feat: Add option to disable conversation history - Add new `disableConversationHistory` boolean parameter in LLMNodes.ts and Agent.ts to optionally skip including conversation history in prompts - Fix potential error in Agent.ts when messages array is empty by adding null safety checks - Improve memory efficiency by allowing stateless interactions when history isn't needed --- .../nodes/sequentialagents/Agent/Agent.ts | 14 +++++++++++--- .../nodes/sequentialagents/LLMNode/LLMNode.ts | 10 +++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/packages/components/nodes/sequentialagents/Agent/Agent.ts b/packages/components/nodes/sequentialagents/Agent/Agent.ts index a5517095543..e666efcf0cb 100644 --- a/packages/components/nodes/sequentialagents/Agent/Agent.ts +++ b/packages/components/nodes/sequentialagents/Agent/Agent.ts @@ -217,6 +217,14 @@ class Agent_SeqAgents implements INode { optional: true, default: examplePrompt }, + { + label: 'Disable Conversation History', + name: 'disableConversationHistory', + type: 'boolean', + optional: true, + description: `If set to true, the conversation history messages from the state will not be automatically included in the prompt`, + additionalParams: true + }, { label: 'Human Prompt', name: 'humanMessagePrompt', @@ -728,16 +736,16 @@ async function agentNode( } // @ts-ignore - state.messages = restructureMessages(llm, state) + state.messages = nodeData.inputs?.disableConversationHistory | false? [] : restructureMessages(llm, state) let result = await agent.invoke({ ...state, signal: abortControllerSignal.signal }, config) if (interrupt) { const messages = state.messages as unknown as BaseMessage[] - const lastMessage = messages[messages.length - 1] + const lastMessage = messages.length ? messages[messages.length - 1] : null // If the last message is a tool message and is an interrupted message, format output into standard agent output - if (lastMessage._getType() === 'tool' && lastMessage.additional_kwargs?.nodeId === nodeData.id) { + if (lastMessage && lastMessage._getType() === 'tool' && lastMessage.additional_kwargs?.nodeId === nodeData.id) { let formattedAgentResult: { output?: string usedTools?: IUsedTool[] diff --git a/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts b/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts index 0fcb7eb20e0..95d97719bc4 100644 --- a/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts +++ b/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts @@ -187,6 +187,14 @@ class LLMNode_SeqAgents implements INode { type: 'string', placeholder: 'LLM' }, + { + label: 'Disable Conversation History', + name: 'disableConversationHistory', + type: 'boolean', + optional: true, + description: `If set to true, the conversation history messages from the state will not be automatically included in the prompt`, + additionalParams: true + }, { label: 'System Prompt', name: 'systemMessagePrompt', @@ -535,7 +543,7 @@ async function agentNode( } // @ts-ignore - state.messages = restructureMessages(llm, state) + state.messages = nodeData.inputs?.disableConversationHistory | false ? [] : restructureMessages(llm, state) let result: AIMessageChunk | ICommonObject = await agent.invoke({ ...state, signal: abortControllerSignal.signal }, config) From 98abc09e84a5c8431889231d2ac07d69353ac608 Mon Sep 17 00:00:00 2001 From: Jean IBARZ Date: Wed, 11 Dec 2024 21:56:23 +0100 Subject: [PATCH 2/8] feat: add conversation history filtering options Replace the disable conversation history feature with a more flexible filtering system that allows selecting: - User question only - Last message only - All messages (default) - No messages This provides more granular control over conversation context management. --- .../nodes/sequentialagents/Agent/Agent.ts | 42 +++++++++++++--- .../nodes/sequentialagents/LLMNode/LLMNode.ts | 40 ++++++++++++--- .../nodes/sequentialagents/commonUtils.ts | 50 ++++++++++++++++++- packages/components/src/Interface.ts | 1 + 4 files changed, 119 insertions(+), 14 deletions(-) diff --git a/packages/components/nodes/sequentialagents/Agent/Agent.ts b/packages/components/nodes/sequentialagents/Agent/Agent.ts index e666efcf0cb..b243ec6c48a 100644 --- a/packages/components/nodes/sequentialagents/Agent/Agent.ts +++ b/packages/components/nodes/sequentialagents/Agent/Agent.ts @@ -19,7 +19,8 @@ import { IDatabaseEntity, IUsedTool, IDocument, - IStateWithMessages + IStateWithMessages, + ConversationHistorySelection } from '../../../src/Interface' import { ToolCallingAgentOutputParser, AgentExecutor, SOURCE_DOCUMENTS_PREFIX, ARTIFACTS_PREFIX } from '../../../src/agents' import { getInputVariables, getVars, handleEscapeCharacters, prepareSandboxVars, removeInvalidImageMarkdown } from '../../../src/utils' @@ -28,6 +29,7 @@ import { getVM, processImageMessage, transformObjectPropertyToFunction, + filterConversationHistory, restructureMessages, MessagesState, RunnableCallable, @@ -218,11 +220,34 @@ class Agent_SeqAgents implements INode { default: examplePrompt }, { - label: 'Disable Conversation History', - name: 'disableConversationHistory', - type: 'boolean', + label: 'Conversation History Selection', + name: 'conversationHistorySelection', + type: 'options', + options: [ + { + label: 'User Question', + name: 'user_question', + description: 'Use the user question from the historical conversation messages as input.' + }, + { + label: 'Last Conversation Message', + name: 'last_message', + description: 'Use the last conversation message from the historical conversation messages as input.' + }, + { + label: 'All Conversation Messages', + name: 'all_messages', + description: 'Use all conversation messages from the historical conversation messages as input.' + }, + { + label: 'Empty', + name: 'empty', + description: 'Do not use any messages from the conversation history. Ensure to use either System Prompt, Human Prompt, or Messages History.' + } + ], + default: 'all_messages', optional: true, - description: `If set to true, the conversation history messages from the state will not be automatically included in the prompt`, + description: `Select which messages from the conversation history to include in the prompt. The selected messages will be inserted between the System Prompt (if defined) and [Messages History, Human Prompt].`, additionalParams: true }, { @@ -735,9 +760,12 @@ async function agentNode( throw new Error('Aborted!') } + const historySelection = (nodeData.inputs?.conversationHistorySelection || 'all_messages') as ConversationHistorySelection // @ts-ignore - state.messages = nodeData.inputs?.disableConversationHistory | false? [] : restructureMessages(llm, state) - + state.messages = filterConversationHistory(historySelection, input, state) + // @ts-ignore + state.messages = restructureMessages(llm, state) + let result = await agent.invoke({ ...state, signal: abortControllerSignal.signal }, config) if (interrupt) { diff --git a/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts b/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts index 95d97719bc4..d66b24f0c50 100644 --- a/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts +++ b/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts @@ -14,7 +14,8 @@ import { MessageContentImageUrl, INodeOutputsValue, ISeqAgentNode, - IDatabaseEntity + IDatabaseEntity, + ConversationHistorySelection } from '../../../src/Interface' import { AgentExecutor } from '../../../src/agents' import { getInputVariables, getVars, handleEscapeCharacters, prepareSandboxVars } from '../../../src/utils' @@ -25,6 +26,7 @@ import { getVM, processImageMessage, transformObjectPropertyToFunction, + filterConversationHistory, restructureMessages, checkMessageHistory } from '../commonUtils' @@ -188,11 +190,34 @@ class LLMNode_SeqAgents implements INode { placeholder: 'LLM' }, { - label: 'Disable Conversation History', - name: 'disableConversationHistory', - type: 'boolean', + label: 'Conversation History Selection', + name: 'conversationHistorySelection', + type: 'options', + options: [ + { + label: 'User Question', + name: 'user_question', + description: 'Use the user question from the historical conversation messages as input.' + }, + { + label: 'Last Conversation Message', + name: 'last_message', + description: 'Use the last conversation message from the historical conversation messages as input.' + }, + { + label: 'All Conversation Messages', + name: 'all_messages', + description: 'Use all conversation messages from the historical conversation messages as input.' + }, + { + label: 'Empty', + name: 'empty', + description: 'Do not use any messages from the conversation history. Ensure to use either System Prompt, Human Prompt, or Messages History.' + } + ], + default: 'all_messages', optional: true, - description: `If set to true, the conversation history messages from the state will not be automatically included in the prompt`, + description: `Select which messages from the conversation history to include in the prompt. The selected messages will be inserted between the System Prompt (if defined) and [Messages History, Human Prompt].`, additionalParams: true }, { @@ -542,8 +567,11 @@ async function agentNode( throw new Error('Aborted!') } + const historySelection = (nodeData.inputs?.conversationHistorySelection || 'all_messages') as ConversationHistorySelection + // @ts-ignore + state.messages = filterConversationHistory(historySelection, input, state) // @ts-ignore - state.messages = nodeData.inputs?.disableConversationHistory | false ? [] : restructureMessages(llm, state) + state.messages = restructureMessages(llm, state) let result: AIMessageChunk | ICommonObject = await agent.invoke({ ...state, signal: abortControllerSignal.signal }, config) diff --git a/packages/components/nodes/sequentialagents/commonUtils.ts b/packages/components/nodes/sequentialagents/commonUtils.ts index c2c2505a552..4aab7968eda 100644 --- a/packages/components/nodes/sequentialagents/commonUtils.ts +++ b/packages/components/nodes/sequentialagents/commonUtils.ts @@ -9,7 +9,14 @@ import { Runnable, RunnableConfig, mergeConfigs } from '@langchain/core/runnable import { AIMessage, BaseMessage, HumanMessage, MessageContentImageUrl, ToolMessage } from '@langchain/core/messages' import { BaseChatModel } from '@langchain/core/language_models/chat_models' import { addImagesToMessages, llmSupportsVision } from '../../src/multiModalUtils' -import { ICommonObject, IDatabaseEntity, INodeData, ISeqAgentsState, IVisionChatModal } from '../../src/Interface' +import { + ICommonObject, + IDatabaseEntity, + INodeData, + ISeqAgentsState, + IVisionChatModal, + ConversationHistorySelection +} from '../../src/Interface' import { availableDependencies, defaultAllowBuiltInDep, getVars, prepareSandboxVars } from '../../src/utils' import { ChatPromptTemplate, BaseMessagePromptTemplateLike } from '@langchain/core/prompts' @@ -208,6 +215,47 @@ export const convertStructuredSchemaToZod = (schema: string | object): ICommonOb } } +/** + * Filter the conversation history based on the selected option. + * + * @param historySelection - The selected history option. + * @param input - The user input. + * @param state - The current state of the sequential llm or agent node. + */ +export function filterConversationHistory( + historySelection: ConversationHistorySelection, + input: string, + state: ISeqAgentsState +): BaseMessage[] { + let filteredMessages: BaseMessage[] = [] + if (state.messages) { + switch (historySelection) { + case 'user_question': + // @ts-ignore + filteredMessages = [new HumanMessage(input)]; + break; + case 'last_message': + // @ts-ignore + filteredMessages = [state.messages[state.messages.length - 1]]; + break; + case 'empty': + // @ts-ignore + filteredMessages = []; + break; + case 'all_messages': + // Explicitly handle 'all_messages' by keeping the existing messages + // @ts-ignore + filteredMessages = state.messages; + break; + default: + // Ensures all cases are handled and catches any unexpected values + const exhaustiveCheck: never = historySelection; + throw new Error(`Unhandled conversationHistorySelection: ${exhaustiveCheck}`); + } + } + return filteredMessages +} + export const restructureMessages = (llm: BaseChatModel, state: ISeqAgentsState) => { const messages: BaseMessage[] = [] for (const message of state.messages as unknown as BaseMessage[]) { diff --git a/packages/components/src/Interface.ts b/packages/components/src/Interface.ts index d90a4ebab67..788467c9ff0 100644 --- a/packages/components/src/Interface.ts +++ b/packages/components/src/Interface.ts @@ -183,6 +183,7 @@ export interface IMultiAgentNode { } type SeqAgentType = 'agent' | 'condition' | 'end' | 'start' | 'tool' | 'state' | 'llm' +export type ConversationHistorySelection = 'user_question' | 'last_message' | 'all_messages' | 'empty' export interface ISeqAgentNode { id: string From c03107ae60e0ed098ad403d500116497c6674a6c Mon Sep 17 00:00:00 2001 From: Jean IBARZ Date: Wed, 11 Dec 2024 22:05:08 +0100 Subject: [PATCH 3/8] chore: break lines --- packages/components/nodes/sequentialagents/Agent/Agent.ts | 7 +++++-- .../components/nodes/sequentialagents/LLMNode/LLMNode.ts | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/components/nodes/sequentialagents/Agent/Agent.ts b/packages/components/nodes/sequentialagents/Agent/Agent.ts index b243ec6c48a..93016d52103 100644 --- a/packages/components/nodes/sequentialagents/Agent/Agent.ts +++ b/packages/components/nodes/sequentialagents/Agent/Agent.ts @@ -242,12 +242,15 @@ class Agent_SeqAgents implements INode { { label: 'Empty', name: 'empty', - description: 'Do not use any messages from the conversation history. Ensure to use either System Prompt, Human Prompt, or Messages History.' + description: 'Do not use any messages from the conversation history. ' + + 'Ensure to use either System Prompt, Human Prompt, or Messages History.' } ], default: 'all_messages', optional: true, - description: `Select which messages from the conversation history to include in the prompt. The selected messages will be inserted between the System Prompt (if defined) and [Messages History, Human Prompt].`, + description: 'Select which messages from the conversation history to include in the prompt. ' + + 'The selected messages will be inserted between the System Prompt (if defined) and ' + + '[Messages History, Human Prompt].', additionalParams: true }, { diff --git a/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts b/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts index d66b24f0c50..c60c4427de7 100644 --- a/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts +++ b/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts @@ -212,12 +212,15 @@ class LLMNode_SeqAgents implements INode { { label: 'Empty', name: 'empty', - description: 'Do not use any messages from the conversation history. Ensure to use either System Prompt, Human Prompt, or Messages History.' + description: 'Do not use any messages from the conversation history. ' + + 'Ensure to use either System Prompt, Human Prompt, or Messages History.' } ], default: 'all_messages', optional: true, - description: `Select which messages from the conversation history to include in the prompt. The selected messages will be inserted between the System Prompt (if defined) and [Messages History, Human Prompt].`, + description: 'Select which messages from the conversation history to include in the prompt. ' + + 'The selected messages will be inserted between the System Prompt (if defined) and ' + + '[Messages History, Human Prompt].', additionalParams: true }, { From f629397f62113315a6dd85f17c2334edae627d20 Mon Sep 17 00:00:00 2001 From: Jean IBARZ Date: Wed, 11 Dec 2024 22:05:32 +0100 Subject: [PATCH 4/8] chore: removed ending semi columns --- .../components/nodes/sequentialagents/commonUtils.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/components/nodes/sequentialagents/commonUtils.ts b/packages/components/nodes/sequentialagents/commonUtils.ts index 4aab7968eda..7a328538b45 100644 --- a/packages/components/nodes/sequentialagents/commonUtils.ts +++ b/packages/components/nodes/sequentialagents/commonUtils.ts @@ -232,25 +232,25 @@ export function filterConversationHistory( switch (historySelection) { case 'user_question': // @ts-ignore - filteredMessages = [new HumanMessage(input)]; + filteredMessages = [new HumanMessage(input)] break; case 'last_message': // @ts-ignore - filteredMessages = [state.messages[state.messages.length - 1]]; + filteredMessages = [state.messages[state.messages.length - 1]] break; case 'empty': // @ts-ignore - filteredMessages = []; + filteredMessages = [] break; case 'all_messages': // Explicitly handle 'all_messages' by keeping the existing messages // @ts-ignore - filteredMessages = state.messages; + filteredMessages = state.messages break; default: // Ensures all cases are handled and catches any unexpected values const exhaustiveCheck: never = historySelection; - throw new Error(`Unhandled conversationHistorySelection: ${exhaustiveCheck}`); + throw new Error(`Unhandled conversationHistorySelection: ${exhaustiveCheck}`) } } return filteredMessages From 5c050f41a1885cc7a3a64df5a30a0529aae57170 Mon Sep 17 00:00:00 2001 From: Jean IBARZ Date: Wed, 11 Dec 2024 22:27:09 +0100 Subject: [PATCH 5/8] chore: fix eslint errors --- .../components/nodes/sequentialagents/Agent/Agent.ts | 8 +++++--- .../nodes/sequentialagents/LLMNode/LLMNode.ts | 6 ++++-- .../components/nodes/sequentialagents/commonUtils.ts | 12 +++++------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/components/nodes/sequentialagents/Agent/Agent.ts b/packages/components/nodes/sequentialagents/Agent/Agent.ts index 93016d52103..df5608127a0 100644 --- a/packages/components/nodes/sequentialagents/Agent/Agent.ts +++ b/packages/components/nodes/sequentialagents/Agent/Agent.ts @@ -242,13 +242,15 @@ class Agent_SeqAgents implements INode { { label: 'Empty', name: 'empty', - description: 'Do not use any messages from the conversation history. ' + + description: + 'Do not use any messages from the conversation history. ' + 'Ensure to use either System Prompt, Human Prompt, or Messages History.' } ], default: 'all_messages', optional: true, - description: 'Select which messages from the conversation history to include in the prompt. ' + + description: + 'Select which messages from the conversation history to include in the prompt. ' + 'The selected messages will be inserted between the System Prompt (if defined) and ' + '[Messages History, Human Prompt].', additionalParams: true @@ -768,7 +770,7 @@ async function agentNode( state.messages = filterConversationHistory(historySelection, input, state) // @ts-ignore state.messages = restructureMessages(llm, state) - + let result = await agent.invoke({ ...state, signal: abortControllerSignal.signal }, config) if (interrupt) { diff --git a/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts b/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts index c60c4427de7..ea66ff2031b 100644 --- a/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts +++ b/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts @@ -212,13 +212,15 @@ class LLMNode_SeqAgents implements INode { { label: 'Empty', name: 'empty', - description: 'Do not use any messages from the conversation history. ' + + description: + 'Do not use any messages from the conversation history. ' + 'Ensure to use either System Prompt, Human Prompt, or Messages History.' } ], default: 'all_messages', optional: true, - description: 'Select which messages from the conversation history to include in the prompt. ' + + description: + 'Select which messages from the conversation history to include in the prompt. ' + 'The selected messages will be inserted between the System Prompt (if defined) and ' + '[Messages History, Human Prompt].', additionalParams: true diff --git a/packages/components/nodes/sequentialagents/commonUtils.ts b/packages/components/nodes/sequentialagents/commonUtils.ts index 7a328538b45..5fdb08a54f5 100644 --- a/packages/components/nodes/sequentialagents/commonUtils.ts +++ b/packages/components/nodes/sequentialagents/commonUtils.ts @@ -233,24 +233,22 @@ export function filterConversationHistory( case 'user_question': // @ts-ignore filteredMessages = [new HumanMessage(input)] - break; + break case 'last_message': // @ts-ignore filteredMessages = [state.messages[state.messages.length - 1]] - break; + break case 'empty': // @ts-ignore filteredMessages = [] - break; + break case 'all_messages': // Explicitly handle 'all_messages' by keeping the existing messages // @ts-ignore filteredMessages = state.messages - break; + break default: - // Ensures all cases are handled and catches any unexpected values - const exhaustiveCheck: never = historySelection; - throw new Error(`Unhandled conversationHistorySelection: ${exhaustiveCheck}`) + throw new Error(`Unhandled conversationHistorySelection: ${historySelection}`) } } return filteredMessages From 192c728b29611437bdb5cec44f765f3dd7397e0f Mon Sep 17 00:00:00 2001 From: Jean IBARZ Date: Wed, 11 Dec 2024 22:42:05 +0100 Subject: [PATCH 6/8] fix(sequentialagents): improve conversation history filtering logic - Remove unnecessary state.messages check for user_question case - Add proper null handling for last_message and all_messages cases - Remove @ts-ignore comments with proper typing --- .../nodes/sequentialagents/commonUtils.ts | 37 +++++++------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/packages/components/nodes/sequentialagents/commonUtils.ts b/packages/components/nodes/sequentialagents/commonUtils.ts index 5fdb08a54f5..e6e9ac243be 100644 --- a/packages/components/nodes/sequentialagents/commonUtils.ts +++ b/packages/components/nodes/sequentialagents/commonUtils.ts @@ -227,31 +227,20 @@ export function filterConversationHistory( input: string, state: ISeqAgentsState ): BaseMessage[] { - let filteredMessages: BaseMessage[] = [] - if (state.messages) { - switch (historySelection) { - case 'user_question': - // @ts-ignore - filteredMessages = [new HumanMessage(input)] - break - case 'last_message': - // @ts-ignore - filteredMessages = [state.messages[state.messages.length - 1]] - break - case 'empty': - // @ts-ignore - filteredMessages = [] - break - case 'all_messages': - // Explicitly handle 'all_messages' by keeping the existing messages - // @ts-ignore - filteredMessages = state.messages - break - default: - throw new Error(`Unhandled conversationHistorySelection: ${historySelection}`) - } + switch (historySelection) { + case 'user_question': + return [new HumanMessage(input)] + case 'last_message': + // @ts-ignore + return state.messages?.length ? [state.messages[state.messages.length - 1] as BaseMessage] : [] + case 'empty': + return [] + case 'all_messages': + // @ts-ignore + return (state.messages as BaseMessage[]) ?? [] + default: + throw new Error(`Unhandled conversationHistorySelection: ${historySelection}`) } - return filteredMessages } export const restructureMessages = (llm: BaseChatModel, state: ISeqAgentsState) => { From 3bd3920682d7465c2ce63934535f578ea9e2a146 Mon Sep 17 00:00:00 2001 From: Henry Heng Date: Thu, 12 Dec 2024 11:10:08 +0000 Subject: [PATCH 7/8] Update LLMNode.ts --- .../nodes/sequentialagents/LLMNode/LLMNode.ts | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts b/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts index ea66ff2031b..cfe17632c66 100644 --- a/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts +++ b/packages/components/nodes/sequentialagents/LLMNode/LLMNode.ts @@ -175,7 +175,7 @@ class LLMNode_SeqAgents implements INode { constructor() { this.label = 'LLM Node' this.name = 'seqLLMNode' - this.version = 3.0 + this.version = 4.0 this.type = 'LLMNode' this.icon = 'llmNode.svg' this.category = 'Sequential Agents' @@ -190,7 +190,26 @@ class LLMNode_SeqAgents implements INode { placeholder: 'LLM' }, { - label: 'Conversation History Selection', + label: 'System Prompt', + name: 'systemMessagePrompt', + type: 'string', + rows: 4, + optional: true, + additionalParams: true + }, + { + label: 'Prepend Messages History', + name: 'messageHistory', + description: + 'Prepend a list of messages between System Prompt and Human Prompt. This is useful when you want to provide few shot examples', + type: 'code', + hideCodeExecute: true, + codeExample: messageHistoryExample, + optional: true, + additionalParams: true + }, + { + label: 'Conversation History', name: 'conversationHistorySelection', type: 'options', options: [ @@ -225,14 +244,6 @@ class LLMNode_SeqAgents implements INode { '[Messages History, Human Prompt].', additionalParams: true }, - { - label: 'System Prompt', - name: 'systemMessagePrompt', - type: 'string', - rows: 4, - optional: true, - additionalParams: true - }, { label: 'Human Prompt', name: 'humanMessagePrompt', @@ -242,17 +253,6 @@ class LLMNode_SeqAgents implements INode { optional: true, additionalParams: true }, - { - label: 'Messages History', - name: 'messageHistory', - description: - 'Return a list of messages between System Prompt and Human Prompt. This is useful when you want to provide few shot examples', - type: 'code', - hideCodeExecute: true, - codeExample: messageHistoryExample, - optional: true, - additionalParams: true - }, { label: 'Start | Agent | Condition | LLM | Tool Node', name: 'sequentialNode', From 3d683c5d896665e942b09493bb1b7492007cd611 Mon Sep 17 00:00:00 2001 From: Henry Heng Date: Thu, 12 Dec 2024 11:11:44 +0000 Subject: [PATCH 8/8] Update Agent.ts --- .../nodes/sequentialagents/Agent/Agent.ts | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/components/nodes/sequentialagents/Agent/Agent.ts b/packages/components/nodes/sequentialagents/Agent/Agent.ts index df5608127a0..c4b2bee1a1f 100644 --- a/packages/components/nodes/sequentialagents/Agent/Agent.ts +++ b/packages/components/nodes/sequentialagents/Agent/Agent.ts @@ -197,7 +197,7 @@ class Agent_SeqAgents implements INode { constructor() { this.label = 'Agent' this.name = 'seqAgent' - this.version = 3.1 + this.version = 4.0 this.type = 'Agent' this.icon = 'seqAgent.png' this.category = 'Sequential Agents' @@ -220,7 +220,18 @@ class Agent_SeqAgents implements INode { default: examplePrompt }, { - label: 'Conversation History Selection', + label: 'Prepend Messages History', + name: 'messageHistory', + description: + 'Prepend a list of messages between System Prompt and Human Prompt. This is useful when you want to provide few shot examples', + type: 'code', + hideCodeExecute: true, + codeExample: messageHistoryExample, + optional: true, + additionalParams: true + }, + { + label: 'Conversation History', name: 'conversationHistorySelection', type: 'options', options: [ @@ -264,17 +275,6 @@ class Agent_SeqAgents implements INode { optional: true, additionalParams: true }, - { - label: 'Messages History', - name: 'messageHistory', - description: - 'Return a list of messages between System Prompt and Human Prompt. This is useful when you want to provide few shot examples', - type: 'code', - hideCodeExecute: true, - codeExample: messageHistoryExample, - optional: true, - additionalParams: true - }, { label: 'Tools', name: 'tools',