feat: Finalize zep-cloud integration, update naming

This commit is contained in:
paulpaliychuk 2024-02-20 00:31:35 -05:00
parent 29c86f77bf
commit 9da7a1b4de
6 changed files with 27 additions and 17 deletions

View File

@ -17,8 +17,8 @@ class ZepMemory_Memory implements INode {
inputs: INodeParams[] inputs: INodeParams[]
constructor() { constructor() {
this.label = 'Zep Memory' this.label = 'Zep Memory - Open Source'
this.name = 'ZepMemory' this.name = 'Zep Memory (Open Source)'
this.version = 2.0 this.version = 2.0
this.type = 'ZepMemory' this.type = 'ZepMemory'
this.icon = 'zep.svg' this.icon = 'zep.svg'
@ -97,11 +97,11 @@ class ZepMemory_Memory implements INode {
} }
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> { async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
return await initalizeZep(nodeData, options) return await initializeZep(nodeData, options)
} }
} }
const initalizeZep = async (nodeData: INodeData, options: ICommonObject): Promise<ZepMemory> => { const initializeZep = async (nodeData: INodeData, options: ICommonObject): Promise<ZepMemory> => {
const baseURL = nodeData.inputs?.baseURL as string const baseURL = nodeData.inputs?.baseURL as string
const aiPrefix = nodeData.inputs?.aiPrefix as string const aiPrefix = nodeData.inputs?.aiPrefix as string
const humanPrefix = nodeData.inputs?.humanPrefix as string const humanPrefix = nodeData.inputs?.humanPrefix as string

View File

@ -20,7 +20,7 @@ class ZepMemoryCloud_Memory implements INode {
constructor() { constructor() {
this.label = 'Zep Memory - Cloud' this.label = 'Zep Memory - Cloud'
this.name = 'ZepMemory (Cloud)' this.name = 'Zep Memory (Cloud)'
this.version = 2.0 this.version = 2.0
this.type = 'ZepMemory' this.type = 'ZepMemory'
this.icon = 'zep.svg' this.icon = 'zep.svg'
@ -75,6 +75,13 @@ class ZepMemoryCloud_Memory implements INode {
default: 'chat_history', default: 'chat_history',
additionalParams: true additionalParams: true
}, },
{
label: 'Input Key',
name: 'inputKey',
type: 'string',
default: 'input',
additionalParams: true
},
{ {
label: 'Output Key', label: 'Output Key',
name: 'outputKey', name: 'outputKey',
@ -86,20 +93,21 @@ class ZepMemoryCloud_Memory implements INode {
} }
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> { async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
return await initalizeZep(nodeData, options) return await initializeZep(nodeData, options)
} }
} }
const initalizeZep = async (nodeData: INodeData, options: ICommonObject): Promise<ZepMemory> => { const initializeZep = async (nodeData: INodeData, options: ICommonObject): Promise<ZepMemory> => {
const aiPrefix = nodeData.inputs?.aiPrefix as string const aiPrefix = nodeData.inputs?.aiPrefix as string
const humanPrefix = nodeData.inputs?.humanPrefix as string const humanPrefix = nodeData.inputs?.humanPrefix as string
const memoryKey = nodeData.inputs?.memoryKey as string const memoryKey = nodeData.inputs?.memoryKey as string
const inputKey = nodeData.inputs?.inputKey as string
const memoryType = nodeData.inputs?.memoryType as 'perpetual' | 'message_window' const memoryType = nodeData.inputs?.memoryType as 'perpetual' | 'message_window'
const sessionId = nodeData.inputs?.sessionId as string const sessionId = nodeData.inputs?.sessionId as string
const credentialData = await getCredentialData(nodeData.credential ?? '', options) const credentialData = await getCredentialData(nodeData.credential ?? '', options)
const apiKey = getCredentialParam('apiKey', credentialData, nodeData) const apiKey = getCredentialParam('apiKey', credentialData, nodeData)
const obj: ZepMemoryInput & ZepMemoryExtendedInput = { const obj: ZepMemoryInput & ZepMemoryExtendedInput = {
apiKey, apiKey,
baseURL: 'https://api.development.getzep.com', baseURL: 'https://api.development.getzep.com',
@ -107,7 +115,9 @@ const initalizeZep = async (nodeData: INodeData, options: ICommonObject): Promis
humanPrefix, humanPrefix,
memoryKey, memoryKey,
sessionId, sessionId,
memoryType: memoryType inputKey,
memoryType: memoryType,
returnMessages: true
} }
return new ZepMemoryExtended(obj) return new ZepMemoryExtended(obj)
@ -157,7 +167,7 @@ class ZepMemoryExtended extends ZepMemory implements MemoryMethods {
const id = overrideSessionId ? overrideSessionId : this.sessionId const id = overrideSessionId ? overrideSessionId : this.sessionId
const input = msgArray.find((msg) => msg.type === 'userMessage') const input = msgArray.find((msg) => msg.type === 'userMessage')
const output = msgArray.find((msg) => msg.type === 'apiMessage') const output = msgArray.find((msg) => msg.type === 'apiMessage')
const inputValues = { ['input']: input?.text } const inputValues = { [this.inputKey ?? 'input']: input?.text }
const outputValues = { output: output?.text } const outputValues = { output: output?.text }
await this.saveContext(inputValues, outputValues, id) await this.saveContext(inputValues, outputValues, id)

View File

@ -22,8 +22,8 @@ class Zep_VectorStores implements INode {
outputs: INodeOutputsValue[] outputs: INodeOutputsValue[]
constructor() { constructor() {
this.label = 'Zep' this.label = 'Zep Collection - Open Source'
this.name = 'zep' this.name = 'Zep Collection (Open Source)'
this.version = 2.0 this.version = 2.0
this.type = 'Zep' this.type = 'Zep'
this.icon = 'zep.svg' this.icon = 'zep.svg'

View File

@ -20,8 +20,8 @@ class Zep_Existing_VectorStores implements INode {
outputs: INodeOutputsValue[] outputs: INodeOutputsValue[]
constructor() { constructor() {
this.label = 'Zep Load Existing Index' this.label = 'Zep Load Existing Index (Open Source)'
this.name = 'zepExistingIndex' this.name = 'Zep Existing Index (Open Source)'
this.version = 1.0 this.version = 1.0
this.type = 'Zep' this.type = 'Zep'
this.icon = 'zep.svg' this.icon = 'zep.svg'

View File

@ -20,8 +20,8 @@ class Zep_Upsert_VectorStores implements INode {
outputs: INodeOutputsValue[] outputs: INodeOutputsValue[]
constructor() { constructor() {
this.label = 'Zep Upsert Document' this.label = 'Zep Upsert Document (Open Source)'
this.name = 'zepUpsert' this.name = 'Zep Upsert (Open Source)'
this.version = 1.0 this.version = 1.0
this.type = 'Zep' this.type = 'Zep'
this.icon = 'zep.svg' this.icon = 'zep.svg'

View File

@ -23,7 +23,7 @@ class Zep_CloudVectorStores implements INode {
constructor() { constructor() {
this.label = 'Zep Collection - Cloud' this.label = 'Zep Collection - Cloud'
this.name = 'zepCloud' this.name = 'Zep Collection Cloud'
this.version = 2.0 this.version = 2.0
this.type = 'Zep' this.type = 'Zep'
this.icon = 'zep.svg' this.icon = 'zep.svg'