constcache = newUpstashRedisCache({ config: { url:"UPSTASH_REDIS_REST_URL", token:"UPSTASH_REDIS_REST_TOKEN", }, }); // Initialize the OpenAI model with Upstash Redis cache for caching responses constmodel = newChatOpenAI({ cache, }); awaitmodel.invoke("How are you today?"); constcachedValues = awaitcache.lookup("How are you today?", "llmKey");
A cache that uses Upstash as the backing store. See https://docs.upstash.com/redis.
Example