LangChain is AMAZING | Quick Python Tutorial

  Рет қаралды 62,511

ArjanCodes

ArjanCodes

Күн бұрын

LangChain is a great Python library for creating applications that communicate with Large Language Model (LLM) APIs. In this tutorial, I’ll show you how it works and also discuss its design
👷 Join the FREE Code Diagnosis Workshop to help you review code more effectively using my 3-Factor Diagnosis Framework: www.arjancodes.com/diagnosis
💻 ArjanCodes Blog: www.arjancodes.com/blog
🐱💻 Git repository: git.arjan.codes/2023/langchain
✍🏻 Take a quiz on this topic: www.learntail.com/quiz/cancrx
🎓 Courses:
The Software Designer Mindset: www.arjancodes.com/mindset
The Software Architect Mindset: Pre-register now! www.arjancodes.com/architect
Next Level Python: Become a Python Expert: www.arjancodes.com/next-level...
The 30-Day Design Challenge: www.arjancodes.com/30ddc
🛒 GEAR & RECOMMENDED BOOKS: kit.co/arjancodes.
👍 If you enjoyed this content, give this video a like. If you want to watch more of my upcoming videos, consider subscribing to my channel!
Social channels:
💬 Discord: discord.arjan.codes
🐦Twitter: / arjancodes
🌍LinkedIn: / arjancodes
🕵Facebook: / arjancodes
📱Instagram: / arjancodes
♪ Tiktok: / arjancodes
👀 Code reviewers:
- Yoriz
- Ryan Laursen
- Dale Hagglund
🎥 Video edited by Mark Bacskai: / bacskaimark
🔖 Chapters:
0:00 Intro
0:42 LangChain Tutorial
12:23 LangChain’s design
15:58 Final Thoughts
#arjancodes #softwaredesign #python
DISCLAIMER - The links in this description might be affiliate links. If you purchase a product or service through one of those links, I may receive a small commission. There is no additional charge to you. Thanks for supporting my channel so I can continue to provide you with free content each week!

