Thuta Learning
LangChain
IntermediateAIadvanced

Memory

Memory သည် chains များကို ယခင် conversations များကို မှတ်မိစေရန် ထည့်သွင်းပေးသော component ဖြစ်သည်။ ConversationBufferMemory သည် chat history ကို variable တစ်ခုတွင် သိမ်းဆည်းပေးသည်။

python
from langchain.memory import ConversationBufferMemory

# Setup memory
memory = ConversationBufferMemory()

# Add memory to an LLMChain
chain = LLMChain(llm=llm, prompt=prompt, memory=memory)

# The first time, the memory is empty.
# The second time, the chain will "remember" the first conversation.
You should see
(Memory ကိုအသုံးပြုခြင်းဖြင့် chatbot သည် ယခင်ပြောခဲ့သော စကားများကို မှတ်မိနိုင်သည်)
Memory | Thuta Learning