Install and import from the "@langchain/redis" integration package instead. Class for storing chat message history using Redis. Extends the BaseListChatMessageHistory class.
BaseListChatMessageHistory
const chatHistory = new RedisChatMessageHistory({ sessionId: new Date().toISOString(), sessionTTL: 300, url: "redis:});const chain = new ConversationChain({ llm: new ChatOpenAI({ modelName: "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 }); Copy
const chatHistory = new RedisChatMessageHistory({ sessionId: new Date().toISOString(), sessionTTL: 300, url: "redis:});const chain = new ConversationChain({ llm: new ChatOpenAI({ modelName: "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 });
Deprecated
Install and import from the "@langchain/redis" integration package instead. Class for storing chat message history using Redis. Extends the
BaseListChatMessageHistory
class.Example