Which Langchain memory class allows you to store chat history with a limit on the number of messages retained?
easy📝 Conceptual Q2 of 15
LangChain - Conversational RAG
Which Langchain memory class allows you to store chat history with a limit on the number of messages retained?
AConversationBufferMemory
BConversationSummaryMemory
CConversationBufferWindowMemory
DChatMessageHistory
Step-by-Step Solution
Solution:
Step 1: Understand the memory classes
ConversationBufferMemory stores all messages without limit, ConversationSummaryMemory summarizes older messages, ChatMessageHistory is a base class for storing messages.
Step 2: Identify the class with message limit
ConversationBufferWindowMemory is designed to keep only a fixed window of recent messages.
Final Answer:
ConversationBufferWindowMemory -> Option C
Quick Check:
Memory class with window size limits messages [OK]