Renaming of Category, Class Names and File names from LLMCache to Cache as this functionality is applicable to both LLM and Chat Models.

This commit is contained in:
vinodkiran 2023-10-08 15:53:06 +05:30
parent 679eac1d0b
commit e01acbc3e8
8 changed files with 24 additions and 24 deletions

View File

@ -1,8 +1,8 @@
import { INode, INodeParams } from '../../../src/Interface'
import { InMemoryCache } from 'langchain/cache'
import { InMemoryCache as LangchainInMemoryCache } from 'langchain/cache'
import { getBaseClasses } from '../../../src'
class LLMInMemoryCache implements INode {
class InMemoryCache implements INode {
label: string
name: string
version: number
@ -18,19 +18,19 @@ class LLMInMemoryCache implements INode {
this.label = 'Local (Builtin) Cache'
this.name = 'localCache'
this.version = 1.0
this.type = 'LLMCache'
this.type = 'Cache'
this.icon = 'memorycache.png'
this.category = 'LLM Cache'
this.category = 'Cache'
this.baseClasses = [this.type, ...getBaseClasses(InMemoryCache)]
this.inputs = []
}
async init(): Promise<any> {
if (!this.inMemoryCache) {
this.inMemoryCache = InMemoryCache.global()
this.inMemoryCache = LangchainInMemoryCache.global()
}
return this.inMemoryCache
}
}
module.exports = { nodeClass: LLMInMemoryCache }
module.exports = { nodeClass: InMemoryCache }

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1,8 +1,8 @@
import { getBaseClasses, getCredentialData, getCredentialParam, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
import { MomentoCache } from 'langchain/cache/momento'
import { MomentoCache as LangchainMomentoCache } from 'langchain/cache/momento'
import { CacheClient, Configurations, CredentialProvider } from '@gomomento/sdk'
class LLMMomentoCache implements INode {
class MomentoCache implements INode {
label: string
name: string
version: number
@ -18,9 +18,9 @@ class LLMMomentoCache implements INode {
this.label = 'Momento Cache'
this.name = 'momentoCache'
this.version = 1.0
this.type = 'LLMCache'
this.type = 'Cache'
this.icon = 'momento.png'
this.category = 'LLM Cache'
this.category = 'Cache'
this.baseClasses = [this.type, ...getBaseClasses(MomentoCache)]
this.credential = {
label: 'Connect Credential',
@ -47,7 +47,7 @@ class LLMMomentoCache implements INode {
defaultTtlSeconds: 60 * 60 * 24
})
let momentoCache = await MomentoCache.fromProps({
let momentoCache = await LangchainMomentoCache.fromProps({
client,
cacheName: cacheName
})
@ -55,4 +55,4 @@ class LLMMomentoCache implements INode {
}
}
module.exports = { nodeClass: LLMMomentoCache }
module.exports = { nodeClass: MomentoCache }

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -1,8 +1,8 @@
import { getBaseClasses, getCredentialData, getCredentialParam, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
import { RedisCache } from 'langchain/cache/ioredis'
import { RedisCache as LangchainRedisCache } from 'langchain/cache/ioredis'
import { Redis } from 'ioredis'
class LLMRedisCache implements INode {
class RedisCache implements INode {
label: string
name: string
version: number
@ -18,9 +18,9 @@ class LLMRedisCache implements INode {
this.label = 'Redis LLM Cache'
this.name = 'redisCache'
this.version = 1.0
this.type = 'LLMCache'
this.type = 'Cache'
this.icon = 'redis.svg'
this.category = 'LLM Cache'
this.category = 'Cache'
this.baseClasses = [this.type, ...getBaseClasses(RedisCache)]
this.credential = {
label: 'Connect Credential',
@ -45,8 +45,8 @@ class LLMRedisCache implements INode {
username,
password
})
return new RedisCache(client)
return new LangchainRedisCache(client)
}
}
module.exports = { nodeClass: LLMRedisCache }
module.exports = { nodeClass: RedisCache }

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1,7 +1,7 @@
import { getBaseClasses, getCredentialData, getCredentialParam, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
import { UpstashRedisCache } from 'langchain/cache/upstash_redis'
import { UpstashRedisCache as LangchainUpstashRedisCache } from 'langchain/cache/upstash_redis'
class LLMUpstashRedisCache implements INode {
class UpstashRedisCache implements INode {
label: string
name: string
version: number
@ -17,9 +17,9 @@ class LLMUpstashRedisCache implements INode {
this.label = 'Upstash Redis LLM Cache'
this.name = 'upstashRedisCache'
this.version = 1.0
this.type = 'LLMCache'
this.type = 'Cache'
this.icon = 'upstash.png'
this.category = 'LLM Cache'
this.category = 'Cache'
this.baseClasses = [this.type, ...getBaseClasses(UpstashRedisCache)]
this.credential = {
label: 'Connect Credential',
@ -36,7 +36,7 @@ class LLMUpstashRedisCache implements INode {
const upstashConnectionUrl = getCredentialParam('upstashConnectionUrl', credentialData, nodeData)
const upstashToken = getCredentialParam('upstashConnectionToken', credentialData, nodeData)
const cache = new UpstashRedisCache({
const cache = new LangchainUpstashRedisCache({
config: {
url: upstashConnectionUrl,
token: upstashToken
@ -46,4 +46,4 @@ class LLMUpstashRedisCache implements INode {
}
}
module.exports = { nodeClass: LLMUpstashRedisCache }
module.exports = { nodeClass: UpstashRedisCache }

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB