Full Stack AI
Full Stack AI
  • 14
  • 11 650
Memory & Conversation Chain | Chain Types | Learning Langchain Series | Tutorial on 4 Memory Types
Github Code for this video:
github.com/full-stack-ai/popular-llm-chains/tree/main/most_used_langchain_chains
Learn how to work with 4 types of Memories in Langchain using Conversation Chain.
Conversation chain is very useful when you build your QA Chatbot or you have a conversational Search mechanism using LLMs.
Knowledge Graph Memory is one of the most efficient methods to store lots of information in a low space memory and take advantage of LLMs interpretation to generate sentences out of the keywords from the knowledge graph.
aibrain.com/memory-graph/
I highly recommend do watch my other videos on other chain types from langchain:
- API CHAIN | czcams.com/video/IpLJwDfxiVA/video.html
- CONSTITUTIONAL CHAIN | czcams.com/video/R9t82CWpVB0/video.html
- RAG CHAIN | czcams.com/video/zI8vHrZ44MY/video.html
- CHECKER CHAIN | czcams.com/video/4uPOKXJCXM4/video.html
- ROUTER CHAIN | czcams.com/video/ItppCNZBzbY/video.html
- SEQUENTIAL CHAIN | czcams.com/video/BtMpyw11V5w/video.html
Follow us on:
CZcams: czcams.com/channels/vG89kqgYsb66jTsbkaxRDA.html
Twitter: fullstackinfoai
LinkedIn: www.linkedin.com/company/fullstackaialta
Join Discord: discord.gg/p3v39seB
#langchain #ai #llm #python #conversation #chain #chatgpt #chatbot #openai #education #coding #artificialintelligence #machinelearning #fullstack #backend #largelanguagemodels #nlp #naturallanguageprocessing
------
Chapters:
0:00 Intro
0:12 What is Memory in Langchain?
1:02 Set up Virtual Environment
1:42 Working with ConversationBufferMemory from Langchain
3:34 What is under the hood for chat_memory and BaseChatMessageHistory
5:39 Install PyKernel for Jupyter Notebook
6:08 Return Memory's chat history
7:23 Build Conversation Chain from Langchain
7:53 Import Libraries
11:20 Construct LLM Model with OpenAI API
11:46 Construct Prompt Template
13:33 Construct Memory
14:08 Construct the Conversation Chain Object
16:28 Test the chain on ConversationBufferMemory
18:43 Test the chain on ConversationSummaryMemory
19:57 Test the chain on ConversationBufferWindowMemory
21:50 Test the chain on Conversation Knowledge Graph Memory
23:17 Recap
23:44 Thank you!
zhlédnutí: 292

Video

Do NOT use Streamlit for PRODUCTION until you watch this!
zhlédnutí 6KPřed 2 měsíci
You might be thinking to consider getting your AI application to the next level and you want to run a business on top of it but you're not sure how to expose the model with your user? Please watch this video. I give 4 reasons why Streamlit is not a good choice for your applications especially if you intend to inter act with large population of users. Important things to consider: - Custom Styli...
Learning Langchain Series - Chain Types - Introduction
zhlédnutí 299Před 3 měsíci
This is a series all about `Langchain chain types`. Learn how to use these spectacular chains in your project. We'll explore the chains from the python library of langchain, learn how to use the chain classes and finally show case some example. You will be acquainted with the langsmith environment to observe the steps LLMs take to deliver the final response. Github Code for all videos in this s...
SEQUENTIAL CHAIN | Learning Langchain Series | Chain Types | Let's call multiple LLMs in series!
zhlédnutí 227Před 3 měsíci
Sequential chain is one of those founding chains that comprises the connection of several chains together. So if you are looking into automating the communication of multiple LLMs by passing the output of one LLM Chain to the input of another LLM Chain, you need to use Sequential chain. SimpleSequentialChain is used for a simple series of two chains and so we consider the harder example, the Se...
ROUTER CHAIN | Learning Langchain Series | Chain Types | Route between your LLMs in a fashion way!
zhlédnutí 158Před 3 měsíci
Router chain is one of the tools you'll definitely need when dealing with multiple tasks! Imagine how to handle multiple APIs or multiple tasks among multiple LLMs! Router chain directs the query to the most suited chain, delivering the highest value to the natural language app. Interesting topics with Router Chain: medium.com/@gil.fernandes/langchains-router-chains-and-callbacks-722524c4aa42 W...
RETRIEVAL CHAIN - RAG | Chain Types | Learning Langchain Series | Chat with anything on the web
zhlédnutí 163Před 3 měsíci
Retrieval chains are famous for empowering the LLMs with retrived documents from various sources (web, pdf, documents, sql database ...). We'll explore the chains from the python library of langchain, learn how to use the chain classes and finally show case some example. For more information about different types of retrieval chains visit: blog.langchain.dev/retrieval/ You will be acquainted wi...
CONSTITUTIONAL CHAIN | Chain Types | Learning Langchain Series | Build constitutional critics
zhlédnutí 61Před 3 měsíci
Constitutional chains gives you the ability to enforce specific revision or critics tasks through LLMs. Confident enough, this chain will be a game changer in policy making and strategist fields. You will see that with the help of this library, you'll be at the forefront of delivering values when applying constitutional principles with this chain! We'll explore the chains from the python librar...
LLM CHECKER CHAIN | Learning Langchain Series | Chain Types | Fact check statements easily!
zhlédnutí 186Před 3 měsíci
If you are looking for a reasoning LLM and develop a natural language model that can verifies content, the check out this tutorial on LLM Checker chains from langchain. More information about checker chains: api.python.langchain.com/en/latest/chains/langchain.chains.llm_checker.base.LLMCheckerChain.html We'll explore the chains from the python library of langchain, learn how to use the chain cl...
API Chain | Chain Types | Learning Langchain Series | Become an expert in calling APIs with LLMs!
zhlédnutí 610Před 3 měsíci
Learn how to call an API using APIChain from langchain. You will see that with the help of this library, you'll be at the forefront of delivering values when calling APIs with language models! We'll explore the chains from the python library of langchain, learn how to use the chain classes and finally show case some example. The example we use for this tutorial is the news api. For more informa...
LangSmith 101, Boost your Responsible AI with LangChain's Powerful framework
zhlédnutí 535Před 4 měsíci
Let me know in the comments what other capabilities of LangSmith you are most interested in. Learn more about LangSmith from documentation: docs.smith.langchain.com/ Github Code for this video: github.com/full-stack-ai/langsmith-101/blob/main/langsmith_101/LLMs/llm_response.py Follow us on: CZcams: czcams.com/channels/vG89kqgYsb66jTsbkaxRDA.html Twitter: fullstackinfoai Join Discord...
Easiest way to Build your OpenAI like chatGPT message website with Streamlit | Use custom LLM models
zhlédnutí 953Před 5 měsíci
Want to design and build a comparable chatGPT website that is very much like openai's chat? By the end of this video, you will have a chat platform that replicates simply the chat.openai.com/. Links: Github Repo: github.com/full-stack-ai/chatgpt-with-streamlit Follow us on: CZcams: czcams.com/channels/vG89kqgYsb66jTsbkaxRDA.html Twitter: fullstackinfoai Join Discord: discord.gg/p3v3...
How to Debug Streamlit App within VSCode in minutes!
zhlédnutí 1,6KPřed 5 měsíci
Your UI app in python (aka Steamlit) is running into problems and you can't figure out how to diagnose the problem? You can use the vscode debug config file to solve that problem. Github code is here: github.com/full-stack-ai/debug-streamlit Follow us on: CZcams: czcams.com/channels/vG89kqgYsb66jTsbkaxRDA.html Twitter: fullstackinfoai Join Discord: discord.gg/p3v39seB #langchain #ai...

Komentáře

  • @nthmost
    @nthmost Před 29 dny

    Your points are valid but I wish you'd compare apples to oranges. Streamlit is a front and back-end in one, so comparing it to React over and over again isn't particularly useful. Streamlit even uses React on its front-end. Streamlit would be more usefully compared to things like Dash and Solara.

    • @fullstackai24
      @fullstackai24 Před 29 dny

      Thank you for bringing your insights. Really appreciate it! I am not quite sure when you say "Streamlit is a front and back-end in one". This is practically not true. Yes, Streamlit is a framework built on Python and yes integration with backend apps developed in Python (Flask, FastAPI, etc.) is seamless. Though, this is still a framework to make UI integrations. In any case, you made a good point of having a comparison of Python UI Frameworks. Which is an interesting idea!

  • @PratikSinghFilms
    @PratikSinghFilms Před měsícem

    i am working on a saas app like ai girlfriend stuff should i use streamlit to get first 100 users and then change the framework to flask,faastapi or django or should i use this framework from start ?

    • @fullstackai24
      @fullstackai24 Před 29 dny

      That is a great start! Depends on the complexity of your app and I suggest if you have the necessary skills to run with Streamlit to get it going, then it should be good and as you take off then you can think about improving in the next version of the app.

    • @PratikSinghFilms
      @PratikSinghFilms Před 22 dny

      @@fullstackai24 thanks🙂

  • @zendr0
    @zendr0 Před měsícem

    No one will use streamlit for prod. We know that. But Streamlit is the best tool to get started with MVP and get that initial funds by validating your ideas. No one will invest their time and effort on learning react and then building one with React without knowing if it is even worth spending your time on something that people doesn't even want.

    • @fullstackai24
      @fullstackai24 Před měsícem

      100% agree! You re-stated the points I made in the video. Thank you for sharing your valuable thoughts :)

  • @awonglk
    @awonglk Před měsícem

    Gradio probably falls in the same category

    • @fullstackai24
      @fullstackai24 Před měsícem

      Gradio is well suited for most LLM applications and yes it is for proof of concept purposes.

  • @guruyuvi
    @guruyuvi Před měsícem

    What do you think Mesop from google ?

    • @fullstackai24
      @fullstackai24 Před měsícem

      Great question! Mesop is relatively new and so from what I see it is best suited for LLM based applications and it's not a general purpose framework. A general recommendation, I would ponder on the business use case and user journey and more importantly find the answer for: Is it seamless with the backend? I see that Mesop is been out maybe in the last couple of months (the code base started October 2023). Assess new solutions based on the number of Stars on Github and the number of issues + number of Open Pull Requests. 1- You have no community support (if a bug happens wish you luck!) 2- It's best suited for AI Apps (as per documentation) so not a generic solution. Definitely it is worth examining though I would not consider a production app with this as the UI.

  • @craintest
    @craintest Před měsícem

    Hi, I followed you steps, but still could not debug it, and here is my config of launch.json, would you please take a look?

    • @craintest
      @craintest Před měsícem

      { "name": "streamlit debug", "type": "python", "request": "launch", "module": "streamlit", "args": [ "run", "${file}", "--server.port", "8501", "--server.address", "10.11.20.154" ], "justMyCode": true, }

    • @fullstackai24
      @fullstackai24 Před měsícem

      @@craintest Try put the "8501" and "10.11.20.154" in a new line. That should resolve your problem. Let me know how it goes.

  • @danja5512
    @danja5512 Před měsícem

    I build many ML and Dashbord web app prototypes with streamlit. Its so fast and easy with this framework. And i often was asking myself why Streamlit is considered only as a prototype tool and not suited for serious applications. So thank you for clarifying the limits Soc

    • @fullstackai24
      @fullstackai24 Před měsícem

      I'm glad you find this helpful. I have found Streamlit helpful for the proof of concept step, though at some point it could be a hassle to switch to a mature framework to be fully functional for UI.

    • @danja5512
      @danja5512 Před měsícem

      @@fullstackai24 could you recommend some more or less lightweight python frameworks that are more suited for serious tasks? For example Django? Or would you say in that case it's better to leave python aside to go for solid frontend stuff like react & co?

    • @fullstackai24
      @fullstackai24 Před měsícem

      Definitely if you or your team is comfortable with Django, that's a great to go with. Keep in mind that fullstacks can be powerful if both are developed in one language. It may also depend on the use case. You'll have more options when you work with Reactive frameworks. What you really want on your UI side really matters!

  • @lexzhang397
    @lexzhang397 Před měsícem

    I don't agree that Streamlit is hard to Seamless integration with APIs and backend services. Because I built a client-server bussiness website with Streamlit-Gin(Golang)-Mongodb-Redis-Nginx-Docker-K8s, it is quite easy to handel thounds of users, if you can't do it, doesn't means other people can't do it.

    • @fullstackai24
      @fullstackai24 Před měsícem

      It depends on the purpose of the work. Indeed if you watch the video I bring evidence from a number of views (professionally). Glad to see that you're using a bussiness website with Streamlit. Maybe you can elaborate on what have you used as components for the Streamlit app.

  • @tompower4008
    @tompower4008 Před měsícem

    Great video! Kudos!

  • @aiberta
    @aiberta Před měsícem

    Thank you for clarifying on pits and falls of Streamlit. I see that you're mentioning that it is still the framework of choice for Data Science applications. Very informative video!

    • @fullstackai24
      @fullstackai24 Před měsícem

      Yes! Indeed I have mentioned that in detail that for ML initiatives and DS, Streamlit is the first step!

  • @frag_it
    @frag_it Před měsícem

    You need to slow down , what’s the difference between reading the docs and your content if you don’t explain things step by step that’s why ppl come to CZcams to learn in a better way, these are important topics. I think the series is a good idea but you need to explain it in step by step manner. Otherwise it’s just waste of time. Hope it helps .

    • @fullstackai24
      @fullstackai24 Před měsícem

      Thank you for your feedback. Definitely I will keep that in mind for future videos and tutorials. Please view the other videos in the series and if you have any questions please let me know.

  • @ccquang
    @ccquang Před 2 měsíci

    Hi there - agree with what you were saying about "Handling running sessions and multi threading capability", and the slow refresh rate, but disagree with the other items. We've successfully built an enterprise grade data science app. Custom styling (CSS/HTML/javascript) is possible but not as elegant as it could be, community support is slower but def enough to get a production-grade MVP up. Handling REST APIs is easy and painless and is the architecture we use (Streamlit as front end, REST APIs via AWS as the back end). For startups Streamlit is a fantastic choice for getting an MVP up and learning. For scale up, I agree with you using a more traditional front end with back end is more flexible and granular (although can be much more expensive to develop, especially if you only have data science skills in-house and need to get full stack capability from outside). For resource constrained AI/ datascience startups with no frontend dev skills in house and only datascience skills inhouse, Streamlit is a perfect choice. If you have front end skills in house (HTML/CSS/Java or Typescript) plus React etc. and separate back end skills for REST APIS then lucky for you, I would go for the front + back end arrangement

    • @fullstackai24
      @fullstackai24 Před 2 měsíci

      Thank you for bringing that up. I very much respect your view. Now, considering a custom CSS or styling for multiple projects at the same time is not easy as the styling working directory for streamlit is a common space between all projects. I look forward to seeing streamlit being the top notch framework for python stack apps. I use streamlit for most of my PoC works (not PRODUCTION though)

  • @user-ty2gg8vv6m
    @user-ty2gg8vv6m Před 2 měsíci

    No recommendation of some other framework as a replacement?

    • @fullstackai24
      @fullstackai24 Před 2 měsíci

      Do you mean framework with python or in general for UI?

  • @AmitKumar-mp5ey
    @AmitKumar-mp5ey Před 2 měsíci

    Great Video and explanation. I am trying the API Chain using Mistral with Ollama locally. Model is giving correct URL with some unnecessary text like - Base on doc correct API_URL is http:/...... . Next step model is executing all these text as api which is causing error. Can you suggest anything to try.

    • @fullstackai24
      @fullstackai24 Před 2 měsíci

      Great to see that you're working with API Chain! If you are trying to develop your custom API_DOC I recommend take a look at the samples that exist in langchain's documentation. In the video, I showed how to find the API_DOCs. Also, if you search on `how to write api documentation` I am pretty sure you'll find some great resources. Keep on working on awesome stuff :)

  • @re-nz3sk
    @re-nz3sk Před 2 měsíci

    great video

  • @felicia6242
    @felicia6242 Před 2 měsíci

    is there a way to combine the two? using streamlit and javascript combo backend and react frontend?

    • @fullstackai24
      @fullstackai24 Před 2 měsíci

      There is. Only if you are expert in JS and set up a separate component that is running in the DOM and the streamlit can be streamed inside the JS component. You can use <iFrame> tags to include a Streamlit app inside JS. However, the use cases could be very minimal.

  • @juand6106
    @juand6106 Před 2 měsíci

    Thank you very much! Very useful video and straight to the point.

  • @pablofonseca123
    @pablofonseca123 Před 2 měsíci

    I think it all depends on the use case. Streamlit is great for fast prototyping, to transform ideas to apps *really* fast. Even for regular users that have no advanced programming skills! if you are a full stack experienced developer, you can still use the same Streamlit to build up specialized production-ready apps. Again, It’s all about use cases. I think this kind of videos doesn’t really help developers to decide on what to use. I’ve put into production Streamlit apps with custom components that fill the business needs, are easy to Maintain and were developed in a very short time. For me Streamlit+business knowledge is all you need.

    • @fullstackai24
      @fullstackai24 Před 2 měsíci

      Thank you for your feedback! Definitely Streamlit is a great framework for starting something pretty quick (DEV stage) especially when the whole backbone of the app (backend I mean) is Python based, then Streamlit is great! I mentioned this here 5:43. I have came across use cases that were badly backlashed due to the constraints. Again I am mentioning here 3:12 that there are works for improvements for pythonic UI frameworks. Appreciate your wonderful comment! I use Streamlit but I would love to raise its limitations to the community as well :)

  • @oh_synap
    @oh_synap Před 2 měsíci

    👋 Hello! Streamlit team member here. Thanks for the video. We are exploring how to address most of the issues you raised and how to make Streamlit more awesome for production, since many developers and companies are using it that way. I agree that if you need a full scale, pixel-perfect consumer grade application for tens of thousands of concurrent users, you probably need a traditional three tier full stack application. But many other real world use cases don't require that level. Two specific points in your video I want to push back a bit: 1. You mostly focus on comparing to React and Angular, however many developers don't have those skills and they can be expensive and time consuming to learn, and also significantly increase the maintenance and improvement cost of your application - I have seen this first hand in several of my own roles! It's incredibly powerful to manage the whole application in python. 2. The Streamlit Community is incredibly vibrant and active and there's a ton of support and existing material out there. It might not compare to React but we have one of the most engaged communities in the Python ecosystem for sure! Cheers, loved the Chatbot video you put together and feel free to reach out if you want to chat further! Thanks!!

    • @fullstackai24
      @fullstackai24 Před 2 měsíci

      Thanks Josh for your insightful feedback. Would love to chat more in the future! Glad you liked that Chatbot video :)

  • @user-mz9mv1cl3t
    @user-mz9mv1cl3t Před 2 měsíci

    Hi, my main.py file runs successfully when I do streamlit run main.py, hence there seems to be no issues when I try to debug using the feature in your video (great video by the way!). However after using PyInstaller to package my streamlit app into an .exe file, upon opening the .exe, I get the error that st.session_state cannot function without `streamlit run`. But `streamlit run` can only operate with .py files; how do I then open my .exe file and also use st.session_state?

    • @fullstackai24
      @fullstackai24 Před 2 měsíci

      Try stlite, a python library. check out their github page: github.com/whitphx/stlite

    • @user-mz9mv1cl3t
      @user-mz9mv1cl3t Před 2 měsíci

      @@fullstackai24 Hi, thanks for the suggestion. I tried to explore more about stlite but I am unsure of how to use it as the examples I have seen simply use st.mount and document.getElementById("root") to run the file, how then does this relate to my issue with session state?

    • @user-mz9mv1cl3t
      @user-mz9mv1cl3t Před 2 měsíci

      Also just to note, from what I have explored it seems like ths st.lite web apps are still ultimately deployed to the web. What if I want to deploy it as an .exe file, because I want to access the app without internet access. Is it still possible to use st.lite?

    • @fullstackai24
      @fullstackai24 Před 2 měsíci

      This is something you can contact the streamlit team directly or ask on their community support web page. My knowledge is limited on the thread establishment of executable files when they are run in Microsoft OS.

    • @user-mz9mv1cl3t
      @user-mz9mv1cl3t Před 2 měsíci

      @@fullstackai24 I see, thanks for helping anyways!

  • @chrisalmighty
    @chrisalmighty Před 3 měsíci

    This is gold, although the implementation is bare-bone, it allows you to customise everything quite well. This is good stuff

    • @fullstackai24
      @fullstackai24 Před 3 měsíci

      In fact, streamlit delivers a good interface when the team needs a quick demo handy to deliver to the business stakeholders. Though I still recommend watch out for glitches in Streamlit. Stay tuned for my next video on `Why you should avoid streamlit for production` :)

  • @tompower4008
    @tompower4008 Před 3 měsíci

    Great collection! Keep it up! Your videos looks great!

  • @tompower4008
    @tompower4008 Před 3 měsíci

    I love 13:23 that you showed the streaming. That's really what I am after! Thanks bro!

  • @nim-cast
    @nim-cast Před 3 měsíci

    👌🔥

  • @nim-cast
    @nim-cast Před 3 měsíci

    👌👌🔥

  • @nim-cast
    @nim-cast Před 3 měsíci

    Really great and useful 👌

  • @nim-cast
    @nim-cast Před 3 měsíci

    🎉🔥

  • @aafshinfard
    @aafshinfard Před 3 měsíci

    Cool! Thanks for putting this together 🙏🏻

  • @blacktergum
    @blacktergum Před 3 měsíci

    I really enjoyed streamlit so far, but unfortunately we cannot use it in a production environment due to the weird axios 403 error we get in the st.file_uploader when deployed via Azure Web App. Only solution provided in the forums ist to disable the xsrf protection, what is kinda bad

    • @fullstackai24
      @fullstackai24 Před 3 měsíci

      I agree with you 100%. There are some foundational issues with streamlit and the way it handles kernel processes that cannot be resolved easily. Nevertheless, data scientists at least have a easy-to-access dashboard to showcase results in DEVELOPMENT stage. For sure, the Production stage you need a fully reliable frontend framework like Angular, React or other JS based frameworks.

  • @KumR
    @KumR Před 3 měsíci

    For a second I thought its Stanley Tuchchi

    • @fullstackai24
      @fullstackai24 Před 3 měsíci

      hahaha Pretty close but no He is not Stanley :)

  • @aiberta
    @aiberta Před 3 měsíci

    Great content! I look forward to learning more from your channel. Thanks for sharing!

  • @MLOps
    @MLOps Před 3 měsíci

    awesome stuff! thanks for putting it together

  • @nim-cast
    @nim-cast Před 4 měsíci

    Great content 👌

  • @joryhostombe6351
    @joryhostombe6351 Před 4 měsíci

    "Promo sm" 😚

  • @realCleanK
    @realCleanK Před 4 měsíci

    Thank you!

  • @tompower4008
    @tompower4008 Před 5 měsíci

    Thanks for this video! It helps me a lot with my problem debugging my python app!

  • @MegaNightdude
    @MegaNightdude Před 5 měsíci

    Thanks man. You saved me a lot of pain.