How to add persistent memory using PostgreSQL to LangGraph ReAct agent🤖: Python - LangGraph #3

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

Code AI with Rok

Code AI with Rok

Күн бұрын

Пікірлер: 32
@rokbenko
@rokbenko 2 ай бұрын
Hey everyone! 👋 Did you know that 97.5% of my viewers aren’t subscribed? If you found this tutorial helpful, consider subscribing to the channel. It’s free and doesn’t hurt anyone, but it means a lot to me. Plus, it’s a great way to stay updated with the latest coding tips and tricks. Thanks for your support! 🙏
@EshaalakshmiDS-x5q
@EshaalakshmiDS-x5q Ай бұрын
Thank you soo much for the video!! It gives us reference on how to instill Long Term memory to LangGraph Applications. Truly useful!!
@RomanH91
@RomanH91 Ай бұрын
This is what I was looking for! The PostgreSQL persistent memory to the LangGraph. I needed it in TypeScript, but at least it's available in Python. Don't have so much information about it on the Web. Thank you!
@rokbenko
@rokbenko Ай бұрын
@RomanH91 I wanted to show a JS example too, but it looks like LangChain hasn't implemented it in the JS SDK yet.
@RomanH91
@RomanH91 Ай бұрын
@rokbenko I found documentation on the PostgresSaver. Do you think it’s still in beta? Possible to find by searching on the website: 'persistence-postgres'. The direct link doesn't work :(
@TheNearAndAway
@TheNearAndAway 26 күн бұрын
@@rokbenko It looks like it's available in the JS SDK now
@rokbenko
@rokbenko 24 күн бұрын
@@TheNearAndAway Can you please share the link here?
@rizkyjanu2318
@rizkyjanu2318 6 күн бұрын
@@rokbenko is it available on JS now? I use TS built my chatbot and need it to long term memory ❤
@Examplist
@Examplist Ай бұрын
At first I was hesitant about the AI voice, but I like how aggressively it is yelling at me
@rokbenko
@rokbenko 29 күн бұрын
Can’t tell if it’s sarcasm or the best feedback ever. Either way, I’ll take it.
@StratenSchemel
@StratenSchemel 12 күн бұрын
@@rokbenko Dude your git repo is gold. Your youtube videos are excellent. I think the AI voice is off putting and why this channel doesn't have 100k subscribers. It was hard to get past the first 2 minutes on some of your videos but after realizing that it's legit content and not a scammy clickbait video I was all in. I would tinker with some different voices or do your own voice over. PS: do you have a BuyMeCoffee page?
@rokbenko
@rokbenko 12 күн бұрын
@@StratenSchemel Thanks for the detailed feedback! I was thinking about this a lot, but so far, the channel is growing, although it might be growing even faster not using AI voiceover. I don't know. Maybe I'll change the course. Here you go: buymeacoffee.com/rokbenko
@StratenSchemel
@StratenSchemel 12 күн бұрын
@@rokbenko Couldn't hurt to experiment. But your content is is really good. Keep it up your tutorials have saved me hours! Thank You!
@aifarmerokay
@aifarmerokay Ай бұрын
❤ I was checking exactly same
@jungin.johnny
@jungin.johnny 2 күн бұрын
Thank you for the kind video. It seems that 4 tables(checkpoints, checkpoint_blobs, ...) including are automatically created in the public schema of database in postgresql. If I want to use multiple graph or chatbots, do I have to create multiple databases in postgresql?
@rokbenko
@rokbenko Күн бұрын
If you want to store different chats, then simply set the different thread_id parameter to a different string. In my example, I set it to "1". You can set it to "2" or whatever works for you. All chats will be stored in the same PostgreSQL tables, though.
@jungin.johnny
@jungin.johnny Күн бұрын
@@rokbenko Thanks for the reply! I think that's the best way to do it.
@simone24
@simone24 Ай бұрын
Interesting video. Wouldn't be useful to give to every message an ID and to store in the checkpoint the list of IDs? LLM could retrieve messages from IDs and it would save a lot of tokens. Does it make sense?
@RomanH91
@RomanH91 Ай бұрын
Tokens increase when a dialog is long. How can I optimize it? Thank you for your answer!
@oscarbastidas-q3y
@oscarbastidas-q3y Ай бұрын
Hi, thank you for this amazing tutorial, keep doing it :)! I have a couple of questions I hope you can help with. Specifically, do you know how to interact with the database for tasks like removing a thread ID or checkpoint ID? I couldn’t find any direct LangGraph operations with the memory in the documentation for handling these scenarios. My current workaround is using direct PostgreSQL queries, but I’m unsure if that’s the best approach. Would love to hear your thoughts if you’ve worked on something similar. Thanks in advance!
@rokbenko
@rokbenko Ай бұрын
@oscarbastidas-q3y What do you mean by saying "removing a thread ID"? What's your goal?
@oscarbastidas-q3y
@oscarbastidas-q3y Ай бұрын
@@rokbenko As you know, every conversation is associated with a thread ID, checkpoint ID, and other identifiers. For instance, suppose I no longer needed to store a conversation, I resolved this by removing the thread ID using SQL queries. My question is, can I do this using a command from the langraph package?
@rokbenko
@rokbenko Ай бұрын
​@@oscarbastidas-q3y It's not possible to delete past useless conversations from PostgreSQL using the LangGraph SDK. As far as I know...
@work1321
@work1321 Ай бұрын
Hi, do we need to create a DB and table agent_chat ourselves or the code does it?
@rokbenko
@rokbenko 29 күн бұрын
To be honest, I don't remember since I'm experimenting with AI a lot. Try to run the script, and if you get an error, then you need to set up the table yourself. I think I did it myself, but as I said, I'm not sure.
@work1321
@work1321 28 күн бұрын
@ thanks a lot for replying, i figured it out that we need to create just the db and then run the script, by the way do you have any source or material 1]where you access this stored database for another agent? 2] handling cross thread persistence according to user ids
@aifarmerokay
@aifarmerokay Ай бұрын
what schema tables actully needed for postgree . im facing issue for that
@rokbenko
@rokbenko Ай бұрын
@aifarmerokay Did you follow the exact steps from the tutorial? What's the issue you're facing? Can you explain, please?
@hasnainkhan2959
@hasnainkhan2959 Ай бұрын
Hey man, thanks for the video. It was really helpful. I am using the same code as you used in your video and I am getting this error: psycopg.errors.DuplicatePreparedStatement: prepared statement "_pg3_1" already exists I used await memory.setup() as this was first time. I tried to run it with commenting it but it is giving me the same error.
UV for Python… (Almost) All Batteries Included
17:35
ArjanCodes
Рет қаралды 99 М.
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
Turn ANY Website into LLM Knowledge in SECONDS
18:44
Cole Medin
Рет қаралды 183 М.
Smarter Memory with Semantic Search in LangGraph
6:57
LangChain
Рет қаралды 6 М.
TanStack Query - How to become a React Query God
28:56
Austin Davis
Рет қаралды 29 М.
Lecture 13:  Decomposing C to Assembly and the relation
28:16
Pyjama Brah!
Рет қаралды 781
RAG + Langchain Python Project: Easy AI/Chat For Your Docs
16:42
LangChain vs LangGraph: A Tale of Two Frameworks
9:55
IBM Technology
Рет қаралды 93 М.
LangChain Agents: A Simple, Fast-Paced Guide
8:38
Edrick
Рет қаралды 15 М.
Solving one of PostgreSQL's biggest weaknesses.
17:12
Dreams of Code
Рет қаралды 227 М.
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН