A cache that uses Upstash as the backing store. See https://docs.upstash.com/redis.

Example

const cache = new UpstashRedisCache({
config: {
url: "UPSTASH_REDIS_REST_URL",
token: "UPSTASH_REDIS_REST_TOKEN",
},
});
// Initialize the OpenAI model with Upstash Redis cache for caching responses
const model = new ChatOpenAI({
cache,
});
await model.invoke("How are you today?");
const cachedValues = await cache.lookup("How are you today?", "llmKey");

Hierarchy

Constructors

Methods

Constructors

Methods

Generated using TypeDoc