- 14
- 21 718
Full Stack AI LAB
Canada
เข้าร่วมเมื่อ 20 ก.ย. 2023
I share exactly how I build end-to-end apps and AI tools. The content of this channel is dedicated to those who are passionate about learning everything AI and want to leverage their software project skills.
I am committed to share my knowledge with as many viewer so more people enjoy the learning path that I have had through machine learning and AI.
If you are passionate about AI and would like to collaborate do not hesitate to reach out to me through email.
I am committed to share my knowledge with as many viewer so more people enjoy the learning path that I have had through machine learning and AI.
If you are passionate about AI and would like to collaborate do not hesitate to reach out to me through email.
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 | th-cam.com/video/IpLJwDfxiVA/w-d-xo.html
- CONSTITUTIONAL CHAIN | th-cam.com/video/R9t82CWpVB0/w-d-xo.html
- RAG CHAIN | th-cam.com/video/zI8vHrZ44MY/w-d-xo.html
- CHECKER CHAIN | th-cam.com/video/4uPOKXJCXM4/w-d-xo.html
- ROUTER CHAIN | th-cam.com/video/ItppCNZBzbY/w-d-xo.html
- SEQUENTIAL CHAIN | th-cam.com/video/BtMpyw11V5w/w-d-xo.html
Follow us on:
TH-cam: th-cam.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!
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 | th-cam.com/video/IpLJwDfxiVA/w-d-xo.html
- CONSTITUTIONAL CHAIN | th-cam.com/video/R9t82CWpVB0/w-d-xo.html
- RAG CHAIN | th-cam.com/video/zI8vHrZ44MY/w-d-xo.html
- CHECKER CHAIN | th-cam.com/video/4uPOKXJCXM4/w-d-xo.html
- ROUTER CHAIN | th-cam.com/video/ItppCNZBzbY/w-d-xo.html
- SEQUENTIAL CHAIN | th-cam.com/video/BtMpyw11V5w/w-d-xo.html
Follow us on:
TH-cam: th-cam.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!
มุมมอง: 398
วีดีโอ
Do NOT use Streamlit for PRODUCTION until you watch this!
มุมมอง 12K8 หลายเดือนก่อน
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
มุมมอง 4078 หลายเดือนก่อน
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!
มุมมอง 3458 หลายเดือนก่อน
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!
มุมมอง 2008 หลายเดือนก่อน
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
มุมมอง 2788 หลายเดือนก่อน
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
มุมมอง 808 หลายเดือนก่อน
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!
มุมมอง 2948 หลายเดือนก่อน
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!
มุมมอง 9708 หลายเดือนก่อน
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
มุมมอง 6459 หลายเดือนก่อน
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: TH-cam: th-cam.com/channels/vG89kqgYsb66jTsbkaxRDA.html Twitter: fullstackinfoai Join Discord...
Easiest way to Build your OpenAI like chatGPT message website with Streamlit | Use custom LLM models
มุมมอง 1.1K10 หลายเดือนก่อน
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: TH-cam: th-cam.com/channels/vG89kqgYsb66jTsbkaxRDA.html Twitter: fullstackinfoai Join Discord: discord.gg/p3v3...
How to Debug Streamlit App within VSCode in minutes!
มุมมอง 3.4K11 หลายเดือนก่อน
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: TH-cam: th-cam.com/channels/vG89kqgYsb66jTsbkaxRDA.html Twitter: fullstackinfoai Join Discord: discord.gg/p3v39seB #langchain #ai...
Awesome work, keep it up!
Thank you nima!
My experience is: don't mimic React/Business coding when using Streamlit. I use streamlit and Redis/Valkey/streamlit-local-storage, which is good for 90% of all app variations you may encounter. If you are doing something complex, I hope you get the budget, the team, and the planning. For smaller Ronin projects, Streamlit/Redis can foot the bill.
Thanks you . I’m appreciate it. But now I see Taipy can do better things, please research it. 👍
Thanks for your video. What do you think about Chainlit?
I haven't tried Chainlit and so I can't comment on that sorry!
Thanks, God bless you! Gracias, Dios te bendiga! Merci, Dieu te bénisse! Danke, Gott segne dich! Grazie, Dio ti benedica! Dank je, God zegene je! Obrigado, Deus te abençoe! Спасибо, Бог благословит тебя! 谢谢, 上帝保佑你! ありがとう, 神様があなたを祝福します! شكرا, بارك الله فيك! תודה, אלוהים יברך אותך! धन्यवाद, भगवान आपका भला करे! 감사합니다, 하나님이 당신을 축복하시길 바랍니다! Cảm ơn, Chúa phù hộ bạn 🙌🤝🤙✌
Thank you for this warm inclusive answer :)
What's the next level in AI then?
No body knows! This is a very fast changing space to be honest :)
Interesting to learn thanks!
Cool man thanks for giving insights around AGI!
Would Shiny be a good choice to use? replacing Streamlit ?
I briefly mentioned about Shiny in my video, however, everything depends on your use case. Think about `scale` when things go to prod...
Worked flawlessly! Thanks a lot
Excellent! :)
Thank u very much!!
I just subscribed Thank you for your work 🙌
Thank you for your support!
You can create pretty complex medium sized dashboard applications with Streamlit. I’d even argue that making a website for a small business that’s exposed to the web is completely acceptable. Think about a small company like a brewery that just wants to put out details about their business, different products and pricing. It would be a great solution for something like that. Edit - as far as JavaScript frameworks go I think React is losing ground to vue.
Thank you for sharing your thoughts. I pretty much explained in the video that Streamlit is a great framework for small sized businesses or simple solutions. Definitely the JS framework competition is on! Appreciate your insights!
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.
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!
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 ?
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.
@@fullstackailab thanks🙂
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.
100% agree! You re-stated the points I made in the video. Thank you for sharing your valuable thoughts :)
Gradio probably falls in the same category
Gradio is well suited for most LLM applications and yes it is for proof of concept purposes.
What do you think Mesop from google ?
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.
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?
{ "name": "streamlit debug", "type": "python", "request": "launch", "module": "streamlit", "args": [ "run", "${file}", "--server.port", "8501", "--server.address", "10.11.20.154" ], "justMyCode": true, }
@@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.
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
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.
@@fullstackailab 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?
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!
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.
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.
Great video! Kudos!
Thank you! Cheers!
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!
Yes! Indeed I have mentioned that in detail that for ML initiatives and DS, Streamlit is the first step!
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 TH-cam 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 .
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.
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
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)
No recommendation of some other framework as a replacement?
Do you mean framework with python or in general for UI?
@@fullstackailab Both. For example I'm an engineer who does not seek a career in web development. I'm busy enough as it is shooting rockets into space to be concerning myself with frontend. I need frameworks that abstract the presentation and communication with the server backend, which Streamlit does quite well. Alternatives?
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.
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 :)
is there a way to combine the two? using streamlit and javascript combo backend and react frontend?
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.
Thank you very much! Very useful video and straight to the point.
Glad it was helpful!
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.
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 :)
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?
Try stlite, a python library. check out their github page: github.com/whitphx/stlite
@@fullstackailab 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?
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?
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.
@@fullstackailab I see, thanks for helping anyways!
This is gold, although the implementation is bare-bone, it allows you to customise everything quite well. This is good stuff
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` :)
Great collection! Keep it up! Your videos looks great!
Thank you!
I love 13:23 that you showed the streaming. That's really what I am after! Thanks bro!
Glad you enjoyed!
👌🔥
👌👌🔥
Really great and useful 👌
Glad it was helpful!
🎉🔥
Cool! Thanks for putting this together 🙏🏻
I hope this is helpful!
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
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.
For a second I thought its Stanley Tuchchi
hahaha Pretty close but no He is not Stanley :)
Great content! I look forward to learning more from your channel. Thanks for sharing!
Thank you so much!
awesome stuff! thanks for putting it together
Thank you so much for your support!
Great content 👌
Thank you 🙌
"Promo sm" 😚
Thank you for your support.
Thank you!
Thanks for this video! It helps me a lot with my problem debugging my python app!
You're very welcome!
Thanks man. You saved me a lot of pain.
I am glad this helped!