Create a RAG Chain using LangChain 0.1 (New version)

  Рет қаралды 22,089

Alejandro AO - Software & Ai

Alejandro AO - Software & Ai

Күн бұрын

In this video we explore a crash course of the new Langchain version (0.1.0) in python. This will allow you to create RAG chains in Langchain to chat with your documents.
We will be showcasing LangChain, a revolutionary Python library that empowers developers to create context-aware and reasoning-driven applications using powerful language models.
In the video, we will create several chains using the new version of LangChain to chat with a website. The final chain that we build here is a history-aware chain that takes the history of the conversation into account to answer your questions.
----- LINKS
📒 Google Colab: colab.research.google.com/dri...
👉 Official LangChain Documentation: python.langchain.com/docs/get...
💬 Join the Discord Help Server - link.alejandro-ao.com/HrFKZn
❤️ Buy me a coffee... or a beer (thanks): link.alejandro-ao.com/l83gNq
✉️ Join the mail list: link.alejandro-ao.com/AIIguB
-------------------
🔗 What is LangChain?
LangChain is a framework designed to elevate your applications to new heights. It enables the creation of context-aware applications by connecting language models to various sources of context, allowing them to reason and provide intelligent responses.
🚨 Quickstart Highlights:
👉 1. Get Set Up with LangChain: Learn how to seamlessly set up the LangChain ecosystem to kickstart your development journey.
👉 2. Basic Components Mastery: Explore the fundamental components of LangChain, including prompt templates, models, and output parsers. Harness the power of these components to enhance your applications.
👉 3. LangChain Expression Language: Delve into the protocol that serves as the backbone of LangChain. Discover how the LangChain Expression Language (LCEL) facilitates component chaining, enabling seamless integration and communication between different elements.
👉 4. Build Your First Chains: Follow our step-by-step guide to construct a set of simple yet powerful chains using LangChain. Witness firsthand the capabilities that this innovative library brings to your projects.
🛠️ Why LangChain?
LangChain opens up a world of possibilities, allowing you to create intelligent applications that understand context and make informed decisions. Whether you're a seasoned developer or a coding enthusiast, LangChain is your gateway to building the next generation of language-powered applications.
👨‍💻 Who is This For?
This Quickstart tutorial is perfect for developers looking to harness the potential of language models in their applications. No matter your experience level, this guide provides a straightforward introduction to LangChain's capabilities.
🚀 Level Up Your Development Game with LangChain!
Don't miss out on this opportunity to revolutionize your application development process. Join us in this Quickstart tutorial and unlock the true potential of language models. Get ready to code smarter, reason better, and create applications that stand out!
⏰ Timestamps
0:00 Intro
1:19 Installing Langchain
4:06 Get API Keys and Initialize LLM
6:40 Create Your First Chain
10:22 Add Output Parser to Your Chain
13:21 What is a RAG Chain
14:55 Load Text From a Website
19:35 Create a Vector Store
22:44 Create a Document Chain
29:04 Create a RAG Chain
33:24 Retriever Chain with History
43:06 RAG Chain with History
50:35 Conclusion
🚀 #LangChain #PythonLibrary #LanguageModels #DeveloperTutorial

