Update LLMInMemoryCache.ts

code cleanup
This commit is contained in:
Henry Heng 2023-10-06 23:34:07 +01:00 committed by GitHub
parent 91581250a7
commit 0b0cf357c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 11 deletions

View File

@ -1,4 +1,4 @@
import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { INode, INodeParams } from '../../../src/Interface'
import { InMemoryCache } from 'langchain/cache'
import { getBaseClasses } from '../../../src'
@ -12,7 +12,6 @@ class LLMInMemoryCache implements INode {
category: string
baseClasses: string[]
inputs: INodeParams[]
outputs: INodeOutputsValue[]
inMemoryCache: any
constructor() {
@ -22,18 +21,11 @@ class LLMInMemoryCache implements INode {
this.type = 'LLMCache'
this.icon = 'memorycache.png'
this.category = 'LLM Cache'
this.baseClasses = [this.type, 'LLMCacheBase']
this.baseClasses = [this.type, ...getBaseClasses(InMemoryCache)]
this.inputs = []
this.outputs = [
{
label: 'LLM Cache',
name: 'cache',
baseClasses: [this.type, ...getBaseClasses(InMemoryCache)]
}
]
}
async init(nodeData: INodeData): Promise<any> {
async init(): Promise<any> {
if (!this.inMemoryCache) {
this.inMemoryCache = InMemoryCache.global()
}