Create Custom Tools for Chatbots in LangChain - LangChain #8

  Рет қаралды 37,772

James Briggs

James Briggs

Күн бұрын

Agents are one of the most powerful and fascinating approaches to using Large Language Models (LLMs). The explosion of interest in LLMs has led to agents becoming incredibly prevalent in AI-powered use cases.
Using agents allows us to give LLMs access to tools. These tools present an essentially infinite number of possibilities. With tools, LLMs can search the web, do math, run code, and much more.
The LangChain library provides a substantial selection of prebuilt tools. However, in many real-world projects, we'll often find that there are no tools that quite fit our requirements. Meaning we must modify existing tools or build entirely new ones.
In this video, we will explore how to build custom tools for agents in LangChain.
📌 Code Notebook:
github.com/pinecone-io/exampl...
🌲 Pinecone article:
www.pinecone.io/learn/langcha...
👋🏼 NLP + LLM Consulting:
aurelio.ai
🎙️ Support me on Patreon:
/ jamesbriggs
👾 Discord:
/ discord
00:00 LangChain agents and tools
01:46 What are LLM tools
03:12 Code notebook setup and prerequisites
05:58 Building a simple LangChain calculator tool
05:50 Initialize the conversational agent
10:08 Updating agent prompts
12:14 Building tools with multiple parameters
15:40 Helping ChatGPT understand images
23:05 What else can LangChain agents do
#artificialintelligence #langchain #openai #nlp

