LangChain Tutorial (Python) #7: Long Term Chat Memory with Upstash Redis

  Рет қаралды 5,374

Leon van Zyl

Leon van Zyl

Күн бұрын

#openai #langchain
The Memory modules in Langchain make it simple to permanently store conversations in a database, so that we can recall and continue those conversations in the future - just like the conversations in ChatGPT.
📑 Useful Links:
Langchain Python docs: python.langchain.com/docs/get...
Source Code: github.com/leonvanzyl/langcha...
Upstash: upstash.com/?Leon_...
☕ Buy me a coffee:
www.buymeacoffee.com/leonvanzyl
💬 Chat with Like-Minded Individuals on Discord:
/ discord
🧠 I can build your chatbots for you!
www.cognaitiv.ai
🕒 TIMESTAMPS:
00:00 - Introduction to Chat Memory
00:28 - Project setup
02:00 - Benefit of Memory over manual history
03:19 - Adding ConversationBufferMemory
04:59 - LLMChain Class
07:30 - Upstash Redis Chat Memory
10:56 - Attach Redis History to Memory
12:18 - Adding Memory to Agents

Пікірлер: 39
@MatheusTassoo
@MatheusTassoo 2 ай бұрын
best LangChain series i’ve seen on youtube! would be awesome if you make a series about LangGraph
@leonvanzyl
@leonvanzyl 2 ай бұрын
LangGraph series coming soon
@fformentif
@fformentif 2 ай бұрын
@@leonvanzyl awesome!!
@tony99659
@tony99659 4 ай бұрын
Leon this content is amazing, you definitely have a skill to teach!
@leonvanzyl
@leonvanzyl 4 ай бұрын
Thank you
@udaynj
@udaynj 2 ай бұрын
Thanks Leon. Great teaching style. I just subscribed
@leonvanzyl
@leonvanzyl 2 ай бұрын
Thank you 🙏
@karimshakirov
@karimshakirov 4 ай бұрын
This is the best LangChain playlist on youtube! Thank you a lot for doing it!
@leonvanzyl
@leonvanzyl 4 ай бұрын
Thank you for the support ❤️
@jo_ji
@jo_ji 2 ай бұрын
Perfect lesson, thank you so much. I will be on heaven when langgraph series come
@leonvanzyl
@leonvanzyl 2 ай бұрын
Coming soon 😁
@akshitha986
@akshitha986 Ай бұрын
Wow! Subscribed. Keep Going. Love from 🇮🇳
@patotegonzalez
@patotegonzalez 2 ай бұрын
Great series, very helpful man
@CreatewwwPl
@CreatewwwPl 3 ай бұрын
Amazing tutorials. Thanks for all
@leonvanzyl
@leonvanzyl 3 ай бұрын
You're welcome 🤗
@mlTS7626
@mlTS7626 Ай бұрын
For such nice tutorial, It's worth sharing the code as well :D
@leeam8066
@leeam8066 13 күн бұрын
Hi, I am learning this topic. I was wondering if i were to input custom data with this method how do i go about this?
@htmlfivedev
@htmlfivedev Ай бұрын
Thanx for this ... subscribed!!
@Oliver-zy8sq
@Oliver-zy8sq 2 ай бұрын
How to have it not always put the entire Chat history into the answer? Please help me with this. And another question. Will the chatbot be able to retrieve memory from even the oldest messages stored in the database and if so does this clutter up the token usage?
@chakerayachi8468
@chakerayachi8468 3 ай бұрын
really thanks for the video buti have a question is it possible to add upstash redis into agents memory ?
@leonvanzyl
@leonvanzyl 3 ай бұрын
Absolutely!
@inaminute00
@inaminute00 5 ай бұрын
Hey, thank you so much for making these content so digestible. Could you please also make tutorials on LangServe.
@leonvanzyl
@leonvanzyl 5 ай бұрын
For sure!
@andy111007
@andy111007 4 ай бұрын
@@leonvanzyl is the code available ?
@btc_noob
@btc_noob 9 күн бұрын
LLMChain is deprecated. Says to use runnable sequence... in my noobness i guess it is what we're use to ? What's the fix? That doesn't have a way to insert memory in the there correct?
@nadershalabi6241
@nadershalabi6241 24 күн бұрын
Thank you for the great work on these series. Q: We do not need to add the Embeddings functionality when using Memory?
@leonvanzyl
@leonvanzyl 24 күн бұрын
You can have both. Long term memory for recalling your past conversations, and RAG (Embeddings) for accessing knowledge bases.
@quangtho29101990
@quangtho29101990 3 ай бұрын
Amazing tut. Thank you so much! In your implementation, what if the chat memory have millions of history messages? Can we still use this technique or Should we vectorized and embedded the chat history into vector database?
@leonvanzyl
@leonvanzyl 3 ай бұрын
There are a few approaches that you could follow. With those many messages I would definitely "archive" order messages by adding them to the Vector Store. These conversations could also be summarised before being added to the Vector DB as well.
@quangtho29101990
@quangtho29101990 3 ай бұрын
@@leonvanzyl Thank you. But why did you use ConversationBufferMemory instead of VectorStoreRetrieverMemory? I still don't get it, I thought we should use VectorStoreRetrieverMemory type because we're using VectorDB to save the chat history!
@quangtho29101990
@quangtho29101990 3 ай бұрын
​@@leonvanzyl Why did you use ConversationBufferMemory instead of VectorStoreRetrieverMemory? I thought we should use VectorStoreRetrieverMemory with VectorDB? Could you please explain more?
@alaminegueye3218
@alaminegueye3218 5 ай бұрын
Hello ! This video was just crystal clear, thank you for that ! I Am currently looking for a way to implement upstash redis with LCEL chains (RunnableWithMemory class), there are examples in the LangChain documentation but they use a file as database for simplicity Could you make a video about that ?
@leonvanzyl
@leonvanzyl 5 ай бұрын
I really want to create a series on LCEL. It seems to be a topic that a lot people struggle with. It's honestly easy once you get the hang of it. Honestly though, I wouldn't go LCEL unless I really had to.
@alaminegueye3218
@alaminegueye3218 5 ай бұрын
@@leonvanzyl Yes it's pretty controversed. I personnally use it because many templates and examples from the langchain documentation are based off of LCEL so it is easier for me to get up and running fast
@seththunder2077
@seththunder2077 5 ай бұрын
@@leonvanzylSadly the issue right now is that langchain is forcing us to use LCEL. I checked the github link you provided but it seems its the wrong link. Could you update it please
@fformentif
@fformentif 2 ай бұрын
@@leonvanzyl What would you use instead of LCEL for production code?
@udaynj
@udaynj 2 ай бұрын
Seems would be cheaper in production to just use sqlite or postgres etc...by the time you add up all the 3rd party components, you are adding enormous cyber security risk + costs for each of these components, although they make delivery so much easier. What is your opinion?
Clown takes blame for missing candy 🍬🤣 #shorts
00:49
Yoeslan
Рет қаралды 38 МЛН
WHO LAUGHS LAST LAUGHS BEST 😎 #comedy
00:18
HaHaWhat
Рет қаралды 23 МЛН
HAPPY BIRTHDAY @mozabrick 🎉 #cat #funny
00:36
SOFIADELMONSTRO
Рет қаралды 17 МЛН
Rate This Smartphone Cooler Set-up ⭐
0:10
Shakeuptech
Рет қаралды 1,4 МЛН
Что делать если в телефон попала вода?
0:17
Лена Тропоцел
Рет қаралды 1,9 МЛН
Samsung Galaxy 🔥 #shorts  #trending #youtubeshorts  #shortvideo ujjawal4u
0:10
Ujjawal4u. 120k Views . 4 hours ago
Рет қаралды 8 МЛН
Top 50 Amazon Prime Day 2024 Deals 🤑 (Updated Hourly!!)
12:37
The Deal Guy
Рет қаралды 1,4 МЛН
Зачем ЭТО электрику? #секрет #прибор #энерголикбез
0:56
Александр Мальков
Рет қаралды 637 М.
НЕ ПОКУПАЙ СМАРТФОН, ПОКА НЕ УЗНАЕШЬ ЭТО! Не ошибись с выбором…
15:23