Пікірлер: 108
@alejandro_ao
@alejandro_ao 4 ай бұрын
💬 Join the Discord Help Server: link.alejandro-ao.com/981ypA ❤ Buy me a coffee (thanks): link.alejandro-ao.com/YR8Fkw ✉ Join the mail list: link.alejandro-ao.com/o6TJUl
@guruprasannasuresh3893
@guruprasannasuresh3893 4 ай бұрын
Awesome. I'm excited that you are back !!! Thanks Desperately waiting for the next chapter 😀
@alejandro_ao
@alejandro_ao 4 ай бұрын
thank you! it's coming next week :)
@henkhbit5748
@henkhbit5748 4 ай бұрын
Thanks for the update of Langchain. Quite a lot changes in the syntax. Looking forward with open source llm and embeddings with agents using the new Langchain👍
@alejandro_ao
@alejandro_ao 4 ай бұрын
sure thing, it's on the way!
@samcavalera9489
@samcavalera9489 4 ай бұрын
Thanks so much bro for all your great videos! I got to know your channel only 2 weeks ago, and since then, I have been watching and practising your tutorials from early 2023. Please don't stop thw great work! Can't wait to watch the app version of thia RAG tutorial with agent 😃
@alejandro_ao
@alejandro_ao 4 ай бұрын
thank you man, it means a lot! keep it up! we are living in exciting times
@samcavalera9489
@samcavalera9489 4 ай бұрын
@@alejandro_ao 🙏🙏🙏
@reubensolomon9047
@reubensolomon9047 4 ай бұрын
I am impressed with your video. it was Simple, practical, and easy to follow, I've been watching tutorials on how to use Langchain but this is the best I've seen so far. I'm waiting for the app version. Keep doing the good work Alejandro.
@cheattube
@cheattube 4 ай бұрын
super, i was doig the same thing yesterday and then yt showed me your video:).... exellent work , WATING FOR THE NEXT CHAPTER
@alejandro_ao
@alejandro_ao 4 ай бұрын
we're in sync 😎
@bwilliams060
@bwilliams060 4 ай бұрын
Thanks AO - looking forward to your next video!
@alejandro_ao
@alejandro_ao 4 ай бұрын
thank *you*!
@ratral
@ratral 4 ай бұрын
Alejandro, thank you. Excellent work.
@alejandro_ao
@alejandro_ao 4 ай бұрын
i´m glad you liked it!! there's much more to come
@mygicarskrsk4465
@mygicarskrsk4465 4 ай бұрын
thanks for making these awesome videos, it helps alot to understand the concepts and you are very clear n concise. keep it up!🎉
@alejandro_ao
@alejandro_ao 4 ай бұрын
i'm glad to hear that this is useful to you! will do!
@SanjeevKumar-dr6qj
@SanjeevKumar-dr6qj 4 ай бұрын
Awesome. You have always somehting great to offer us.
@alejandro_ao
@alejandro_ao 4 ай бұрын
it's my pleasure! there's more to come
@Matepediaoficial
@Matepediaoficial 4 ай бұрын
So interesting! Nice to see you again
@alejandro_ao
@alejandro_ao 4 ай бұрын
thanks! nice to see you too :)
@Sarkkoth
@Sarkkoth 4 ай бұрын
Thank you for this. With the recent changes it's been so hard to find updated tutorials.
@alejandro_ao
@alejandro_ao 4 ай бұрын
No worries!
@BrandonFoltz
@BrandonFoltz 4 ай бұрын
And you are back! This made my day.
@alejandro_ao
@alejandro_ao 4 ай бұрын
hello Brandon! thanks! :) so nice to see you around here again!
@harshyadav1190
@harshyadav1190 4 ай бұрын
Thanks man, waiting for next part
@alejandro_ao
@alejandro_ao 4 ай бұрын
Coming soon!
@swiftmindai
@swiftmindai 4 ай бұрын
Thank you brother. Truely saved my time.
@alejandro_ao
@alejandro_ao 4 ай бұрын
Glad to hear it!
@jimg8296
@jimg8296 4 ай бұрын
Totally Awesome, thank you.
@alejandro_ao
@alejandro_ao 4 ай бұрын
glad you liked it!
@smtabatabaie
@smtabatabaie 2 ай бұрын
Super useful man, thanks
@alejandro_ao
@alejandro_ao 2 ай бұрын
thanks man, glad it helped!!
@michaelwallace4757
@michaelwallace4757 4 ай бұрын
Thanks for the video tutorial.
@alejandro_ao
@alejandro_ao 4 ай бұрын
No worries!
@siavoshoon
@siavoshoon 4 ай бұрын
Thank you for this video. It was so informative and well-made.
@alejandro_ao
@alejandro_ao 4 ай бұрын
thanks! i'm glad it was useful!
@alessandroabaza4118
@alessandroabaza4118 4 ай бұрын
Best explanation I've seen!
@alejandro_ao
@alejandro_ao 4 ай бұрын
thanks!
@jacobgoldenart
@jacobgoldenart 4 ай бұрын
Great Video! I actually coded along with the whole thing! I've been trying to get to grips with the new update and the LCEL syntax. Some topics I would love to see videos for are: 1. Runnables, RunnableParallel, RunnablePassthrough(), Runnable protocol... So many runnable things! : ) 2. Interface, is that like a wrapper for things you chain together? like Prompt | LLM | etc... 3. I'm still confused about the difference between a Chain and an Agent and how/when they work together, like can you use chains with agents or vice versa... 4. Finally, I'd love to see a video for a Conversational Agent that does function calling/tools, where the chat history is sent to a vector db and can then be retrieved as context, so that the agent can learn things over time. Thats my wish list! Thanks again.
@alejandro_ao
@alejandro_ao 4 ай бұрын
hey Jacob, i'm glad you found this useful! thanks a lot for the list! i'll try to make videos about this. you can join the discord if you want to follow the news of the channel closely: link.alejandro-ao.com/discord
@kaidone1
@kaidone1 4 ай бұрын
thank god you still make videos
@alejandro_ao
@alejandro_ao 4 ай бұрын
thanks! i’m doing this full time now! let me know what you want to see next :)
@kaidone1
@kaidone1 4 ай бұрын
@@alejandro_ao i failed to save a vectorstore locally and use them with a different conversation chain. Main goal was to save money, because it was the same big file I processed, just different questions. I think you made a video with cloud solution once, but I would prefer a local one
@alejandro_ao
@alejandro_ao 4 ай бұрын
@@kaidone1 there's a chapter about this next week's video :)
@arashkoushkebaghi1432
@arashkoushkebaghi1432 3 ай бұрын
Dude, I love your content. Your work addresses real world problems which is what I have been looking for. Thank you! Also you are very good at explaining these advanced terms to dumb it down for us beginners ❤. Can you make some videos about image processing with langchain?
@alejandro_ao
@alejandro_ao 2 ай бұрын
thank you for your support!! i will be making some videos about image processing indeed. it's something that i wanted to do for a while
@moonly3781
@moonly3781 4 ай бұрын
Thank you for this great Tutorial! As far as I know, FAISS uses the inner product (dot product) and L2 (Euclidean) distance as standard metrics for similarity search. However, I'm curious if it's possible to use cosine similarity with FAISS instead. Would utilizing cosine similarity be more beneficial, especially considering its advantages with higher-dimensional vectors?
@laxmiagarwal3285
@laxmiagarwal3285 Ай бұрын
very informative video
@alejandro_ao
@alejandro_ao Ай бұрын
thanks!
@lordareello8221
@lordareello8221 4 ай бұрын
bro thanks alot, this is soooo useful
@alejandro_ao
@alejandro_ao 4 ай бұрын
that's great to hear! you're welcome :)
@juanmanuelcarrillo7731
@juanmanuelcarrillo7731 2 ай бұрын
Good video 👍
@alejandro_ao
@alejandro_ao 2 ай бұрын
thanks!
@danielmacedo1910
@danielmacedo1910 4 ай бұрын
Thanks for the video, man!! It's great! Your content is very good and you also provide a great explanation!! Keep going!! Also, could you create a tutorial with a RAG agent with this new version of langchain? 😊
@alejandro_ao
@alejandro_ao 4 ай бұрын
thank you man! will do, it's coming soon!
@oooooohmygoood-xu1nm
@oooooohmygoood-xu1nm 4 ай бұрын
"I come from across the ocean, where we lack video tutorials, so I'm really fortunate to have found such high-quality videos. More importantly, I hope everything goes well for the creator😉"
@alejandro_ao
@alejandro_ao 4 ай бұрын
hey there thank you
@rmjjanssen2645
@rmjjanssen2645 4 ай бұрын
Awesome videos….just wondered why you used colab instead of the python runtime environment explained in some video before? Presumably to execute the code samples on the fly? Can you explain when to use either of these? Not sure I totally grasped the Faiss step? Anyhow would love some video’s in future on training your own models and some on the use of hugging face? Keep up the good work
@alejandro_ao
@alejandro_ao 4 ай бұрын
hello there! actually, in the next video i'm showing how to do this with a local python runtime! you're right, the idea behind using a google colab is precisely to execute the code snippets on the fly. also to be able to share the code with you in a single link :) for a real app, you would use your python runtime. the video about that is coming tomorrow!
@neilmcd123
@neilmcd123 3 ай бұрын
Loving the content! Thanks! Also, Can you create this with a streamlit interface?
@alejandro_ao
@alejandro_ao 3 ай бұрын
here you go! Tutorial | Chat with any Website using Python and Langchain (LATEST VERSION) kzbin.info/www/bejne/mKbTqWNuj8yGfMk
@shivamrawat108
@shivamrawat108 2 ай бұрын
Great Tutorial! How can we modify this so that we get context from all the hyperlinks inside a website! Is it possible??
@meetvasa6955
@meetvasa6955 3 ай бұрын
Hey Please upoad the Agent and other stuffs video too , its very helpful!! Also a request to cover Langsmith and Langserve !! Itll give a upperhand
@amineinfo5810
@amineinfo5810 2 ай бұрын
Can we use load qa chain function for RAG ?
@LORENZOARCANGELI-rp4hl
@LORENZOARCANGELI-rp4hl 4 ай бұрын
Really really nice video. What about the create an agent phase?
@alejandro_ao
@alejandro_ao 4 ай бұрын
Thank! Coming soon!
@MyXRLearning
@MyXRLearning 4 ай бұрын
Amazing videos! Would you please do one tutorial about how to bring the data from an API and make a vector store?
@alejandro_ao
@alejandro_ao 4 ай бұрын
thanks! what kind of data would you like to fetch from the API?
@MyXRLearning
@MyXRLearning 4 ай бұрын
@@alejandro_ao Thanks for your reply. I'm looking to fetch data in the form of JSON structures and then go from that to make the vector storage in order to make a RAG about the fetched data. :)
@priyanshuaggarwal9037
@priyanshuaggarwal9037 4 ай бұрын
Could you explain the difference between conversation retrieval chain and retrieval qa chain?? And which is better with a memory component?
@alejandro_ao
@alejandro_ao 4 ай бұрын
hey there. sure. the regular retrieval chain that i built here does not consider the previous messages of the conversation. it's like you were starting a new conversation with every new message. on the other hand, the conversational chain that we built here, takes into account the past messages of the conversation every time. that's why in the example i sent the chat history alongside the message "tell me more about it!". if we send that message to the regular retrieval chain, it will have no idea what we are talking about.
@NavjotMakkar
@NavjotMakkar 4 ай бұрын
How to deploy the conversational retrieval chain using langserve so that I can play around with langserve playground feature. I tried to create the chain specifying input type as- class Input(BaseModel): input: str chat_history: List[BaseMessage] . But I am getting unknown messag type error when it is trying to run the retriever_prompt.
@chibuzoemelike6403
@chibuzoemelike6403 4 ай бұрын
That you so much for this video, please can you create a video of using slack channel or google chat data with LangChain?
@alejandro_ao
@alejandro_ao 4 ай бұрын
no worries! you mean like asking questions about a slack conversation history? or more like a chatbot inside slack?
@chibuzoemelike6403
@chibuzoemelike6403 4 ай бұрын
@@alejandro_ao yeah queries about slack history, this bot can just be outside slack, maybe a web page
@chibuzoemelike6403
@chibuzoemelike6403 4 ай бұрын
@@alejandro_ao Yes asking questions about a channel conversation history. The chatbot can be outside slack or integrated to slack.
@Vedmalex
@Vedmalex 4 ай бұрын
классное видео! есть с чего начать
@alejandro_ao
@alejandro_ao 4 ай бұрын
Спасибо!
@laxmiagarwal3285
@laxmiagarwal3285 Ай бұрын
which model are you using? is it GPT-3.5
@alejandro_ao
@alejandro_ao Ай бұрын
in this video, mostly gpt3-turbo, yes. but you can change that as a parameter when you initialize your LLM
@udaynj
@udaynj 2 ай бұрын
Seems that agents are built on top of langchain chains. So do you need this if you are using agents?
@alejandro_ao
@alejandro_ao 2 ай бұрын
hey there, agents are similar to chains, but they are not actually built on top of them. they use LCEL as well and can perform multi-step procedures, but they are much more flexible. a chain will always have the steps pre-defined (as you see here). an agent will use a LLM to decide the next step to take. i hope this helps!
@udaynj
@udaynj 2 ай бұрын
@@alejandro_ao Thanks Alejandro. That helps. One more question if you don't mind - can you use agents to chain LLM and non-LLM models, since in the real world, not everything will need an LLM model. So say I have a xgboost time series model, but want to interconnect that with an LLM, is that possible? If so, would love to see an example of that
@alejandro_ao
@alejandro_ao 2 ай бұрын
@@udaynj Absolutely! What you would have to do here is, first, decide if you are going to create a chain or an agent. If this is a chain, then you can create a function that applies your time series model and use it inside your chain. In this video, I created a custom function and added it inside a chain (not a ML model, but it would work pretty much the same): kzbin.info/www/bejne/b5TGnWSVjNplarM If you are going for an agent, you will have to create tool that applies that time series model. This would be pretty similar to the function for a chain, but it would be decorated with the decorator @tool by langchain and passed in to your agent. Here is a video where I show how to create a team of agents and create their tools (you would have to create your own function that outputs the prediction of your time series model): kzbin.info/www/bejne/oXO7inmXj5V4hJI cheers!
@udaynj
@udaynj 2 ай бұрын
@@alejandro_ao Thanks for the replies and the video links, Alejandro. Appreciate the detailed responses. You are an amazing teacher. Cheers from the US
@CherifRahal
@CherifRahal 4 ай бұрын
What is the limit of the documents we can train with this method ?
@alejandro_ao
@alejandro_ao 4 ай бұрын
there is virtually no limit! however, for super long knowledge bases, you might need some additional tuning rather than a simple RAG algorithm. this is true especially if you have several thousand pages worth of knowledge and the concepts are scattered across them. i'll make some tutorials on that
@CherifRahal
@CherifRahal 4 ай бұрын
@@alejandro_ao Thanks, I have like word documnets, sharepoint and pdf, I just want to search for something without m ehaving to go through each file, just interact with a simple chat interface. And also I work usually with Vscode, do you think it is good or should I switch to Jupiter ?
@alejandro_ao
@alejandro_ao 4 ай бұрын
Do you prefer that I use Google Colab in the videos or that I create an app with a graphical user interface?
@tonyblack2141
@tonyblack2141 4 ай бұрын
An app with GUI will be most appreciated mate. Thanks
@chibuzoemelike6403
@chibuzoemelike6403 4 ай бұрын
An app will be great
@sanjayojha1
@sanjayojha1 4 ай бұрын
UI will be much better.
@guruprasannasuresh3893
@guruprasannasuresh3893 4 ай бұрын
GUI is the most preferrable and the way you organize and converting into the final product stands out of all. Thanks
@Mercurion42
@Mercurion42 4 ай бұрын
Great video! Would love to see a video with a GUI.
@KARAN_RANA36
@KARAN_RANA36 4 ай бұрын
CSV Was removed how to perform CSV Al in lahgchain now please video
@alejandro_ao
@alejandro_ao 3 ай бұрын
yeah, that video really needs an update. i'm working on it!
@tancheeken
@tancheeken 4 ай бұрын
Personally I find Langchain difficult to use and the documentation is pretty bad. I think Microsoft autogen approach to framework is much better.
@sanjayojha1
@sanjayojha1 4 ай бұрын
The layer of abstraction is really annoying. Have you tried alternatives like llamaIndex and haystack?
@alejandro_ao
@alejandro_ao 4 ай бұрын
LlamaIndex is awesome, i'm preparing some hands-on tutorials on it
@sachinp8847
@sachinp8847 4 ай бұрын
Also create a video explaining the difference between them please
Chat with Multiple PDFs | LangChain App Tutorial in Python (Free LLMs and Embeddings)
1:07:30
Alejandro AO - Software & Ai
Рет қаралды 431 М.
Tutorial | Chat with any Website using Python and Langchain (LATEST VERSION)
1:21:13
Alejandro AO - Software & Ai
Рет қаралды 56 М.
Hot Ball ASMR #asmr #asmrsounds #satisfying #relaxing #satisfyingvideo
00:19
Oddly Satisfying
Рет қаралды 51 МЛН
터키아이스크림🇹🇷🍦Turkish ice cream #funny #shorts
00:26
Byungari 병아리언니
Рет қаралды 18 МЛН
ТАМАЕВ vs ВЕНГАЛБИ. ФИНАЛЬНАЯ ГОНКА! BMW M5 против CLS
47:36
Универ. 10 лет спустя - ВСЕ СЕРИИ ПОДРЯД
9:04:59
Комедии 2023
Рет қаралды 2,1 МЛН
CrewAI Step-by-Step | Complete Course for Beginners
1:07:43
Alejandro AO - Software & Ai
Рет қаралды 42 М.
LangChain Version 0.1 Explained | New Features & Changes
19:13
Alejandro AO - Software & Ai
Рет қаралды 13 М.
Full Python Environment Setup for AI (or other) Apps + Virtual Environments
45:08
Alejandro AO - Software & Ai
Рет қаралды 23 М.
RAG + Langchain Python Project: Easy AI/Chat For Your Docs
16:42
Chat with MySQL Database with Python | LangChain Tutorial
37:11
Alejandro AO - Software & Ai
Рет қаралды 33 М.
LangChain Explained in 13 Minutes | QuickStart Tutorial for Beginners
12:44
Chat with SQL and Tabular Databases using LLM Agents (DON'T USE RAG!)
58:54
Langchain PDF App (GUI) | Create a ChatGPT For Your PDF in Python
39:54
Alejandro AO - Software & Ai
Рет қаралды 159 М.
Hot Ball ASMR #asmr #asmrsounds #satisfying #relaxing #satisfyingvideo
00:19
Oddly Satisfying
Рет қаралды 51 МЛН