Пікірлер: 70
@ArjanCodes
@ArjanCodes 8 ай бұрын
👷 Join the FREE Code Diagnosis Workshop to help you review code more effectively using my 3-Factor Diagnosis Framework: www.arjancodes.com/diagnosis
@NGrimthrie
@NGrimthrie 10 ай бұрын
This is great. Would you consider doing a video on ways to extend the models beyond their training cutoff dates? Possibly using vector databases and LangChain's document parsers?
@tylerchism134
@tylerchism134 10 ай бұрын
Yes! I second this request.
@munteanionut3993
@munteanionut3993 10 ай бұрын
second it second, 2
@jumper0122
@jumper0122 10 ай бұрын
I must have missed that survey -- I would love to see more content about databases and best-practices with them. Like using SQLAlchemy efficiently and whatnot. I do a lot of web scraping and it was only this year that I graduated from heinously large JSON files to proper databases
@TNothingFree
@TNothingFree 10 ай бұрын
Fantastic cover. A. it shows how complex it is, you need to understand the API correctly to make the maximum out of it. B. I just can imagine what it can do with many products, every app/web site can integrate such automatic tools which may generate ton of content. My favorite are infinite dungeon crawlers.
@paulomtts
@paulomtts 10 ай бұрын
Very interesting. Thanks for the video!
@melvingeorge2729
@melvingeorge2729 10 ай бұрын
wow! this is phenomenal :) thanks, Arjan! Also, which are the books in the shelf behind you?
@pypypy4228
@pypypy4228 Ай бұрын
This is a paragon of explanation: succinct and to the point, gradually increasing the difficulty, with an apt digression into principles and design patterns. I would love to see YOUR tutorials about LCEL - langchain chain expression language. I don't grasp the concept of RunnablePassthrough and nobody seems to explain it the way you explain the Python magic. ❤
@user-lo1ie3tz4b
@user-lo1ie3tz4b 10 ай бұрын
can not wait for your long-chain tutorials.
@aungkyawkyaw9114
@aungkyawkyaw9114 10 ай бұрын
Do all the more on all topics please. Never stop.
@drag0zu
@drag0zu 10 ай бұрын
Great video, i would really like to see how a Database Content + Model can be integrated into an LLM application (can be also GPT4all i think), so users can then ask stuff about the DB content.
@animelover5093
@animelover5093 7 ай бұрын
Been thinking about this as well recently 🤔
@TacticalTruth
@TacticalTruth 10 ай бұрын
Looks perfect for Data Cleaning and Record Linkage.
@default_youtube_profile
@default_youtube_profile 10 ай бұрын
Hello Arjan, What keyboard are you using ?
@MicheleHjorleifsson
@MicheleHjorleifsson 10 ай бұрын
Please Please do one on embeddings :)
@torstenschindler1965
@torstenschindler1965 10 ай бұрын
Hi Arjan, what’s your take on Max Woolf’s Blog: “The Problem with Langchain” ? Loading the environment variables via the os module is not necessary. It is done in the ChatOpenAI class anyhow.
@ivanherreros7773
@ivanherreros7773 10 ай бұрын
Wow. I truly like Arjan's content, spirit, everything. But I have to admit that the post that you've linked here is (I am very sorry to say) of more value to me than the video itself. Indeed, it reflects my issues when I was trying to tweak a "RAG" demo in LangChain to my use case. Namely, asking myself, "what is all this complexity good for?". The post answers: for nothing, really. I think that the ones who enjoyed Software Engineering content in this channel will be more inclined to see what concepts are very useful in LangChain, and then reimplement them ourselves (or find a leaner framework- it must exist somewhere). So, Arjan, if you read this, please take it as constructive criticism. And I will of course stay subscribed :)
@jeffrey5602
@jeffrey5602 10 ай бұрын
I actually enjoy the original python content the most. Especially in this AI craze I try to avoid AI content from people who weren't doing AI content before all the hype, no fence. But your great python content is what I subscribed for :)
@TheVengeful0ne
@TheVengeful0ne 10 ай бұрын
same. Unsubscribing for now. He has mentioned that he gets a lot more views from these type of videos so expect more from him. =/ Feels bad to see this kind of content from Arjan as someone who is working as a tech lead in the AI space. Stick to content you are great at please. Don't try to milk the hype and alienate your original subscribers by going into an area which you have superficial knowledge or a very narrow perspective/understanding about. Encouraging the use of a very opaque + opinionated framework that you have very little control over and has a very brittle foundation just doesn't work out well in production and is a bad idea.
@jeffrey5602
@jeffrey5602 10 ай бұрын
@@TheVengeful0ne As a mid data scientist with a focus on NLP I could not agree more. I am watching the channel to get better at SWE. Also from what I have seen there have not been much useful applications for any of the "openai wrapper" and related tech. For most use cases I can see in my company it would be wasteful to actually use openai apis and using smaller HF models makes way more sense. Noone without an actual PyTorch/TF background should touch those use cases though.
@aniketgninawe4963
@aniketgninawe4963 10 ай бұрын
I am working with CSV data and using create_csv_agent, looks like its facing difficulty with complex queries, any solution? Thanks
@InglesConConfianza
@InglesConConfianza 10 ай бұрын
Great tutorial!
@ArjanCodes
@ArjanCodes 10 ай бұрын
Thank you!
@fuba44
@fuba44 10 ай бұрын
But can you run your own models? Like can I download the llama 2 from huggingface, and query it using langchain?
@jakecyr
@jakecyr 10 ай бұрын
You can! You can extend the LLM class and add your own implementation for any custom model.
@moondevonyt
@moondevonyt 10 ай бұрын
mad props for diving deep into Langchain however, the real game changer for me would be direct integration with modern frameworks still, your explanations? on point always appreciate the effort you put in, but there's always room to elevate
@JohnWalz97
@JohnWalz97 10 ай бұрын
What do you mean direct integration with modern frameworks?
@midprogramming
@midprogramming 9 ай бұрын
I'm not too sure what he means either considering Jason Zhou and multiple researchers on Twitter already have integrated Langchain into real world products... @@JohnWalz97
@PatrioticBastard
@PatrioticBastard 10 ай бұрын
can you visualize your keystrokes so we know what shortcuts youre using?
@adrianobleton
@adrianobleton 10 ай бұрын
I actually have a lot of trouble following the langchain model. For example, it's not clear to me why you use a human prompt and a system prompt in the country example. Wouldn't the system prompt alone be sufficient? For my use cases, doing a thin wrapper around the chat gpt calls is sufficient. I do use the system prompt templates though for the initial context messages.
@berdgg
@berdgg Ай бұрын
Its so overly complicated. You initiate so many classes, call so many methods, and then realize at the end it just constructed a big string and called a simple API...
@adrianzuur5589
@adrianzuur5589 10 ай бұрын
One of the things about LangChain that irritates me is how when you use the ConversationChain class with memory to communicate with GPT>=3.5, it DOES NOT use the chat completion endpoint OpenAI has. Instead, it uses simple completion, formatting all of the messages in the history into a single string. I suppose this is because they want the ConversationChain to work with all sorts of LLMs, including those without a chat completion mode, but... it's not the behavior you would expect for GPT>=3.5.
@davidyoung623
@davidyoung623 10 ай бұрын
That is how the regular API endpoint functions as well 🤔 You have to send prior messages as part of your API call, or the endpoint doesn't know about them either 🤷
@manomancan
@manomancan 10 ай бұрын
I think it's a straight-up bug!
@frazuppi4897
@frazuppi4897 10 ай бұрын
langchain is actually (all love to the creator)a OOP hell and not really good
@Lanc840930
@Lanc840930 10 ай бұрын
I agree
@oc3academy
@oc3academy 10 ай бұрын
I couldn't igree more
@PmmSoares
@PmmSoares 10 ай бұрын
Ya, is very confusing and documentation doesn't help. There's any alternative?
@judgelaloicmoi
@judgelaloicmoi 8 ай бұрын
Llamaindex ?
@chriskeo392
@chriskeo392 8 ай бұрын
Maybe too advanced for you?
@pypro
@pypro 10 ай бұрын
Dude you are amazing! thanks for the content, really good to get a "best practices" view on all of these topics! thanks so much, greetings from México! let me know when you come to the caribbean (mexican) I will buy you some drinks!!
@RedCloudServices
@RedCloudServices 9 ай бұрын
Is it possible to chat with langchain documentation? How would you train an LLM using Langchain documentation?
@morrischoga1581
@morrischoga1581 7 ай бұрын
Brain Usage : 100%
@malgindesilva2758
@malgindesilva2758 10 ай бұрын
This is very simple yet informative into Ajan, love your videos
@svaponi
@svaponi 3 ай бұрын
Does anybody have the transcript of the code? git repo maybe?
@Benemortasia666
@Benemortasia666 10 ай бұрын
Goud
@VolodymyrInTech
@VolodymyrInTech 10 ай бұрын
💛💙👍
@nuurnwui
@nuurnwui 3 ай бұрын
When this video came out, I didn’t understand it. Now I do, but to me it means Arjan wasn’t quite as good at explaining as usual. Please do more on Langchain or related technologies.
@torbjrnwikestad28
@torbjrnwikestad28 9 ай бұрын
Discord invite didn't work.
@pipi_delina
@pipi_delina 10 ай бұрын
Can you explain llama
@thezachdrake
@thezachdrake 3 ай бұрын
I didn't know John Greene knew how to code.
@BorrWick
@BorrWick 10 ай бұрын
Langchain is so bad what are you saying 😅
@Ringoshiiro
@Ringoshiiro 10 ай бұрын
Why is it bad?
@TheVengeful0ne
@TheVengeful0ne 10 ай бұрын
yeah. A lot of people (myself included) have moved away from using it in production in our companies too because outside of its data/platform connectors it is just way too restrictive and has too many layers of unneeded abstractions for even very simple stuff. Pretty disappointing to see it being promoted here.. but hey as a content creator it makes sense to make content about the most popular thing out there. Like he mentioned in another comment here, he gets more viewers making these kinds of videos >.> ​ @Ringoshiiro you can easily find a lot of threads complaining about using it in prod on hackernews. There are also 2 very detailed articles from the Buzzfeed AI team diving into details of the problems langchain has
@Piipolinoo
@Piipolinoo 10 ай бұрын
Please no more AI content :( the fucking space is flooded by it. it was nice having at least you talk about other stuff. please please please no more ai crap
@ArjanCodes
@ArjanCodes 10 ай бұрын
It looks like the majority of viewers disagree with you. Whenever I cover AI on the channel, the views are higher than on my other videos. I do try to keep a balance between different types of content - the last video covering AI stuff was several weeks ago.
@Piipolinoo
@Piipolinoo 10 ай бұрын
@@ArjanCodes haha I totally get it, i just wanted to be the loud minority ;) Keep up the good work!
@ArjanCodes
@ArjanCodes 10 ай бұрын
No worries, and will do 😊
@Vanessa-vz5cw
@Vanessa-vz5cw 10 ай бұрын
​@@ArjanCodes One thing that I think would be super interesting to do that is still very related to AI but a little more general is a more general ML modelling tutorial or video that is slightly lower-level. One thing I'd love to see your take on is how to best structure code that uses mlflow (maybe fine do hugging face language model or something to still generate interest from the LLM crowd). I work in machine learning and mlflow is widely, but I have yet to see someone implement it while following the programming principals you explain so well on this channel. It seems to be often called out of no where during feature engineering, model training, etc. to log metadata, which makes it quite hard to test and also keep track of where it's being called and what it's logging.
@PostMasterNick
@PostMasterNick Күн бұрын
qq. what is a `ticktoken_model_name" @ 3:21
@ermalai
@ermalai 4 ай бұрын
I get Country is not a subclass of BaseModel, though I inherited frm BaseModel in the definition. why? raise validation_error pydantic.v1.error_wrappers.ValidationError: 1 validation error for PydanticOutputParser pydantic_object subclass of BaseModel expected (type=type_error.subclass; expected_class=BaseModel)
@edbeds
@edbeds 3 ай бұрын
Me too, did you find a solution?
@ermalai
@ermalai 4 ай бұрын
I even tried with your exact code, I still get the same error
@imaderraiss1609
@imaderraiss1609 10 ай бұрын
arjaound. god no.
When to (Not) Use Dunder Methods?
20:37
ArjanCodes
Рет қаралды 29 М.
What is LangChain?
8:08
IBM Technology
Рет қаралды 149 М.
A pack of chips with a surprise 🤣😍❤️ #demariki
00:14
Demariki
Рет қаралды 41 МЛН
🍕Пиццерия FNAF в реальной жизни #shorts
00:41
MEU IRMÃO FICOU FAMOSO
00:52
Matheus Kriwat
Рет қаралды 13 МЛН
New Features You Need To Know In Python 3.12
12:04
ArjanCodes
Рет қаралды 177 М.
Python RAG Tutorial (with Local LLMs): AI For Your PDFs
21:33
pixegami
Рет қаралды 113 М.
Building Production-Ready RAG Applications: Jerry Liu
18:35
AI Engineer
Рет қаралды 267 М.
Building a self-corrective coding assistant from scratch
24:26
7 Tips To Structure Your Python Data Science Projects
14:49
ArjanCodes
Рет қаралды 111 М.
The LangChain Cookbook - Beginner Guide To 7 Essential Concepts
38:11
Greg Kamradt (Data Indy)
Рет қаралды 329 М.
5 Design Patterns That Are ACTUALLY Used By Developers
9:27
Alex Hyett
Рет қаралды 188 М.
Python 101: Learn the 5 Must-Know Concepts
20:00
Tech With Tim
Рет қаралды 1 МЛН
LangGraph 101: it's better than LangChain
32:26
James Briggs
Рет қаралды 49 М.
A pack of chips with a surprise 🤣😍❤️ #demariki
00:14
Demariki
Рет қаралды 41 МЛН