Пікірлер: 74
@alperakbash
@alperakbash 6 ай бұрын
Perfect video, thank you so much. Anyone making use of langchain should watch this video to see the opportunities and how easy and simple it is to implement.
@rhiteshkumarsingh4401
@rhiteshkumarsingh4401 Жыл бұрын
Such a freaking coincidence!! I was working on making a custom tool myself and was getting stuck and here you are with a video dedicated to it. Its my lucky day! Thanks a lot!!
@Alain.Robert
@Alain.Robert Жыл бұрын
If you're trying to build something with LangChain, James is always one step ahead and showing us the way.
@jamesbriggs
@jamesbriggs Жыл бұрын
haha good timing, good to hear it helps
@nesdi6653
@nesdi6653 Жыл бұрын
same
@jidun9478
@jidun9478 Жыл бұрын
Thank you for all the insight. I have watched quite a few of your appearances across the web dealing the AI memory spectrum etc and just wanted to say thanks for your work in this matter 😃
@mysticaltech
@mysticaltech Жыл бұрын
Super interesting, and now a lot of videos dive that deep! Thanks James, really appreciate it.
@subodh.r4835
@subodh.r4835 Жыл бұрын
AMAZING work. Can't wait to build something incredible with this.
@jamesbriggs
@jamesbriggs Жыл бұрын
awesome, you should share it with us in discord or twitter when you do :)
@emanahmed4394
@emanahmed4394 Жыл бұрын
really fascinating to see how AI agents can be integrated with custom tools for language models. Your Jupyter
@code-grammardude5974
@code-grammardude5974 Жыл бұрын
This is SOOO cool. Can't wait to get going with this. Integrating this even with home automation APIs would be epic
@0ptim
@0ptim Жыл бұрын
Thank you so much. Your videos are invaluable! Please more content about LangChain, agents, tools, and everything around this topic.
@jamesbriggs
@jamesbriggs Жыл бұрын
100% will do
@init5god
@init5god Жыл бұрын
This is amazing James! Thanks for sharing so much. This open a very big door for me and the exploration I'm currently working on using AI models
@jamesbriggs
@jamesbriggs Жыл бұрын
that's awesome, glad to hear!
@nicolasstegmann5855
@nicolasstegmann5855 Жыл бұрын
Thanks a lot for your work James. It has been really useful for me.
@mikemansour1166
@mikemansour1166 Жыл бұрын
really fascinating to see how AI agents can be integrated with custom tools for language models. Your Jupyter Notebook tutorial was super helpful and I appreciate the time and effort you've put into creating this content. As a beginner, I'm finding it a bit challenging to deploy these AI chatbots, especially when it comes to integrating them with a GUI, like React or other tools. I would love to see a video on that topic, as I believe it would be beneficial for many of us who are new to this field. Thanks again for the amazing content, and I look forward to learning more from your future videos!
@easzyprogramming
@easzyprogramming Жыл бұрын
streamlit
@mikemansour1166
@mikemansour1166 11 ай бұрын
@@easzyprogramming Thanks for the hint
@robxmccarthy
@robxmccarthy Жыл бұрын
Appreciate your work - you're a great teacher.
@hiranga
@hiranga Жыл бұрын
Legend! Great stuff James🙌🏾
@Kevgas
@Kevgas Жыл бұрын
Awesome! Thanks for sharing!
@dusanbosnjakovic6588
@dusanbosnjakovic6588 Жыл бұрын
Great videos! I would love to see a video on different agent types. This area is not covered that well out there but that seems to be the biggest difference between different awesome systems that are coming out like baby GPT and hugging GPT. I'd love to know how to plug & play them and what exactly is the difference between them.
@Mankind5490
@Mankind5490 10 ай бұрын
Thank you! very easy to follow code
@user-df4wr8li3e
@user-df4wr8li3e 9 ай бұрын
Great videos!
@crisgath3512
@crisgath3512 Жыл бұрын
I love your content and have learned so much from your work. And those shirts...!! I love the collection. 🏅
@jamesbriggs
@jamesbriggs Жыл бұрын
thanks man!
@ArchAid1
@ArchAid1 Жыл бұрын
I LOVE this! 🤩
@Evox402
@Evox402 Жыл бұрын
Hey James, thank you very much for your videos :) They really helped me to get a basic understanding in the ever evolving GPT jungle, keep it up! But I also have a Video request: Could you explain how these Tools/Agents work behind the scenes? Like: - What is the final prompt that is issued to the GPT (with available tools, formatting etc.) - What is the answer from the GPT? - How is the answer parsed to identify that a tool should be used - How are the tool parameters extracted from the GPT answer and given to the actual Python code - How is the answer given back? - Maybe, how could you make it so certain Agents talk to each other before returning to the main GPT prompt? It looks like the GPT is instructed to indicate tool usage by using json format? But I'm not sure. Maybe an in-depth explanation would help clear the fog for me (and possibly some others) Thanks! :)
@midnightmoves7976
@midnightmoves7976 Жыл бұрын
Nice, thanks
@shamaldesilva9533
@shamaldesilva9533 Жыл бұрын
Dude your reading our minds 🤖 🤯
@memesofproduction27
@memesofproduction27 Жыл бұрын
Got that early access to GPT-5 ESPplugin
@chocky_1874
@chocky_1874 Жыл бұрын
thanks
@AI_Financier
@AI_Financier Жыл бұрын
Thanks for the info, on image captioning, why are we plugging it into the LLM, what does the LLM bring on?
@AdrienSales
@AdrienSales Жыл бұрын
Very kind intro to tools, now I know how I'll release mine : would there be like a pypi repo for langhcain tool ?
@lordmelbury7174
@lordmelbury7174 Жыл бұрын
This is one of the most useful videos I have seen on AI. *I had an error with latest version of LangChain, but this solved it: pip install --force-reinstall -v langchain==v0.0.147 One thing that I am thinking is to be able to accept lightning payments per search, eg micropayments of Satoshis per search to make a public facing site.
@magick93
@magick93 Жыл бұрын
Regarding tools with multiple inputs, if not enough inputs are initially provided, can the chat agent ask the human to supply more info?
@PazLeBon
@PazLeBon Жыл бұрын
im not sure ive actually seen a single tool yet that has actually made me more productive, i just write faster
@Cbon-xh3ry
@Cbon-xh3ry Жыл бұрын
Hey James very similar to what we’ve seen in the past as far as I can tell using tools. Quick question to you, how does langchain works internally with the new prompt and the tool it has, does it make it so when it asks ChatGPT that one returns a completion that says it can’t do it and that’s what langchain looks for to know it needs to use tools in its list ?
@olivert.7177
@olivert.7177 Жыл бұрын
The format the response should have and the tools with its descriptions are in the original prompt that is given to the LLM. The LLM then return the instruction to use a tool and the parameters as the output. Langchain only checks the response of the LLM if it needs to forward it to a tool.
@peterball8900
@peterball8900 Жыл бұрын
Can we stack agent on top of each other just like agent as a tool ? Please suggest
@RedCloudServices
@RedCloudServices Жыл бұрын
James can you make a video with custom chart with x or y axis as inputs?
@Bubbalubagus
@Bubbalubagus Жыл бұрын
But how is the LLM "using" the tool, how does it break its text output to switch to using a python function and then switch back to text?
@ScottzPlaylists
@ScottzPlaylists Жыл бұрын
Video Idea: I would like to see a video on how to classify files from the filenames ( video title from youtube) in an input folder, and put them into a different folders subfolders where the name of the subfolders is the classification list to sort them into. (ex. AI, AI LLMs, AI Art, AI Tools, Health, FPGA, Crypto, etc) I'll use this to classify videos I've downloaded, into categories that I'll watch later by category. = A similar thing would be to classify screenshots from videos I watch into a similar categories of subfolders like above example, but the text to classify would have to come from OCR of the Images because the filename is not descriptive.
@chuanjiang6931
@chuanjiang6931 5 ай бұрын
Is there a way to let agent return what _run function returns?
@6ptech-vy3uc
@6ptech-vy3uc Жыл бұрын
Can you create some videos using Apichain and Chainpal to interact with external APIs?
@kevon217
@kevon217 Жыл бұрын
very cool. orangutans are apes though, not monkeys. any ideas on implementing some sort of double checking to verify a model’s prediction and confidence in this type of application?
@JonathanYankovich
@JonathanYankovich Жыл бұрын
Tangentially related; pre/post prompts use tokens and tokens are precious in 2048 context length. Are people talking about how to make per-prompts more compact? Could you do a video on how to write compact pre-prompts or if this is even important? In your example, you say “Unfortunately, assistant is terrible at maths.” Could tokens be saved if this was written as “assistant must not do math, use tools instead” or “assistant always uses tools to do math”?
@ijhake
@ijhake Жыл бұрын
It's not Langchain related, but what tools are you using for drawing your illustrations?
@jamesbriggs
@jamesbriggs Жыл бұрын
excalidraw - it's really good and I think they still have a free tier
@RatafakRatafak
@RatafakRatafak Жыл бұрын
Why don’t we have to edit the sys_msg for image captioning task, if we had had to do it for math calculations?
@josephturbin9087
@josephturbin9087 Жыл бұрын
Probably because the LLM knew it didn’t have that ability. With the math example the LLM was confident that it could do the math by itself. With image captioning, it knows it needs help.
@RatafakRatafak
@RatafakRatafak Жыл бұрын
@@josephturbin9087 How do I know in general which task the llm is confident about and which not?
@josephturbin9087
@josephturbin9087 Жыл бұрын
Great question that I’m only guessing at an answer for. My guess is that each model has it’s strengths and weaknesses and you’d need to consult the model documentation or videos online to find out what they are. Or maybe you experiment with the models and come to the conclusion yourself that it needs a tool to handle the task because the answer it’s giving is wrong. Kind of like the math example. It spit out the wrong answer so clearly it needs help from a tool and you might need to remind it via the system message.
@jamesbriggs
@jamesbriggs Жыл бұрын
yeah what Joseph said - it's less confident in it's ability to caption images, so it's easier to avoid hallucinations with that tool Best way to figure it out is to test, it's very hard (if not impossible) to predict how an LLM is going to behave, so testing is the way to go
@bolivianprince7326
@bolivianprince7326 11 ай бұрын
How to set Scrapy as a tool instead of the default SerpApi?
@DavidRodriguez-sh9cq
@DavidRodriguez-sh9cq Жыл бұрын
Is it possible to create an agent with an input? Let's say a pandas dataframe? I know that there is already a pandas dataframe agent, but it does not allow to modify its prompt.
@buksa7257
@buksa7257 7 ай бұрын
i actually have problems letting the agent NOT use tools when it's not necessary. He just always wants to use tools for everything. I dont have that initial prompt with "assistant is a large language model trained by open ai..." Where can i find and copy this text?
@exclusivemedia3889
@exclusivemedia3889 Жыл бұрын
Join the $Psyop coin community and be part of a movement that's pushing the boundaries of psychology and blockchain technology. Together, we can drive meaningful change in the mental health landscape. #JoinTheMovement #PsyopCoinCommunity"
@RatafakRatafak
@RatafakRatafak Жыл бұрын
So what this is basically doing is expecting alignment between tool’s description and user input for the chatbot.
@jamesbriggs
@jamesbriggs Жыл бұрын
yeah that's a good way of thinking about it
@alii4334
@alii4334 Жыл бұрын
the name `chat-conversation-react-description` confused me a lot as React developer
@jamesbriggs
@jamesbriggs Жыл бұрын
ha yeah I didn't think about that 😅
@chuanjiang6931
@chuanjiang6931 9 ай бұрын
If you change 'radius' to 'diameter', it still got 49.07mm.
@texasfossilguy
@texasfossilguy 8 ай бұрын
youd have to change the formula, its just creating a parameter named Radius, you could call it Flubflub and itd still process it the same. Remove the "2*" radius to change the formula to be for diameter.
@frankbee9831
@frankbee9831 Жыл бұрын
Human: How can I distract from my baldness? AI: Put on a shirt with a low neckline so that your chest hair is clearly visible and accentuate your masculine beard growth.
@jamesbriggs
@jamesbriggs Жыл бұрын
I will say - I did start wearing the shirts around the time chat-gpt came out
@frankbee9831
@frankbee9831 Жыл бұрын
@@jamesbriggs I was just trolling around. It looks great! And you are a very handsome guy .. and apparently very smart too :) Thanks for the good content!
@stanTrX
@stanTrX 18 күн бұрын
James, it started good but then gets too complicated and difficult to follow
@StephenRayner
@StephenRayner Жыл бұрын
You interested in collaborating?
@dfadir
@dfadir Жыл бұрын
Poor LLMs, we have to gaslight them so they use the tools haha Forgive us Machine God
@jamesbriggs
@jamesbriggs Жыл бұрын
Pray GPT-5 have mercy on us 🙏
@dfadir
@dfadir Жыл бұрын
@@jamesbriggs 🙏
@ScottzPlaylists
@ScottzPlaylists Жыл бұрын
I have a gread Idea you could code. Here's my idea for "Offline AI DVR for KZbin" Have an input folder of Files to Classify by the filenames that are the title of the youtube video called Input_Folder Have a Output_Folders directory, where the Subfolder Names under Output_Folders are the Classes to train a neural net, to specify where the files should be copied to. I already have this setup and lots of youtube videos already manually moved into the Subfolders. This could be used to train the classifier. once trained I'd like to run the classifier on each filename in Input_Folder, the classifier would tell me the folder name to copy it to (I would call it Folder_Destination). Python would copy the file to \{Output_Folders}\{Folder_Destination. This would be an awsome little AI to organize files when you already have started the organizing. I use a nice little tool called "WinX KZbin Downloader" to get the files I've put in a public folder named like "12"(the Date I started a new download list) as I browse KZbin, I "Save to Playlist" and put it in "12" to put on my HD Later. WinX even puts them in a folder called "12 in this example. Then when I'm ready to Download and organize I copy the URL of the Playlist, paste it into Winx and it gets all the video files and puts them in "12". Then there's the long process of organizing them into categories on my HD like described above, so I can view Videos by catagory at my leisure. ( I used to be Offline most of the time, there was a method to my madness to get lots of videos for watching later). See all my Playlist names, and you can see I have a lot of interests. I keep the best videos by category on youtube playlists. It would be so nice to have the program I described and it would be the main component in a larger program later that would be like an Offline AI DVR for KZbin. Thanks for reading this long post, hope you whip up the code as a better programmer than me!
Build Conversational Agents with Vector DBs - LangChain #9
18:45
James Briggs
Рет қаралды 37 М.
LangChain Agents Deep Dive with GPT 3.5 - LangChain #7
32:17
James Briggs
Рет қаралды 56 М.
Шокирующая Речь Выпускника 😳📽️@CarrolltonTexas
00:43
Глеб Рандалайнен
Рет қаралды 11 МЛН
The delivery rescued them
00:52
Mamasoboliha
Рет қаралды 9 МЛН
СНЕЖКИ ЛЕТОМ?? #shorts
00:30
Паша Осадчий
Рет қаралды 1,9 МЛН
ChatGPT Plugins: Build Your Own in Python!
41:06
James Briggs
Рет қаралды 143 М.
LangChain Agents: Simply Explained!
9:35
Rabbitmetrics
Рет қаралды 59 М.
Chat with Multiple PDFs | LangChain App Tutorial in Python (Free LLMs and Embeddings)
1:07:30
Alejandro AO - Software & Ai
Рет қаралды 426 М.
Building Custom Tools and Agents with LangChain (gpt-3.5-turbo)
16:48
LangGraph 101: it's better than LangChain
32:26
James Briggs
Рет қаралды 45 М.
Chatbots with RAG: LangChain Full Walkthrough
35:53
James Briggs
Рет қаралды 127 М.
An Introduction to LLM Agents | From OpenAI Function Calling to LangChain Agents
31:44
keren sih #iphone #apple
0:16
Muhammad Arsyad
Рет қаралды 763 М.
iPhone 12 socket cleaning #fixit
0:30
Tamar DB (mt)
Рет қаралды 26 МЛН
5 НЕЛЕГАЛЬНЫХ гаджетов, за которые вас посадят
0:59
Кибер Андерсон
Рет қаралды 1,5 МЛН
#miniphone
0:16
Miniphone
Рет қаралды 1,9 МЛН
Карточка Зарядка 📱 ( @ArshSoni )
0:23
EpicShortsRussia
Рет қаралды 709 М.