Class for storing chat message history using Redis. Extends the
BaseListChatMessageHistory class.
class RedisChatMessageHistoryA path to the module that contains the class, eg. ["langchain", "llms"] Usually should be the same as the entrypoint the class is exported from.
Deletes all chat messages from the Redis database for the current session.
const chatHistory = new RedisChatMessageHistory({
sessionId: new Date().toISOString(),
sessionTTL: 300,
url: "redis:
});
const chain = new ConversationChain({
llm: new ChatOpenAI({ model: "gpt-3.5-turbo", temperature: 0 }),
memory: { chatHistory },
});
const response = await chain.invoke({
input: "What did I just say my name was?",
});
console.log({ response });