Flowise AI Tutorial - Long-Term Chat Memory with Upstash Redis

2024 ж. 14 Мам.
5 456 Рет қаралды

#flowise #langchain #upstash
In this video you will learn how to add a long term memory backend to your Flowise Chatbots using Upstash Redis.
☕ Buy me a coffee:
www.buymeacoffee.com/leonvanzyl
📑 Useful Links:
Upstash: upstash.com
💬 Chat with Like-Minded Individuals on Discord:
/ discord
🧠 Let me build your chatbot for you!
www.cognaitiv.ai
🕒 TIMESTAMPS:
00:00 - Introduction to Chat Memory
00:52 - Building the chatbot
02:16 - Creating an Upstash Account
03:36 - Add Upstash Credentials
04:11 - Add Upstash Rest URL
04:25 - Upstash Session ID

Пікірлер
  • Thank you Leon 'soos altyd bakgat!'

    @maniecronje@maniecronjeАй бұрын
  • First!!! This is going to be a good one 🎉

    @reyco1@reyco16 ай бұрын
  • Wow. I was searching how to remember chat memoty 1 month ago. I used motorhead. Thank you for tutorial.

    @mrvaliyev5292@mrvaliyev52926 ай бұрын
    • You're welcome 🤗

      @leonvanzyl@leonvanzyl6 ай бұрын
  • cannot wait

    @therammync@therammync6 ай бұрын
  • I love your videos!! its quite a while that i'm following your flowise series. I have a question: is possible to make the LLM ask the user a question and then use this question in the next chain? Thank you for the videos, they are great!!

    @igorkovinski7713@igorkovinski77136 ай бұрын
    • Thank you 🙏. I'm not aware of a solution in Flowise for having the bot ask questions. I usually just use tools like Voiceflow or Botpress for that.

      @leonvanzyl@leonvanzyl6 ай бұрын
  • Do I have to create a new database for each Flowise workflow? If not, how does the system differentiate the same user chatting with different flows?

    @GilbertMizrahi@GilbertMizrahi5 ай бұрын
  • Hey Leon, great video as always, keep up the good work, really appreciate your lessons :) Couple questions: 1. Is this any better/different that using Zep memory? I currently use Zep which I host on Render, but I don't get a simple an interface with session ids as well as being able to see the actual conversation in the table like that. Would you say Upstash is better for this reason? 2. Would this work indefinitely and forever? Would the memory retrieval slow down overtime? If so, for chat based data, could this replace the need for a vector store? Thanks again Leon, PS: just chasing up on that email I sent to your agency ;)

    @hassanullah1997@hassanullah19976 ай бұрын
    • Hey Hassan, thank you for your feedback 🙏. Those are very good questions and quite a lot to answer in a comment. Making note of them for future videos. Memory and Vector stores (knowledge bases) are quite different. For memory, I believe that Langchain will actually pass a summary of the chat history to the LLM, so I don't think it will affect performance or token usage that much. I could be wrong. I would still seperate the Knowledge Base from the chat memory / history though. Saw your email (the long one 😁). Will respond when I get a chance to read it all 🤣, or schedule a call.

      @leonvanzyl@leonvanzyl6 ай бұрын
  • This is awesome. Your content is really appreciated and I’m 100% obsessed with your Flowise videos. I’m hoping to get you opinion on the following. I’ve installed Flowise on an AWS ec2 instance and configured my env file to use a Postgres database also in AWS. When I connect to that db I can see motley chat flows and chat messages history in the tables. I only have a buffer memory node in a sample flow I’ve created. In terms of long term memory, is there a difference in my setup compared to what you reviwed here.

    @marioa6942@marioa69426 ай бұрын
    • Thank you for the kind feedback. Just glad I could help. I assume you configured the postgress database in the env configuration. I haven't tried this myself, but from your message it seems that Flowise is then using the env database for it's memory.

      @leonvanzyl@leonvanzyl6 ай бұрын
    • Correct, I’ve configured my flowise .env with a Postgres database configuration which points to the AWS Postgres instance I created. It looks like my flowise app has long term memory with this setup. I’m just curious if that truly is the case. I’ll be playing around some more to test this out.

      @marioa6942@marioa69426 ай бұрын
    • @@marioa6942 you definitely taught me something 🤗. Going to play with this myself. Thank man!

      @leonvanzyl@leonvanzyl6 ай бұрын
  • great video and explanation Leon. Could you maybe make a video where you would show us how to use the Flowise with the memory (like Upstash Redis) inside the Voiceflow? I can't seem to get the memory to work when calling the Flowise through API call in Voiceflow. I'm sure it's super simple... but I just can't figure it out. Great video again... I actually made my Render instance with Flowise folowing your other video... this is so powerful. Thank you again.

    @MaliRasko@MaliRasko3 ай бұрын
    • ok.. I take that back ... I just put the { "question": "something-something-1", "chatId": "myChatId-1" } in the JSON body and it worked :) Unlike the Zep memory ... that I couldn't make work inside Voiceflow ... such that it would keep the memory inside the Voiceflow. Maybe you could do something around that. just an idea. Amazing content... thank you

      @MaliRasko@MaliRasko3 ай бұрын
    • Hey there. Yes, I was just about to say that you need to pass the ChatID along 🤗. This goes for any application that calls Fkowise, not just Voiceflow.

      @leonvanzyl@leonvanzyl3 ай бұрын
  • just wonder which memory you recommend for the production level? i have tried Upstash and embedding Flowise app API into a app, every time I interact with the chatbot, upstash generates a new ID and creates a new container for storing chat history, it was not consistent.

    @youwang9156@youwang91565 ай бұрын
  • Hey Leon great video! like all of the others. Question: I want to use this upstash for chatmemory for my chatbot that users are using. How can I make it that each user gets a unique "sessionID" because you used "c1" and then changed it manually or do i just leave it blank? thanks for all the great content! :D

    @lucasleisner3607@lucasleisner36074 ай бұрын
    • I also wonder if there is a way to automatically create a separate ID for each new chat.

      @jasonoffenburg@jasonoffenburg7 күн бұрын
  • Love the videos! So if I put this live on a website, will it collect all the questions people asked?

    @jbhearing6392@jbhearing63926 ай бұрын
    • Thank you, and yes to your question 😁

      @leonvanzyl@leonvanzyl6 ай бұрын
    • @@leonvanzyl love it and thanks for the videos. They’re amazing!

      @jbhearing6392@jbhearing63926 ай бұрын
  • Fantastic video. Is there a way we can use a unique sessionID for each website visitor? Maybe tying the username to the sessionID or something?

    @an802adam@an802adam6 ай бұрын
    • Thank you! You could use JavaScript to generate a unique ID for the session.

      @leonvanzyl@leonvanzyl6 ай бұрын
  • how to get only last k of messages from Upstash to context? In langchain it is possible, but how to in Flowise?

    @tyessenov@tyessenov2 ай бұрын
  • great

    @ahmadalmasri1583@ahmadalmasri15836 ай бұрын
    • Thank you 🙏

      @leonvanzyl@leonvanzyl6 ай бұрын
  • That's Great !!! Question how do you handle with multiple chat, if you chatbot is expose to your website ?

    @rollandmelet6998@rollandmelet69986 ай бұрын
    • Thank you! You can pass a session ID in the API. Pass unique session IDs for the different sessions

      @leonvanzyl@leonvanzyl6 ай бұрын
    • @@leonvanzyl can you make an exemple in one of your future video ?

      @rollandmelet6998@rollandmelet69986 ай бұрын
    • @@leonvanzyl How do you pass the session ID in the API?

      @GilbertMizrahi@GilbertMizrahi5 ай бұрын
  • Thanks for the video Leon 👍 Quick question: how would you limit the amount of conversation history that is used for each response (for example the last 5 messages)? I'm using upstash redis for my flowise bot but the problem is that it passes the entire conversation history to the LLM (GPT 3.5 Turbo in this case) so eventually the context gets used up as the chat history gets bigger.

    @saienfx@saienfx3 ай бұрын
    • I think there is a last k property that you can set, but let me confirm this. Will include it in the updated series

      @leonvanzyl@leonvanzyl3 ай бұрын
    • @@leonvanzyl cool thank you. I managed to set up the last k with zep but not upstash redis.

      @saienfx@saienfx3 ай бұрын
  • Hey thanks! I’m using zep at the moment with chat session ids in a bubble app self hosted but that means you can’t run the zep webui for security..Any idea of the upstash costs? And I see FW has plain REDIS…does that mean you need DB skills? What I really want is self hosted chat session memory that’s not a PITA to set up lol…

    @musumo1908@musumo19086 ай бұрын
    • That's why I like using Upstash Redis. Easy to set up and the free tier is really generous.

      @leonvanzyl@leonvanzyl6 ай бұрын
  • Your videos are amazing. Please, could you make a video with Zep Memory, and would it be possible to use multiple memories or sessions with flowise. Thank you very much!

    @BrunnoBTC@BrunnoBTC4 ай бұрын
    • Thank you very much for the support! 🙏 Will look into Zep for you

      @leonvanzyl@leonvanzyl4 ай бұрын
  • So is this an alternative for Pinecone?

    @aivy-aigeneratedmusic6370@aivy-aigeneratedmusic63703 күн бұрын
  • Good video. Do you have any video on how to how to put on the website and post-Google authentication => assign this chat memory / history to the particular user please?

    @irotom13@irotom136 ай бұрын
    • Thank you 🙏. I have received a few requests to create a tutorial for this. Really need to make it happen 😁.

      @leonvanzyl@leonvanzyl6 ай бұрын
  • I plan to clone Zig Ziglar!

    @an802adam@an802adam6 ай бұрын
    • Do it 😁

      @leonvanzyl@leonvanzyl6 ай бұрын
  • Great video. I am about to create a google translate api node in flowise. Any advice?

    @officialp283@officialp2836 ай бұрын
    • Thanks! Should be simple enough - create a custom tool that calls the translate API 👍👍.

      @leonvanzyl@leonvanzyl6 ай бұрын
  • Do you prefer flowise or langflow? how can I store the conversation histories for all chats in a database?

    @Ryan-yj4sd@Ryan-yj4sd6 ай бұрын
    • Both tools are great and actively being improved. From my experience Flowise is slightly more advanced in terms of bring "production ready", so I'd use Flowise for client projects.

      @leonvanzyl@leonvanzyl6 ай бұрын
  • Hello, how can we update our Flowise to the latest version? Thank you

    @scoreinside@scoreinside6 ай бұрын
    • Hey. I prefer the git / developer setup. Easy to do and ensures you'll have the latest features. Check the setup section in this video: kzhead.info/sun/hLmAosd5eYJ5eYU/bejne.htmlsi=qbk5QWMgQ7yq3hyf

      @leonvanzyl@leonvanzyl6 ай бұрын
  • do you have any video tutorial on flowise with chroma db?

    @user-it6uh9wz4k@user-it6uh9wz4k4 ай бұрын
    • I don't, but it should just be a matter of adding the Chroma node to the canvas?

      @leonvanzyl@leonvanzyl4 ай бұрын
  • Hey! I don't really get it. Why it is long term and what is the difference between motorhead or zep memory where I can do the same?

    @SuperLiberty2008@SuperLiberty20086 ай бұрын
    • The conversation is stored in a persistent database instead of buffer / temporary memory where the conversation(s) are lost when the server is restarted or Flowise upgraded. Hence long-term.

      @leonvanzyl@leonvanzyl6 ай бұрын
  • Yes good... I'm having issues self hosting zep and I have this wierd thing about not self hosting

    @lightningloans@lightningloans6 ай бұрын
    • Mostly because I am generally unqualified

      @lightningloans@lightningloans6 ай бұрын
    • We're all here to learn 👍

      @leonvanzyl@leonvanzyl6 ай бұрын
  • You got Redis, Zep and Metal. Which one is the best?

    @AssassinUK@AssassinUK6 ай бұрын
    • I personally found Upstash Redis to be the easiest to set up and integrate for production apps.

      @leonvanzyl@leonvanzyl6 ай бұрын
  • how do we dynamically send the new session ID rather than make C1 C2 manually

    @abedmalak_@abedmalak_3 ай бұрын
    • The idea is that your application should generate and store a session ID when calling the Flowise API / Embedding API. That way you can recall the session and allow the user to continue the conversation in the future.

      @leonvanzyl@leonvanzyl3 ай бұрын
  • how can we make a new unique session automatically for each user

    @jadmalak1@jadmalak16 ай бұрын
    • That needs to be done outside of Flowise. The calling application will have to manage users and conversation session IDs. Might be a cool tutorial idea? 😁

      @leonvanzyl@leonvanzyl6 ай бұрын
    • this would be an awesome idea, be able to track different conversations with different users and use that data to train your llm for different clients@@leonvanzyl

      @cynthiarohr@cynthiarohr6 ай бұрын
    • @@leonvanzylyes please!

      @jurjenborkent49@jurjenborkent496 ай бұрын
  • can u do tutorial on how to connect my chat bot to social media if that even possible pleaaaaaaase

    @saifeldeen1266@saifeldeen12666 ай бұрын
    • For sure! I was thinking of creating a tutorial on integrating Flowise with Instagram. What you think?

      @leonvanzyl@leonvanzyl6 ай бұрын
    • yeah sure that would be great . if you can cover all the social media platforms that's even better @@leonvanzyl

      @saifeldeen1266@saifeldeen12666 ай бұрын
  • What about DynamoDB? AWS is very popular a DynamoDB tutorial would be really cool!

    @kittentheorangetabby9676@kittentheorangetabby96766 ай бұрын
    • Flowise has support for DynamoDB. Simply add the DynamoDB memory node to your project.

      @leonvanzyl@leonvanzyl6 ай бұрын
  • how can the LLM have contextual memory

    @jadmalak1@jadmalak16 ай бұрын
    • It can't. The conversation is stored in a database which is seperate to the LLM. The conversation is then fetched from the DB and then past into the conversation as context when chatting to the model.

      @leonvanzyl@leonvanzyl6 ай бұрын
  • shoot, I followed everything three times over. and in the chat response, I'm getting this: (Me) hi (AI) *_Unauthorized, command was: ["lrange","c1",0,-1]_* -AND- (Me) hi (AI) *_Unauthorized, command was: ["lrange","0344952d-df2d-4bc6-9d2c-2ede304aa070",0,-1]_* - Seems like the second one has to do with Redis as this is what BlackBox spit out *-_ But I don't know what to do_-*- - ----_The `lrange` command in Redis is used to retrieve a range of elements from a list. The command takes three arguments: the key of the list, the start index, and the end index. The elements in the list are indexed from 0, where 0 is the first element, 1 is the second element, and so on. The start index is inclusive, while the end index is exclusive. This means that the element at the start index will be included in the range, while the element at the end index will not. In your case, you are trying to retrieve all elements from the list with the key "efc36c43-2ec1-42c1-9623-2773ffcc601e". The start index is 0, and the end index is -1. The end index of -1 is a special case in Redis that represents the last element of the list. Here is an example of how to use the `lrange` command in Python with the `redis` library: ​ import redis ​ # Create a connection to the Redis server r = redis.Redis(host='localhost', port=6379, password='your_password_here') ​ # Retrieve all elements from the list result = r.lrange("efc36c43-2ec1-42c1-9623-2773ffcc601e", 0, -1) ​ # Print the result print(result) ​ Make sure to replace `'your_password_here'` with the actual password used to authenticate the Redis server. If you are still encountering the "Unauthorized" error after following these steps, please provide more information about your setup, such as the operating system, Python version, Redis version, and the contents of your Python script. This will help in diagnosing the issue further. Note: The `lrange` command will return an empty list if the key does not exist or if the key exists but is not a list. Make sure that the key "efc36c43-2ec1-42c1-9623-2773ffcc601e" exists in your Redis database and is a list. You can check this using the `exists`_

    @bobbyjunelive1993@bobbyjunelive19936 ай бұрын
    • Odd. Ensure that you have the latest version of Flowise installed, and that you're using UPSTASH Redis and not the normal Redis node.

      @leonvanzyl@leonvanzyl6 ай бұрын
    • Yes, updated and that brought in the Upstash node before I asked. I'm new to all of this so I guess I'll just keep on beating on it.@@leonvanzyl

      @bobbyjunelive1993@bobbyjunelive19936 ай бұрын
KZhead