Build an Agent with Long-Term, Personalized Memory

2024 ж. 14 Мам.
23 316 Рет қаралды

This video explores how to store conversational memory similar to ChatGPT's new long-term memory feature.
We'll use LangGraph to build a simple memory-managing agent to extract pertinent information from a conversation and store it as long-term memory via parallel tool calling.
Interested in talking about a project? Reach out!
Email: christian@botany-ai.com
LinkedIn: linkedin.com/in/christianerice
Timestamps:
0:00 - Intro
0:16 - Memory Demo
3:21 - Approaches to Adding Memory
9:59 - Code Walkthrough
19:54 - Optimizations
Follow along with the code on GitHub:
github.com/christianrice/demo...

Пікірлер
  • Superb content, Thanks for sharing ✨

    @dinugakasun5218@dinugakasun52185 күн бұрын
  • Excelent content! Thanks for sharing, man :D

    @joao.morossini@joao.morossini20 күн бұрын
  • Great code walk through. I'm working on something similar so it was cool to see how you approached it. Thanks for sharing.

    @jacobgoldenart@jacobgoldenart2 ай бұрын
    • That's awesome! I'd love to hear what approach ends up working for you

      @deployingai@deployingai2 ай бұрын
  • We were just talking about this issue. All of these chat UI's treat content as if it's disposable. What works in text messaging between two people doesn't translate as well when working with computers, not if the information has utility value. This is great!

    @jeremybristol4374@jeremybristol43742 ай бұрын
  • Thanks for the excellent idea and explanation.

    @ratral@ratral2 ай бұрын
    • Thanks for watching!

      @deployingai@deployingai2 ай бұрын
  • Super loaded tutorial 🎉

    @mr.daniish@mr.daniish2 ай бұрын
  • Hey thanks for this. Very nice to see an actual application build up like this. I will most certainly come back for more. I would be interested in seeing you set up a more corporate oriented use case. What if a free text field in a form contains information relevant to a sign up for a a services or something like that

    @madelles@madelles2 ай бұрын
  • Dude, your video help me a lot, THANKS!!!

    @weiwei6111@weiwei6111Ай бұрын
    • That's awesome, glad to hear it!

      @deployingai@deployingaiАй бұрын
  • Thanks for sharing 👍

    @PaulFischerclimbs@PaulFischerclimbs2 ай бұрын
  • Nice. Look similar to Autogen's teachable agent. Appreciate your work.

    @m4tthias@m4tthias2 ай бұрын
    • Thanks for sharing, you're totally right. I just read through their code, it was interesting to see their prompt methods and how they implemented their memory store! Cool feature

      @deployingai@deployingai2 ай бұрын
  • This is so great: structured data extraction from conversations is something I’m also working on. And by the way: congrats: you have a better like-to-view ratio than MrBeast, at 4%. 🚀

    @JulianHarris@JulianHarris2 ай бұрын
    • That's cool, thanks for sharing! I'd love to hear the approach that ends up working for you.

      @deployingai@deployingai2 ай бұрын
  • Can you share the vite front end? or how you setted up the front and the backend?

    @benjaminbascary8219@benjaminbascary8219Ай бұрын
  • your miro drawing skills are next level thing

    @talhaanwar2911@talhaanwar2911Ай бұрын
    • i have a suspicion that @deployingai is creating AI videos to showcase his miro skills.

      @thawab85@thawab85Ай бұрын
    • Haha thanks!

      @deployingai@deployingai28 күн бұрын
  • Hello this is so cool, is it possible to share the full code including backend/front-end code as well, would love to try this, thanks so much!

    @jackmartin1146@jackmartin11462 ай бұрын
    • lol

      @MCroppered@MCroppered2 ай бұрын
    • Hahahahahahah

      @maskedvillainai@maskedvillainai2 ай бұрын
  • Great work, don't you mind to share the code for front end? ;)

    @unclecode@unclecode28 күн бұрын
  • This is amazing, I creating something similar, Now I will use sentinal approach. btw, I would like ask, where can i find the frontend?

    @khushpatel7060@khushpatel70602 ай бұрын
  • Wow, this is super cool. Could something like this be applied to using an LLM to code a web app? One of my problems right now is that I'm using gpt4 to help code a project but before I can get through it, the context window creeps in and it starts to return incorrect code.

    @adventurelens001@adventurelens0012 ай бұрын
  • Interesting. Subscribed. By the way, can I get the source code for the UI. It looks pretty neat and clean

    @tharunbhaskar6795@tharunbhaskar67952 ай бұрын
    • Great, thanks for watching! I'll need to clean it up a bit, but I'll share it when I have a chance. I used Radix UI and Tailwind for this demo, so they made this very easy to throw together.

      @deployingai@deployingai2 ай бұрын
    • Hello@@deployingai possible to share the code now?

      @jackmartin1146@jackmartin11462 ай бұрын
  • I think I missed this in the memgpt paper but summarizing and storing attributes in long term memory and then refetching it for the context window is also likely going to increase the latency of the main response

    @akashdeb9823@akashdeb98232 ай бұрын
    • Agreed, that's something you would need to monitor for sure. For this version, I chose to just pass the memories along in the request so they wouldn't delay the response, but that will break down once the memory store gets to a point where you need to trim it. I think you could always pre-fetch the entire condensed form of the conversational memory ahead of the user's request, but it might be hard to pre-fetch just the memories relevant to the new query in the small window of time between when the person finishes their message and submits their request. Someone pointed out AutoGen's Teachable Agent approach to memory management, and they warn: "Note that this adds extra LLM calls involving a relatively small number of tokens, which can add a few seconds to the time a user waits for each response." But it looks like their approach adds multiple calls before and after the main request, which are all blockers to a response.

      @deployingai@deployingai2 ай бұрын
  • Cool channel & video!! May I ask how long it took in order to get some views on your videos? Did you got views within 24 hours? Or did you start to get some views after X uploads?

    @zhrannnnn@zhrannnnnАй бұрын
    • Hey thanks for watching! I've only published a handful of videos so I don't have much info for you, but the first few were definitely pretty quiet.

      @deployingai@deployingai28 күн бұрын
  • How do you store the memories ? I prabably implemented it wrong, I did a while loop with input, now trying to come up with a solution of how to actually store the messages in the memory

    @michaelbuloichyk8986@michaelbuloichyk89862 ай бұрын
    • Can you share the details about how you implemented vectorDB in the loop? Would love to see the code. Much love, appreciate the effort of making the video. thanks!

      @michaelbuloichyk8986@michaelbuloichyk89862 ай бұрын
    • In my demo, I set up a backend using Supabase's Postgres database. The agent writes the memories directly to the database, and I stream the memories from the database to the frontend to instantly see updates. And since I have the memories available already in the frontend, I just use those in my requests to the LLM so that I can avoid having to make a request to my db before every new request to the LLM.

      @deployingai@deployingaiАй бұрын
  • “I won’t go through how I actually built the application” what’s the point ? I switched off here.

    @gary3548@gary35482 күн бұрын
  • great, now do this with an open source LLM

    @squiddymute@squiddymute2 ай бұрын
  • 13:38 - Did... Did you just bribe and / or threaten your LLM to produce better results? lmao

    @cluelesssoldier@cluelesssoldier2 ай бұрын
    • He was also compassionate and asked the LLM to take a deep breath

      @akashdeb9823@akashdeb98232 ай бұрын
    • I loved that part, as well! lol@@akashdeb9823

      @cluelesssoldier@cluelesssoldier2 ай бұрын
    • Ha! Is it weird that I feel guilty about it now? Thanks for pointing this out, you sent me down a rabbit hole of great papers on prompting techniques and a new idea I want to try out. If it works I'll share a video! I really liked this paper on eccentric prompts: arxiv.org/pdf/2402.10949.pdf

      @deployingai@deployingai2 ай бұрын
    • @@deployingai Can’t wait to see what else you come up with! After reviewing that document on eccentric prompts, it actually has me thinking I need to employ more ToT prompting into my own applications… 🤔

      @cluelesssoldier@cluelesssoldier2 ай бұрын
KZhead