Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class RedisCacheApi implements INodeCredential {
inputs: INodeParams[]

constructor() {
this.label = 'Redis Cache API'
this.label = 'Redis API'
this.name = 'redisCacheApi'
this.version = 1.0
this.inputs = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ class RedisCacheUrlApi implements INodeCredential {
inputs: INodeParams[]

constructor() {
this.label = 'Redis Cache URL'
this.label = 'Redis URL'
this.name = 'redisCacheUrlApi'
this.version = 1.0
this.inputs = [
{
label: 'Redis URL',
name: 'redisUrl',
type: 'string',
default: '127.0.0.1'
default: 'redis://localhost:6379'
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { initializeAgentExecutorWithOptions, AgentExecutor, InitializeAgentExecu
import { Tool } from 'langchain/tools'
import { BaseChatMemory } from 'langchain/memory'
import { getBaseClasses, mapChatHistory } from '../../../src/utils'
import { BaseLanguageModel } from 'langchain/base_language'
import { BaseChatModel } from 'langchain/chat_models/base'
import { flatten } from 'lodash'
import { additionalCallbacks } from '../../../src/handler'

Expand All @@ -29,7 +29,7 @@ class ConversationalAgent_Agents implements INode {
constructor() {
this.label = 'Conversational Agent'
this.name = 'conversationalAgent'
this.version = 1.0
this.version = 2.0
this.type = 'AgentExecutor'
this.category = 'Agents'
this.icon = 'agent.svg'
Expand All @@ -45,7 +45,7 @@ class ConversationalAgent_Agents implements INode {
{
label: 'Language Model',
name: 'model',
type: 'BaseLanguageModel'
type: 'BaseChatModel'
},
{
label: 'Memory',
Expand All @@ -65,7 +65,7 @@ class ConversationalAgent_Agents implements INode {
}

async init(nodeData: INodeData): Promise<any> {
const model = nodeData.inputs?.model as BaseLanguageModel
const model = nodeData.inputs?.model as BaseChatModel
let tools = nodeData.inputs?.tools as Tool[]
tools = flatten(tools)
const memory = nodeData.inputs?.memory as BaseChatMemory
Expand All @@ -92,8 +92,6 @@ class ConversationalAgent_Agents implements INode {
const executor = nodeData.instance as AgentExecutor
const memory = nodeData.inputs?.memory as BaseChatMemory

const callbacks = await additionalCallbacks(nodeData, options)

if (options && options.chatHistory) {
const chatHistoryClassName = memory.chatHistory.constructor.name
// Only replace when its In-Memory
Expand All @@ -103,6 +101,10 @@ class ConversationalAgent_Agents implements INode {
}
}

;(executor.memory as any).returnMessages = true // Return true for BaseChatModel

const callbacks = await additionalCallbacks(nodeData, options)

const result = await executor.call({ input }, [...callbacks])
return result?.output
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class ConversationalRetrievalAgent_Agents implements INode {
if (executor.memory) {
;(executor.memory as any).memoryKey = 'chat_history'
;(executor.memory as any).outputKey = 'output'
;(executor.memory as any).returnMessages = true

const chatHistoryClassName = (executor.memory as any).chatHistory.constructor.name
// Only replace when its In-Memory
if (chatHistoryClassName && chatHistoryClassName === 'ChatMessageHistory') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ class OpenAIFunctionAgent_Agents implements INode {
}
}

;(executor.memory as any).returnMessages = true // Return true for BaseChatModel

const loggerHandler = new ConsoleCallbackHandler(options.logger)
const callbacks = await additionalCallbacks(nodeData, options)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,18 @@ class ConversationChain_Chains implements INode {
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string> {
const chain = nodeData.instance as ConversationChain
const memory = nodeData.inputs?.memory as BufferMemory
memory.returnMessages = true // Return true for BaseChatModel

if (options && options.chatHistory) {
const chatHistoryClassName = memory.chatHistory.constructor.name
// Only replace when its In-Memory
if (chatHistoryClassName && chatHistoryClassName === 'ChatMessageHistory') {
memory.chatHistory = mapChatHistory(options)
chain.memory = memory
}
}

chain.memory = memory

const loggerHandler = new ConsoleCallbackHandler(options.logger)
const callbacks = await additionalCallbacks(nodeData, options)

Expand Down
3 changes: 1 addition & 2 deletions packages/components/nodes/memory/DynamoDb/DynamoDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ const initalizeDynamoDB = async (nodeData: INodeData, options: ICommonObject): P
})

const memory = new BufferMemoryExtended({
memoryKey,
memoryKey: memoryKey ?? 'chat_history',
chatHistory: dynamoDb,
returnMessages: true,
isSessionIdUsingChatMessageId
})
return memory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ const initializeMongoDB = async (nodeData: INodeData, options: ICommonObject): P
}

return new BufferMemoryExtended({
memoryKey,
memoryKey: memoryKey ?? 'chat_history',
chatHistory: mongoDBChatMessageHistory,
returnMessages: true,
isSessionIdUsingChatMessageId
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const initalizeRedis = async (nodeData: INodeData, options: ICommonObject): Prom
}

const memory = new BufferMemoryExtended({
memoryKey,
memoryKey: memoryKey ?? 'chat_history',
chatHistory: redisChatMessageHistory,
isSessionIdUsingChatMessageId
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ const initalizeUpstashRedis = async (nodeData: INodeData, options: ICommonObject
})

const memory = new BufferMemoryExtended({
memoryKey: 'chat_history',
chatHistory: redisChatMessageHistory,
isSessionIdUsingChatMessageId
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class OpenAIModeration implements INode {
this.name = 'inputModerationOpenAI'
this.version = 1.0
this.type = 'Moderation'
this.icon = 'openai-moderation.png'
this.icon = 'openai.png'
this.category = 'Moderation'
this.description = 'Check whether content complies with OpenAI usage policies.'
this.baseClasses = [this.type, ...getBaseClasses(Moderation)]
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flowise-components",
"version": "1.4.3",
"version": "1.4.4",
"description": "Flowiseai Components",
"main": "dist/src/index",
"types": "dist/src/index.d.ts",
Expand Down
34 changes: 17 additions & 17 deletions packages/server/marketplaces/chatflows/API Agent OpenAI.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"nodes": [
{
"width": 300,
"height": 510,
"height": 491,
"id": "openApiChain_1",
"position": {
"x": 1203.1825726424859,
Expand All @@ -13,8 +13,8 @@
"data": {
"id": "openApiChain_1",
"label": "OpenAPI Chain",
"name": "openApiChain",
"version": 1,
"name": "openApiChain",
"type": "OpenAPIChain",
"baseClasses": ["OpenAPIChain", "BaseChain"],
"category": "Chains",
Expand Down Expand Up @@ -78,7 +78,7 @@
},
{
"width": 300,
"height": 523,
"height": 574,
"id": "chatOpenAI_1",
"position": {
"x": 792.3201947594027,
Expand All @@ -88,8 +88,8 @@
"data": {
"id": "chatOpenAI_1",
"label": "ChatOpenAI",
"name": "chatOpenAI",
"version": 2,
"name": "chatOpenAI",
"type": "ChatOpenAI",
"baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"],
"category": "Chat Models",
Expand Down Expand Up @@ -259,8 +259,8 @@
"data": {
"id": "chainTool_0",
"label": "Chain Tool",
"name": "chainTool",
"version": 1,
"name": "chainTool",
"type": "ChainTool",
"baseClasses": ["ChainTool", "DynamicTool", "Tool", "StructuredTool"],
"category": "Tools",
Expand Down Expand Up @@ -333,8 +333,8 @@
"data": {
"id": "openAIFunctionAgent_0",
"label": "OpenAI Function Agent",
"name": "openAIFunctionAgent",
"version": 2,
"name": "openAIFunctionAgent",
"type": "AgentExecutor",
"baseClasses": ["AgentExecutor", "BaseChain"],
"category": "Agents",
Expand Down Expand Up @@ -397,7 +397,7 @@
},
{
"width": 300,
"height": 523,
"height": 574,
"id": "chatOpenAI_2",
"position": {
"x": 1645.450699499575,
Expand All @@ -407,8 +407,8 @@
"data": {
"id": "chatOpenAI_2",
"label": "ChatOpenAI",
"name": "chatOpenAI",
"version": 2,
"name": "chatOpenAI",
"type": "ChatOpenAI",
"baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"],
"category": "Chat Models",
Expand Down Expand Up @@ -578,8 +578,8 @@
"data": {
"id": "bufferMemory_0",
"label": "Buffer Memory",
"name": "bufferMemory",
"version": 1,
"name": "bufferMemory",
"type": "BufferMemory",
"baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"],
"category": "Memory",
Expand Down Expand Up @@ -658,23 +658,23 @@
}
},
{
"source": "chatOpenAI_2",
"sourceHandle": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
"source": "bufferMemory_0",
"sourceHandle": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory",
"target": "openAIFunctionAgent_0",
"targetHandle": "openAIFunctionAgent_0-input-model-BaseChatModel",
"targetHandle": "openAIFunctionAgent_0-input-memory-BaseChatMemory",
"type": "buttonedge",
"id": "chatOpenAI_2-chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-openAIFunctionAgent_0-openAIFunctionAgent_0-input-model-BaseChatModel",
"id": "bufferMemory_0-bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory-openAIFunctionAgent_0-openAIFunctionAgent_0-input-memory-BaseChatMemory",
"data": {
"label": ""
}
},
{
"source": "bufferMemory_0",
"sourceHandle": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory",
"source": "chatOpenAI_2",
"sourceHandle": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
"target": "openAIFunctionAgent_0",
"targetHandle": "openAIFunctionAgent_0-input-memory-BaseChatMemory",
"targetHandle": "openAIFunctionAgent_0-input-model-ChatOpenAI | AzureChatOpenAI",
"type": "buttonedge",
"id": "bufferMemory_0-bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory-openAIFunctionAgent_0-openAIFunctionAgent_0-input-memory-BaseChatMemory",
"id": "chatOpenAI_2-chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-openAIFunctionAgent_0-openAIFunctionAgent_0-input-model-ChatOpenAI | AzureChatOpenAI",
"data": {
"label": ""
}
Expand Down
Loading