LangChain Tutorial (Python) #6: Self-Reasoning Agents with Tools

  Рет қаралды 6,462

Leon van Zyl

Leon van Zyl

Күн бұрын

#openai #langchain
Agents are one of the most important features of Langchain and extremely fun to use.
We can give our agent an instruction, and it will use the power of LLM's and Tools to figure out the actions to take, the sequence of events and then use tools the achieve it's goals.
☕ Buy me a coffee:
www.buymeacoffee.com/leonvanzyl
📑 Useful Links:
Langchain Python docs: python.langchain.com/docs/get...
Source Code: github.com/leonvanzyl/langcha...
Langsmith: www.langchain.com/langsmith
Tavily Search API: app.tavily.com/home
💬 Chat with Like-Minded Individuals on Discord:
/ discord
🧠 I can build your chatbots for you!
www.cognaitiv.ai
🕒 TIMESTAMPS:
00:00 - Intro
00:22 - Project setup
01:40 - Prompt Agent Scratchpad
02:59 - Agent Types
03:21 - Creating our agent
03:50 - Create agent executor
04:41 - Add Tavily Search Tool
05:08 - Tavily API Key
05:52 - Langsmith
06:53 - Adding chat history
09:28 - Add Retriever as Tool
11:38 - Create retriever tool

