@@ -4,7 +4,6 @@ import { Generation } from "@langchain/core/outputs";
44import {
55 BaseCache ,
66 deserializeStoredGeneration ,
7- getCacheKey ,
87 serializeGeneration ,
98} from "@langchain/core/caches" ;
109import { StoredGeneration } from "@langchain/core/messages" ;
@@ -71,14 +70,14 @@ export class UpstashRedisCache extends BaseCache {
7170 */
7271 public async lookup ( prompt : string , llmKey : string ) {
7372 let idx = 0 ;
74- let key = getCacheKey ( prompt , llmKey , String ( idx ) ) ;
73+ let key = this . keyEncoder ( prompt , llmKey , String ( idx ) ) ;
7574 let value = await this . redisClient . get < StoredGeneration | null > ( key ) ;
7675 const generations : Generation [ ] = [ ] ;
7776
7877 while ( value ) {
7978 generations . push ( deserializeStoredGeneration ( value ) ) ;
8079 idx += 1 ;
81- key = getCacheKey ( prompt , llmKey , String ( idx ) ) ;
80+ key = this . keyEncoder ( prompt , llmKey , String ( idx ) ) ;
8281 value = await this . redisClient . get < StoredGeneration | null > ( key ) ;
8382 }
8483
@@ -92,7 +91,7 @@ export class UpstashRedisCache extends BaseCache {
9291 */
9392 public async update ( prompt : string , llmKey : string , value : Generation [ ] ) {
9493 for ( let i = 0 ; i < value . length ; i += 1 ) {
95- const key = getCacheKey ( prompt , llmKey , String ( i ) ) ;
94+ const key = this . keyEncoder ( prompt , llmKey , String ( i ) ) ;
9695 const serializedValue = JSON . stringify ( serializeGeneration ( value [ i ] ) ) ;
9796
9897 if ( this . ttl ) {
0 commit comments