Пікірлер: 44
@leonvanzyl
@leonvanzyl 5 ай бұрын
Let me know how you plan on using agents in your projects 😎
@ahassan7270
@ahassan7270 5 ай бұрын
Do you Know that you have a WONDERFUL style in communicating the information?. You are Superman. You make difficult things very easy to understand.Thank you so much for your effrost and sgaring such valuble presenation.👏👏
@leonvanzyl
@leonvanzyl 5 ай бұрын
Thank you for the supportive message. Glad I could help
@junkitchong5632
@junkitchong5632 4 ай бұрын
Best tutorial by far in KZfaq. Informative yet precise. Thanks!
@leonvanzyl
@leonvanzyl 4 ай бұрын
Wow, thank you!
@beemerrox
@beemerrox Күн бұрын
I have to agree with other ppl here, your choice of materials and the format you deliver is the best 👍
@leonvanzyl
@leonvanzyl Күн бұрын
Wow, thank you!
@CharlesFinneyAdventure
@CharlesFinneyAdventure 5 ай бұрын
you have the best courses on KZfaq so Grateful
@leonvanzyl
@leonvanzyl 5 ай бұрын
Thank you Charles 🙏
@jatiquep5543
@jatiquep5543 25 күн бұрын
This is much more better than even Udemy courses and other paid courses......I could not understand the langchain docs... But it seems I would be able to call myself an AI developer now ❤❤❤
@leonvanzyl
@leonvanzyl 25 күн бұрын
Amazing comment, thank you!!
@jcneto25
@jcneto25 5 ай бұрын
In the first lessons, I made an app to scrape the news section of a federal agency. Based on the news list, I tried to submit a pre-defined question (if some target subject is on the news list), but the result was disappointing (even with several prompt options). Now, using an agent with Tavily search, the accuracy of the results has gotten much better. Thank you once more for sharing!
@leonvanzyl
@leonvanzyl 5 ай бұрын
It's possible that you didn't scrape all the pages that you needed perhaps, or your chunk size was too small. Tavily is simply doing an online search, as aposed to scraping. Glad you found a solution that works for you though 👍.
@altonjones5271
@altonjones5271 5 ай бұрын
Fantastic work again Leon - I got my RAG agent working with Qdrant online vector store. Now to add more tools and see what else we can do!
@leonvanzyl
@leonvanzyl 5 ай бұрын
That's awesome!
@Aidev7876
@Aidev7876 5 ай бұрын
Long term I'll build a customer support tool. Based on the issu reported by thr customer, or the request, execute a different tool...can't say more lol
@leonvanzyl
@leonvanzyl 5 ай бұрын
@@Aidev7876 that really is the perfect use case for these AI assistants.
@user-ln4jr7if2b
@user-ln4jr7if2b 5 ай бұрын
Great series Leon, thoroughly enjoying it.
@leonvanzyl
@leonvanzyl 5 ай бұрын
You're welcome 🤗
@kartiksaha5826
@kartiksaha5826 5 ай бұрын
Please make more videos on other topics of langchain . Your videos are very helpful
@leonvanzyl
@leonvanzyl 5 ай бұрын
I will, and working on them 😁. Anything specific you would like to see?
@plendlhendl2
@plendlhendl2 Ай бұрын
Great video, thank you! short note: at 10:45 it should be vectorStore = FAISS.from_documents(splitDocs, embedding=embedding)
@akbarbakhshi1873
@akbarbakhshi1873 5 ай бұрын
Super useful tutorial. I am a recent subscriber and have been learning a lot from you. Quick question, about agents. Did you ever get an error that max context length exceeded. I am getting that with the agent 🤔
@leonvanzyl
@leonvanzyl 5 ай бұрын
Thank you. That means that your prompt is too big based on the model you're using. You have a few options. First, ensure you're not passing in a massive prompt. If you're fetching data from a document, ensure that you split it into smaller chunks. You could try to increase the max token size on the model. Or select a model with a larger context length (worst case).
@fengshi9462
@fengshi9462 3 ай бұрын
Excellent work! I just wanna to further improve this case. if the tools chosen cannot provide the needed answer, then the supervisor will turn to another tool for help. i think this maybe more useful.
@kannamor1706
@kannamor1706 4 ай бұрын
Thank you! Awesome videos here!
@leonvanzyl
@leonvanzyl 4 ай бұрын
Thank you!
@HyperUpscale
@HyperUpscale 5 ай бұрын
This is an amazing video - super useful! Is it possible to add few seconds only (maybe to the next video) to explain what we need to do if we are using ollama, instead of OpenAI?
@leonvanzyl
@leonvanzyl 5 ай бұрын
It'll take a bit longer than a few seconds but we will have a look at Open Source models 😁. You need to set your expectations though. Working in industry, I've seen companies ditch open source for OpenAI for many reasons. I highly recommend learning OpenAI if you plan to build a business / career out of this.
@Cloudways-AI
@Cloudways-AI 5 ай бұрын
Excellent comment, trying to convince anyone without any knowhow that there is something better than OpenAI will take a great salesman. Great work@@leonvanzyl
@rogerwmwong
@rogerwmwong 2 ай бұрын
One question at 2:50 of the video, "from langchain.agents import create_openai_functions_agent, ...", is there any equivalent function of "create_openai_functions_agent" for groq?
@khalidkifayat
@khalidkifayat 5 ай бұрын
amazing video leon, when are u using Streamlit as UI for better output view ?
@leonvanzyl
@leonvanzyl 5 ай бұрын
Haha, you know me too well. I was planning to create web interfaces as the next video in the JS and Python series.
@ramp2011
@ramp2011 5 ай бұрын
The github link you shared does not have code you shared in the video. Could you please upload the code you shared in the code in github so we can follow along? Thank you
@leonvanzyl
@leonvanzyl 5 ай бұрын
Hi there. Just double checked. The code is definitely there. Did you remember to change the branch to lesson 6?
@ramp2011
@ramp2011 5 ай бұрын
@@leonvanzyl I see it. I missed that. Thank you so much
@eneso8657
@eneso8657 5 ай бұрын
You are so amazing. Will you show sql database chat updated version for conversational retrieval chain ?
@leonvanzyl
@leonvanzyl 5 ай бұрын
Thank you 🙏. Yes, I'll definitely cover SQL Retrieval soon.
@eneso8657
@eneso8657 5 ай бұрын
@@leonvanzyl Hello, I sent you an email to get help, I wonder if you have a chance to read it in detail :) I also wrote to the site, I can make a chatbot for you to the part you said
@eneso8657
@eneso8657 5 ай бұрын
Hi leon, I want help from you on an important issue, I sent a message, but you didn't see it, I think because of the intensity, I'm sending exactly the same message, I'd be very glad if you'd return my message .I have an educational chatbot project that perfectly examines pdf, text,url and excel files(because the tabular information in the url may not be taken into account, I want it to review large files in high quality) I want it to respond in quality according to the information there and the gpt3.5 turbo 1106 model, I use langchain at this time, I also connect my database to this bot and the relational information in the database(mssql) along with the files is also analyzed correctly and provided in a high-quality way with the information in the files and create a q&a chat advanced chatbot i want to do all the files and I want the database to be examined and I want it to give the correct answer properly. I also want to customize the behavior as I want by entering instruction into my code. Please help me for the fee ?
@udaasnafs
@udaasnafs 2 ай бұрын
the github repository is empty, please update
@leonvanzyl
@leonvanzyl 2 ай бұрын
Dis you select the relevant branch?
Reliable, fully local RAG agents with LLaMA3
21:19
LangChain
Рет қаралды 101 М.
Вечный ДВИГАТЕЛЬ!⚙️ #shorts
00:27
Гараж 54
Рет қаралды 14 МЛН
孩子多的烦恼?#火影忍者 #家庭 #佐助
00:31
火影忍者一家
Рет қаралды 47 МЛН
MEGA BOXES ARE BACK!!!
08:53
Brawl Stars
Рет қаралды 36 МЛН
ROCK PAPER SCISSOR! (55 MLN SUBS!) feat @PANDAGIRLOFFICIAL #shorts
00:31
LangGraph 101: it's better than LangChain
32:26
James Briggs
Рет қаралды 55 М.
Have You Picked the Wrong AI Agent Framework?
13:10
Matt Williams
Рет қаралды 48 М.
Getting Started with ReAct AI agents work using langchain
43:33
Chris Hay
Рет қаралды 4,7 М.
How I Made AI Assistants Do My Work For Me: CrewAI
19:21
Maya Akim
Рет қаралды 747 М.
Adding RAG to LangGraph Agents
23:57
Sam Witteveen
Рет қаралды 10 М.
Watch how a Pro develops AI Agents in real-time
20:28
David Ondrej
Рет қаралды 22 М.
How to MAKE AI Agents MORE SUCCESSFUL!!!
14:15
1littlecoder
Рет қаралды 4,6 М.
Choose a phone for your mom
0:20
ChooseGift
Рет қаралды 6 МЛН
Easy Art with AR Drawing App - Step by step for Beginners
0:27
Melli Art School
Рет қаралды 7 МЛН
Урна с айфонами!
0:30
По ту сторону Гугла
Рет қаралды 8 МЛН