# 06 2026-07-19 Langchain Agents Contd

course: Module 5 — AI Agents & Agentic Frameworks
module: Module-5-AI-Agents-Agentic-Frameworks
date: 2026-07-19
type: transcript
video_url: https://personal-learn.armco.dev/files/_Recordings/Module-5-AI-Agents-Agentic-Frameworks/06_2026-07-19_Langchain_Agents_Contd.mp4

---
[00:41:49] need it, because in Agent DKI, the task.
[00:41:52] Usually, ah.
[00:41:54] is very limited, and it is very planned, you know? Agent API, what you are doing, you are building agents, and your agents are… have a very planned task, like
[00:42:01] You, let's say one particular agent is supposed to generate.
[00:42:05] Answers within a very limited window, and all those things, because we have only planned it.
[00:42:09] Usually, memory management and summarization, all these things, we do it in.
[00:42:13] Chat history. Because chat history is at the
[00:42:17] Usage at the perusal of the user.
[00:42:20] Okay, the user can give you long context also.
[00:42:23] So, that's why we
[00:42:27] have a mechanism, or like a.
[00:42:28] Kind of like a stopgap solution to the context that after a certain amount of chat, that we reduce the memory.
[00:42:35] Okay, we just maybe, you know, you had 12,000 tokens representing.
[00:42:39] User and AI combinations okay like user message, AI message, user message, AI message tool message user message, AI message.
[00:42:46] You summarize that into 500 token.
[00:42:48] So, that is why in chat history, we do that. We summarize it.
[00:42:52] Perfect. Okay.
[00:42:56] Okay, so that is the concept of
[00:42:59] Workflows, memories, and reasoning. All these things will be more clear as we build more and more agents.
[00:43:04] So, for agentic AI, guys, there are some of these libraries that is there. But before this, we will do LangChain agents as well.
[00:43:11] Okay, we have LangChain agents also to deal with, first of all, because that is the first first.
[00:43:16] You know, agentic architecture that came in. LangChain and QVI that came in.
[00:43:20] First, we'll do Langchain, then we'll go to LangGraph.
[00:43:22] And Langraph is the most enterprise level, most popular.
[00:43:27] used, uh, agentic architecture.
[00:43:30] Cortogen is also picking up, which is coming, like, they want to, you know, fill, uh, like, you know, they want to come at the level of Landgraf, definitely.
[00:43:38] But Creo AI, I
[00:43:40] don't feel it is so good for enterprise, okay? There is a little bit of history. Crew AI was done by Andrew Engie.
[00:43:47] And UNG created it, ah.
[00:43:50] Here, I don't remember it was 2023 or 2024-ish.
[00:43:55] Andrew Engie came up with.
[00:43:56] It is very simple. Crewei is very simple.
[00:43:59] The the
[00:44:01] The kind of coding that you see in Clio UI is very no-code-ish, very low-codish. Not no-codish, but low-codish.
[00:44:07] Okay, so you have very simple, simple things in Creview AI. Usually.
[00:44:11] Only a limited type of agents only you can build.
[00:44:14] Okay, like travel itinerary planner.
[00:44:17] Even our example is also that only travel itinerary planner and.
[00:44:21] I have mostly seen query UI examples with travel itinerary Planner. I have personally worked with Creview UI just to build MVP at some point.
[00:44:30] Okay, then I have never used it because I have moved on to Langra, but in your curriculum, all 3 are there, it's good to know all 3.
[00:44:35] Okay, there is auto gen. Autogen is coming at the level of LangRap slowly, slowly.
[00:44:39] Autogen.
[00:44:41] Has also apparently, like, uh, I heard it is, it is also doing pretty good, uh.
[00:44:48] It is also coming at the level of Lankara, but
[00:44:50] The amount of control that you have in LangGraph over your agents is unparalleled.
[00:44:56] It is way…
[00:44:58] More powerful LangGraph.
[00:45:00] Like, if you have built it, Enterprise architectures on agentic enterprise.
[00:45:06] Agent API, then you will get an idea about how LangGraph can be, you know.
[00:45:11] helpful, uh, because you you can write literally frameworks, like, you can write logic, like.
[00:45:17] explicit, you explicitly you can mention, like, this is after this, this will go here, from here, this will come here.
[00:45:22] Okay, and you have full control over where the flow will go, the orchestration, entire control you have.
[00:45:28] And you have persistent memory concept inside it.
[00:45:31] And those things are there in Autogen, but this is in Langrav, it is very transparent what is happening.
[00:45:36] Okay, and you have a very steeper learning curve, obviously, because there is more coding involved.
[00:45:41] So, for example, if let's say,
[00:45:45] Crew AI and Autogen, uh, not Autogen, at least, Crew AI is like
[00:45:50] a very high-level language, it is.
[00:45:52] Let's say it is like…
[00:45:55] Hmm.
[00:45:56] For example, what to say? It is like make.com, for example, if it is make.com or clay.com, it is just like that. You have very simple, simple things.
[00:46:04] To build an agent, that's why less control over it.
[00:46:08] Whereas Landgraf, it is more like a
[00:46:10] Low-level language, it is, it is more like, more closer towards the machine, more closer towards Python. You have to write more codes.
[00:46:16] But it is simple also. If you see, most of the syntax, it is barren. Like, it is…
[00:46:21] Like UVI, you'll see a lot of abstraction. Let's just like LangChain expression language. It is a lot of abstraction inside.
[00:46:27] A particular query, internally, it is doing a lot of things.
[00:46:29] Okay, but in LangGraph, you will literally define flows. You will literally define a lot of things. It is very, very.
[00:46:37] Less of abstraction is there in Langra.
[00:46:39] And I personally feel LangGraph is good. You will feel QVI is more easy because you are learning.
[00:46:44] For the first time but trust me, Landgraf is the most easiest.
[00:46:49] Uh, like, you know, most efficient, and I.
[00:46:52] I've never seen Cree VI being used in companies. I have only seen QVI used in
[00:46:57] One of the project.
[00:47:00] That was a MVP. Only in MVP people use CreoBI. So, Creo BI.
[00:47:04] If you look at it, Creview UI setup can be done within few hours, ok.
[00:47:09] Within a few hours, you can build one agentic architecture and you can build QA.
[00:47:15] Okay, that's why for rapid prototyping, 3 VI is good, but for Enter-level architecture.
[00:47:19] Many people might not agree with me.
[00:47:22] Fine, like, if you have built.
[00:47:24] breathe and, you know, slept on Creview AI, then you might agree, not agree with me.
[00:47:29] Okay, there are people who have built a lot of things on Clearview AI.
[00:47:33] But I am telling what 80 to 90% people says.
[00:47:36] That QVI is good for rapid prototyping, less amount of coding is there.
[00:47:40] And ah, that is why QUI is preferred by many people. So it is, so basically crew UI attracts that kind of crowd who attracts N10 as well.
[00:47:48] Okay, whereas LangGraph attracts that kind of crowd, who is attracted towards LangChain.
[00:47:55] And more towards Pythonic-based coding and all. Even QUI is also in Python, but code is less.
[00:48:00] Okay, got it guys and autogen is somewhere in the middle. Like it is almost like Review AI, but also like LangGraph. Like that is the thing like it is powerful.
[00:48:10] Very much, very much powerful.
[00:48:12] But it is somewhere in the middle.
[00:48:15] Okay, so with more hands-on, you will understand these architectures, these frameworks more.
[00:48:20] Any question, anybody who disagrees and want to discuss more about Creview AI have used it.
[00:48:26] Personally, I am ready to listen to you guys, like, you know, I will definitely.
[00:48:29] Take a listen, maybe in the enterprise level you have used QI more than.
[00:48:33] Uh, me, but you know.
[00:48:35] But I have heard from.
[00:48:37] You know, probably 10 different colleagues at 10 different, you know, enterprises all uses LandGraph. I have not seen anybody use QA.
[00:48:45] Many people don't even know Creview AI as well.
[00:48:48] Okay, they have never heard of it as well.
[00:48:51] And there is 1 more open source framework that I have heard available on Hugging Face known as Small Agents. That is also there in your… this thing that we will do at last, that is.
[00:49:01] not used at all in the industry, but which is there as a part of your curriculum will do it.
[00:49:05] We'll still do it, but…
[00:49:07] We will take the toughest one first. We'll take Lange first.
[00:49:12] So, like this, it, I am new to this, I am a front-end engineer, so this will help to create chatbot which can perform tasks itself.
[00:49:19] or run commands by user, all of these are something.
[00:49:23] more. Sugar, I didn't get your question, like, could you?
[00:49:27] Like little, you know.
[00:49:30] If you can speak out and tell me.
[00:49:37] Okay, you want to know the end goal of knowing this?
[00:49:43] See, ultimately, the end goal of knowing this is.
[00:49:48] Basically, designing.
[00:49:50] chatbot or interaction based
[00:49:54] Applications, sugar. That is the end goal. Let's say.
[00:49:59] I am asking 1 question to you.
[00:50:02] You are using one agent to decide whether where this question will go. You have created a HR chatbot.
[00:50:09] Okay, in that HR chatbot, there are leave policy. There are different types of HR question, leave policy, then there are questions around.
[00:50:16] Uh, you know, appraisal cycle, then questions around.
[00:50:20] In a notice period, all these things are there.
[00:50:23] So, based on the user, you will decide, user question, you will decide where to send this. So, let's say that is one agent.
[00:50:30] Agent deciding where to send this query. Will it send it to
[00:50:34] The leave policy department, or will it send it to… these departments are individual agents again.
[00:50:40] So you have one agent which is deciding where to send which agent to send.
[00:50:43] Then, once it is sent over there, then that is internally, once it is, let's say, sent to leaf policy, then leaf policy internally is referring to a RAG.
[00:50:53] database to find out the leaf policy related thing, and it is answering the question.
[00:50:56] So this entire thing is a very sequential kind of an agentic architecture, which I told you just now.
[00:51:01] Okay, you are asking me.
[00:51:03] If you are asking me, sir, sir, let's say I'm a chatbot, you are asking me how, what is
[00:51:08] What is my leaf policy for earned leaves?
[00:51:11] Now, I am an agent, first of all. I orchestrate based on your question, which agent should I send it to?
[00:51:18] Should I send it to which agent or which kind of RAG I should send it to?
[00:51:22] So, should I send it to a leave policy rack, should I send it to a notice period lag or a appraisal rag?
[00:51:28] So, when you have interaction-based application.
[00:51:30] For that, you build a agentic architecture.
[00:51:33] For that, different, different frameworks are there. LangGraph, Creview AI, Autogen.
[00:51:37] And I am telling, like, which one is more popular and which one is less popular. That's all I'm talking about.
[00:51:47] Got it, Shikhar?
[00:51:53] Yes, yes, yes, yes, very good, very good, I, I can relate to you because I also provide.
[00:51:58] Uh, you know, APIs to the front-end people, and they also build the Angular front of it.
[00:52:05] And all those things they also built, so I can relate to you, yes.
[00:52:09] Definitely. So, now guys, the question I was asking, guys, anybody knows Crew AI? Gunjan, you know.
[00:52:15] Aditya, you know, have you heard of it? Anybody who's experienced in QAI?
[00:52:24] Uh…
[00:52:25] We are aware, but what is it never used in the actual enterprise application. Yes, we have used, like, our people are, like,
[00:52:29] like, junior developers are using it just for, like, doing learning.
[00:52:33] like a training materials.
[00:52:34] Yes.
[00:52:35] But for enterprise user is LangGraph we heard about.
[00:52:37] Yeah, yeah, same, same, I got the same answer from everybody. I didn't find anybody who uses Clio AI.
[00:52:44] For enterprise production grade system,
[00:52:46] They have only used it for learning.
[00:52:48] Or to understand agent at the first stage. So after knowing Landgrav, guys, QEI will look nothing like in front of you. It will look very, very simple in front of you.
[00:52:58] Okay, you will say that I should have learned this first, okay?
[00:53:03] Uh, like, as an exploration. So that is the thing is Aditya.
[00:53:06] No, no, I've used a lot of NA10, but that is just for my personal portfolio projects, nothing in there as well.
[00:53:13] Yeah, I would say N8N is still more popular than Creviac, because Creview AI.
[00:53:18] has neither gained.
[00:53:20] Popularity amongst Python developers, neither gained popularity amongst n8n people.
[00:53:25] So, so it has, it has lied in between.
[00:53:27] But it is very good to learn, like, it is very good to learn because if you know crew, you will see, oh, this is what happens. Like, your agentic concept will be very clear.
[00:53:36] Okay, so it is good to learn.
[00:53:39] But I have not found people using it in enterprise.
[00:53:43] Okay, same autogen also, autogen.
[00:53:46] Like Microsoft is trying to sell this a lot, they are saying, like,
[00:53:51] It is popular, popular, popular, popular, but I'm not seeing people using it like.
[00:53:56] Uh, even neither when I used to sit for interviews also I never got question from Autogen.
[00:54:00] Everybody asks me a question around LangGraph only.
[00:54:02] So LangGraph is the way to go.
[00:54:05] Okay, now why Landgrav is popular? We'll come to this again later because we have the concept of introduction to Landgrav. This is all about agents that we talked about and the framework. First, we'll go to LangChain first.
[00:54:16] We'll complete the LangChain agents first. You have LangChain agents also as your curriculum.
[00:54:20] And then we'll come to Langraph and intro to LangGraph and how LangGraph works and all those things. That is later.
[00:54:26] After this, first we'll go to LangChain.
[00:54:30] Okay, so this will give you an idea.
[00:54:34] about how usually agents work.
[00:54:37] Okay, so before me starting
[00:54:39] to read, definitely I would want you all to read.
[00:54:41] So let me share this.
[00:54:46] Have a look at this code yourself.
[00:54:49] Okay.
[00:54:52] Have a look at this code yourself. This will give you.
[00:54:55] The point is, you might ask why if we are knowing such great frameworks like LangRap, then why are we coming back to LangChain agents?
[00:55:02] So, LangChain agents.
[00:55:05] You need to understand in order to understand the 1st thing about
[00:55:10] Uh, you know, agentic AI. LangChain agents was the way to build agent AI at point of time.
[00:55:16] And it is still now used in many simple agents, Langra, AlangChain agents is still used.
[00:55:21] Okay, can be used, and you will see, you will understand the concept of
[00:55:25] Uh, that how LLM can determine the steps concept. Okay, same usage will be there in QVI as well.
[00:55:32] When you see the Creview AI agents, they also have the similar kind of architecture.
[00:55:35] Okay, so you have a look at this code, guys. I'll be just back in 5 minutes. Just have a look at this code.
[00:55:41] Okay. You will have a look and then we'll discuss what is happening, ok.
[00:59:49] Okay, so.
[00:59:51] Have you all gone through it?
[01:00:05] Still going through
[01:00:06] Okay, you will go through it in the meantime.
[01:01:26] Yeah, he has it well.
[01:01:29] Share it.
[01:02:51] This is the first time weare doing any exercise on SERP API
[01:02:54] Feels like first time hearing.
[01:02:55] Hmm, yes, that BBA is something.
[01:02:59] That we use to do Google search.
[01:03:02] Okay.
[01:03:03] Okay, so not Google search, it is like being searched, any search.
[01:03:07] Okay.
[01:03:08] Okay. It is like a it gives you a web information using SERV API.
[01:03:12] So, it's an external tool. So, SERP API, how do you get it? That also let me tell you.
[01:03:18] So go to serve API, this link.
[01:03:21] Okay, everybody go over here.
[01:03:28] Please visit this link first.
[01:03:30] Get the API key first.
[01:03:49] And this question is completely
[01:03:51] Not related to this, but again, how many subscriptions you have for anything and everything. So for now, like, you're not even… at least I'm not paid for anything wherever there is a free thing is what I'm leveraging at this point of time. Again, very limited usage also
[01:04:06] Yeah, yeah, so in class, I actually show all the free ones.
[01:04:10] So, I have subscription for open router, paid keys as well.
[01:04:14] Okay.
[01:04:15] Okay, that is my company account, like Minecraft's company, like our
[01:04:19] Like my own company's account.
[01:04:20] That we have, that I do never use it in the class, because then people start saying, like, we are not getting paid keys.
[01:04:26] Uh, we can't, we are not able to do the activities which sir is doing. So that's why I never promote using paid keys in the class.
[01:04:33] Okay.
[01:04:34] That's why I show you different, different ways to get free keys.
[01:04:36] So that is there. I have for open router, I have one for Claude. Claude also I have subscription.
[01:04:42] That is again companies, so.
[01:04:44] It is what we are reimbursing using a client.
[01:04:47] Okay, so it goes through audit trail. So that's why we can't use it in any search.
[01:04:53] So, so that is like a clot code.
[01:04:55] Okay, but I don't use Claude Code so much. It is mostly my co-founder uses it, but sometime I go there and draw some architectural drawing workflows and all.
[01:05:03] So, that is there, open router is there.
[01:05:06] Mostly these two, and some voice recognition tools I have, like Voz API,
[01:05:11] Google Live API-level labs, all those things we have, that is for clients, purely.
[01:05:17] Okay.
[01:05:18] For personal usage, actually, I have ChatGPT+, that is personal usage.
[01:05:23] Otherwise, everything is client-centric, like either we reimburse it.
[01:05:27] Using some clients, uh, or
[01:05:30] Or we get it from client.
[01:05:32] Most of the time.
[01:05:35] Okay.
[01:05:36] Another one question on this, since you have ChatGPT plus, right, I use the Claude paid version.
[01:05:43] So, on your experience, which is better?
[01:05:47] Uh, Claude.
[01:05:49] Is very good.
[01:05:51] For generic questions, generic…
[01:05:55] You know, things like, let's say, HTML pages and all these things Claude is good enough.
[01:06:01] Uh, sorry, uh, ChatGPT is good enough. Claude is very good for complicated.
[01:06:04] Okay.
[01:06:06] Logic, let's say you want to extract.
[01:06:10] Uh, let us say you have got
[01:06:13] Uh, you want to extract this kind of a key value pair.
[01:06:15] Okay. And this key value pair has logic.
[01:06:16] Okay. Okay.
[01:06:19] Every key-value pair, you have, like, 50 key value pairs that you want to extract.
[01:06:22] It has a logic from a normal text, you'll have to extract key-value pairs like this, for example.
[01:06:26] Okay. Okay.
[01:06:29] And every one of them has logic. If you take GPT as a model.
[01:06:34] Okay. Huh.
[01:06:35] Forget ChatGPT+, that is the application, but if you take DPT as a model, GPT-5 versus
[01:06:37] Clots on it or clot uppas, even sonate performs better than.
[01:06:38] Okay.
[01:06:40] GPDs. So if you have complicated logic,
[01:06:43] Okay, and you want to do extraction, then Claude is better. So when I even, even I use, let's say, anti-gravity, sometimes I use
[01:06:50] Okay, I have personally found.
[01:06:53] That when I change the model to Claude Opus and Claude Sonnet, complicated logics are written better.
[01:06:59] Okay.
[01:07:00] Okay, but let's see if I want to generate a HTML page, CSS page.
[01:07:03] I will write, I will do Gemini, Gemini Pro.
[01:07:06] Okay, and if I am doing basic question answering, I will use Gemini Flash. This is with respect to
[01:07:11] Anti-gravity I'm talking about.
[01:07:13] Okay.
[01:07:14] Okay, similar choices. So, if I am doing complicated logic and it is somehow ChatGPT is failing.
[01:07:19] Okay, I will go to clots. Simple cloth is way better, okay? Doesn't hallucinate also so easily.
[01:07:23] Okay.
[01:07:26] But clot sometimes does too much also for genetic task.
[01:07:29] Okay, that I have seen.
[01:07:30] Yeah, that's true.
[01:07:32] That's true, like that, that, that utilizes a lot of token also for generic tasks, that's why don't go to Claude.
[01:07:38] Yeah, yeah.
[01:07:39] Okay, it will unnecessary do its thinking, thinking, Shurojayaga then.
[01:07:41] That is painful, like.
[01:07:43] Thinking will utilize more tokens. You know how thinking was. Do you all know what prompt engineering is?
[01:07:49] Guys, everybody knows prompt engineering. Has that been covered, by the way? It is important for you.
[01:07:54] to write prompts. After this, you will write a lot of prompts. That's why.
[01:08:02] Do you all know prompt engineering, guys? If you all don't know, can you give a thumbs down in the chat, uh, in the reaction?
[01:08:08] You don't know about chain of thoughts, few shots, tree of thoughts.
[01:08:14] Not covered Anwar, actually, on this week.
[01:08:15] I can't see a thumbs down, so I am a thumbs down in this case.
[01:08:19] Okay, but…
[01:08:20] Yeah, from my side also, thumbs down.
[01:08:21] Means I know prompt engineering, but nothing, maybe not at the level you might be thinking at, so maybe if you can give us a
[01:08:27] I'll give you, I'll give you, I'll give you a content also, I have detailed content about prompt engineering, I'll give you, because we have lots of time, guys, like the amount of content.
[01:08:35] to be covered in this time is little less, so we'll have to cover all these things which is not done to you.
[01:08:42] Okay, so I will definitely cover prompt engineering. After this only I'll cover because you will have to after this, you will write a lot of prompts. So you will require.
[01:08:50] prompt engineering. Sometime your prompt
[01:08:52] Saar over 1,000 lines as well, okay? Not thousand by, like, 500, 600 lines of prompts we write.
[01:08:59] ESG2
[01:09:02] Uh, hello, uh, I have my daughters, uh, like, for single show, uh, training. You mentioned, like, structuring using the library, right?
[01:09:11] So, that's been, like, uh, like, structured output, uh, returning is basically single short learning, right?
[01:09:18] Uh, structured output.
[01:09:20] Uh, see, structured output and
[01:09:23] A few shots are parallel things, Jitu.
[01:09:27] Like even with few shots also you can get structured output with even with zero shot also you can get structured outputs.
[01:09:33] Okay, if the task is simple with zero shot also it works. If the task is not simple, then you will have to give few-shot example.
[01:09:40] Purpose is different, few shot is there.
[01:09:42] To make sure you have a consistent output, consistent type of structure. Got it?
[01:09:48] But if the output is very simple, then even zero-shot works.
[01:09:52] What I'm trying to say, that structure output can be there in chain of thoughts also, few shorts also zero short also.
[01:09:53] Okay, uh, my doubters, uh, you may, uh, like, in the previous class, you used a base model,
[01:10:03] So, like, uh, to define… before giving to the input to the LLM, you are, you have defined a base model.
[01:10:11] Uh, with Raghas, I think, alright? Uh…
[01:10:15] Yeah, yeah.
[01:10:16] Uh, with us, uh, accuracy also, like, evaluating and I thought it's, like, basically a single-short method or something.
[01:10:22] Am I right, Tom?
[01:10:23] No, no, no, that has nothing to do with single shots. Single, all these things, single shot, few shots.
[01:10:29] All these things, we use it for.
[01:10:31] Writing prompts in our agents.
[01:10:34] So all these techniques over there though we don't even write a prompt also.
[01:10:39] In over there your ragas only handles most of the task.
[01:10:44] When we were doing ragas, guys, did we write any prompt? We didn't write any prompt.
[01:10:47] Okay, we just give the LLM as a judge model.
[01:10:51] And then Raghash did all the things.
[01:10:54] Okay.
[01:10:55] Okay, okay. Like, structuring the output means a single short line. I thought like that as…
[01:11:00] No, no, no, no, structuring… structuring is part of prompt engineering, so one part of prompt engineering you all know already, that is structuring the output.
[01:11:07] But one more thing is this few shot, all these things also you all should know.
[01:11:11] So that also I will cover.
[01:11:13] After this is done.
[01:11:15] Okay, so let's yeah, yeah.
[01:11:20] Okay, let's do this guys, so guys, we are done.
[01:11:21] Uh, have you all gone through it? Sir, BPI, did you all log in through Sir PPI?
[01:11:27] Did you all log in?
[01:11:29] Can you all come to this screen?
[01:11:35] Okay, if you all come to the screen, you, I hope you have signed up with your email ID.
[01:11:39] If you come to the screen, can you see?
[01:11:41] This API, it is flat open in front of you.
[01:11:45] You don't need to create it also.
[01:11:53] dashboard, but it is asking us to subscribe
[01:11:57] Do we need to
[01:11:58] Can you share your screen? There is a way to bypass that.
[01:12:03] Let me…
[01:12:04] I think few people have already bypassed it.
[01:12:05] Brief one.
[01:12:07] Oh, is it? Okay.
[01:12:08] I did it way back, I did it way back.
[01:12:09] No, but it is free if you register it also, I just, uh, I don't know, register.
[01:12:11] Yeah, yeah, you just subscribe it, it is free only actually. Subscribe, subscribe.
[01:12:15] Okay.
[01:12:16] 250 token.
[01:12:17] Yeah, it is a free plan.
[01:12:18] Okay.
[01:12:19] There are certain already free plan.
[01:12:21] Okay.
[01:12:22] Email ID, you'll have to verify.
[01:12:23] Sure, sure.
[01:12:28] Yeah, yeah.
[01:12:29] Okay, then I'll do it. Don't want to get any emails from them, that's why I was just hesitated. Okay, that's fine.
[01:12:31] Okay, okay. Uh…
[01:12:32] How do I unshare? Okay, stop sharing. Okay.
[01:12:36] Yeah, uh, sir BPI, I don't think they will share, they shared an email.
[01:12:42] I don't think so, but anyways, uh, you will have to do this.
[01:12:45] Uh, in order to move ahead. So, other than SERP API, there are a lot of other APIs also, guys. Search, if you just do search.
[01:12:55] API, you will get this search api.io. This is also is there, but I think this is paid.
[01:13:02] This is not completely free as well.
[01:13:05] be only for successful searches, something like that is there. So that is why I use SERP API.
[01:13:09] There is Brave Search API as well.
[01:13:12] Okay, Tavili is also there, Tavilis, I think, is also free only Tavili, many people use its Tavili.
[01:13:17] Okay, so this also, like, you can, you know, do a lot of real-time web access.
[01:13:23] Okay, table is also there.
[01:13:25] But anyways, let's go to SERP API and if you go to the dashboard, you will get an API key from here.
[01:13:31] So this you have, and the weather API you have taken already yesterday.
[01:13:35] Okay. Now guys, let's come to the code.
[01:13:38] Okay, over here, you will be prompted
[01:13:41] to provide your open router, your SERP API, and your
[01:13:45] open weather key. So yesterday we did open weather already, so open weather, yesterday's class, whoever has attended, you all know it.
[01:13:56] Okay, okay…
[01:14:00] Yeah, this is my open router Kina.
[01:14:04] Okay, today my open router key expired, so another email I had to create.
[01:14:07] To… to get…
[01:14:11] It…
[01:14:14] So the BPA.
[01:14:16] And…
[01:14:17] Yeah, thank you.
[01:14:20] Oh, uh, weather API.
[01:14:26] So we are ready with all our API skies, okay, loaded into the environment variable, we are ready.
[01:14:29] You know, like, I am in that page itself, I verified my account, still…
[01:14:37] Uh, I am unable to proceed to the next page.
[01:14:41] Can you share?
[01:14:42] What's that?
[01:14:56] Have a seat.
[01:14:57] Subscribe, can you go to subscribe?
[01:15:10] Yeah. Now…
[01:15:11] Okay. There's no payment for subscribing?
[01:15:14] I thought…
[01:15:15] Yeah, yeah, your private key, go down, go down.
[01:15:21] No, no, no, this one, right hand side.
[01:15:22] In the white part.
[01:15:23] Oh, okay, awesome.
[01:15:25] Yeah, you have it, you have it, you have it there, see, you have it.
[01:15:28] Over down also you have it, private key.
[01:15:31] Okay. Yeah, yeah, copy this.
[01:15:32] This one, right?
[01:15:34] Okay.
[01:15:40] Okay, stop sharing now. Stop sharing.
[01:15:41] I will set it on my next thing.
[01:15:47] Okay, so now here it is guys, so after this we have
[01:15:50] Our, uh, we have our import statements.
[01:15:54] So…
[01:15:55] I'll put it on.
[01:15:56] Yeah, Jitu, can you go on mute?
[01:15:59] Yeah, so in the import statement, you can see I have serve API, I
[01:16:07] Somebody was telling something.
[01:16:12] How deeper you are on unmute. Yeah, just go on mute guys, everybody, ok let's this for a few minutes, then I can, we'll take up questions.
[01:16:21] Okay, so, see, SERP API already API is there inside Langchain. LangChain already provides SERV API as a
[01:16:27] As under utilities, okay.
[01:16:28] Other than that, we are taking FAS 5 PDF loader.
[01:16:32] Hugging Face embedding, recursive character, text editor, all these things just to build a RAG.
[01:16:36] Okay, then we are also taking…
[01:16:39] This tool, this is a decorator, this can be used as a decorator. You all know what is decorator, right? Python, you all are coming from Python background, you all know what is a decorator, right?
[01:16:49] Decorators, you all know.
[01:16:57] Okay, good. So decorators basically helps you to change the properties of a function.
[01:17:01] Okay, without actually changing inside it, you can just apply a decorator.
[01:17:04] On top of function, that property of that function changes based on that decorator's definition.
[01:17:09] Okay, so anyways, so we are using this tool decorator. So if I apply this on the top of any agent or any tool,
[01:17:16] That becomes a tool itself.
[01:17:19] For us to be accessed by a LangChain.
[01:17:21] So we have tool, we have create agent.
[01:17:24] Create Agent will help you to create our agent, LangChain agent.
[01:17:27] Okay, and you might ask how to take the weather API. Weather API, you don't have a separate.
[01:17:32] you know, integration with LangGraph. LangChain doesn't… it doesn't provide you any.
[01:17:37] a wrapper, so you have to define it. So,
[01:17:40] So this will give you, this exercise will give you a wrapper, like.
[01:17:44] A predefined wrapper which already present, like SERP API wrapper.
[01:17:47] You can directly use and other the weather API, you will have to define it, okay?
[01:17:53] So, this import statement, after this import statement, we have a uploading thing. So over here we are uploading a PDF in the Colab.
[01:18:01] Itself, so this is the option to upload your PDF.
[01:18:03] So from Google collab dot import files, google.colab import files.
[01:18:08] It will help you to upload a PDF. Let this complete, then you will see an option to upload the PDF.
[01:18:13] Okay. And uh…
[01:18:18] over here.
[01:18:20] Let us upload that.
[01:18:21] Yeah, excuse me.
[01:18:29] So, this is done. Okay, PDF is uploaded.
[01:18:33] Now guys, building a RAG tool. This is like
[01:18:35] Plain rack tool we are we will be building.
[01:18:38] We are using recursive character text predictor to do the chunking.
[01:18:40] Okay, see over here, there are different, this is a by default,
[01:18:45] order of this is not the by default order of chunking, we have added a full stop in between. I told you,
[01:18:51] If you want to ever change the way of chunking, or if you want to change the preference order, you can mention that order. So over here, we have mentioned full stop over here.
[01:18:59] Okay, chunk size is 500, chunk overlap 100.
[01:19:02] Okay, all these things are done, then we do a chunk over here. So on this…
[01:19:07] Pages 1, total chunks created are 7.
[01:19:11] Automatically, chunks get created, model gets downloaded, all mini Lm, all these things, chunking is done, RAG is done.
[01:19:16] Okay, so RAG is one of our tool, okay? So we are defining those tools. So, see, I told you tool is a decorator.
[01:19:22] If you apply at the rate tool on top of a function, this thing becomes a tool, okay?
[01:19:28] Automatically, you can use this as a tool. Okay.
[01:19:32] So this thing is required for the Langchain, not U.
[01:19:34] Uh, this is not for us, but you define this, then LangChain gets… you can pass this to LangChain directly as a tool.
[01:19:40] Okay, so search tool. Look at the doc string.
[01:19:43] Look at the input. The input is a string, and the output is also a string.
[01:19:47] Okay, look at the docsing standard. DocString that I have written. Search Google for current general information.
[01:19:53] Using SERB API. Do not use tool for weather questions. For weather question, use weather tool only. You have given one prompt over here.
[01:20:01] This is one prompt. Okay, that you are giving.
[01:20:04] You might be asking like, how is this a prompt? We are not calling any LLM. Yes, but when you will give the tool access.
[01:20:11] To your agent, your agent is going to see this as well. So, when
[01:20:16] Yesterday, when we were doing that, uh…
[01:20:19] Tool calling, there I told you, you know.
[01:20:21] that all your tool definition all your
[01:20:23] uh, true definition actually goes into your LLM. Similarly,
[01:20:27] This entire docstring will go to your LLM.
[01:20:29] Okay, so your LLM will get access to this.
[01:20:33] Okay, and then after that, you… whatever in this, we are calling that wrapper, serve API wrapper, we are passing the API key.
[01:20:41] and .run query, you are passing the query.
[01:20:45] This will give you a response, and that is our response, basically. So this is our external search tool using SERP API. This is first tool.
[01:20:52] Second tool is a weather tool. I told you that weather tool.
[01:20:54] you do not have any wrapper for us, any wrapper for LangChain.
[01:20:58] So, we are defining in the weather tool. So, we are writing an entire function for this.
[01:21:04] So weather tool, it gets accessed, what it does is it takes
[01:21:09] The weather API key, and uh
[01:21:12] The doc string is use this tool only for
[01:21:16] Current weather information, input should be a city name.
[01:21:20] Okay, that is our weather tool.
[01:21:24] Okay, so whenever
[01:21:28] The location you sent, uh, from here.
[01:21:31] The location is detected and that location is passed on to
[01:21:34] This patterns and whether tool is called and you get the response, and then after that, the response is.
[01:21:39] you know, structured like this, and it is…
[01:21:41] You know, returned like this, finer weather result, current weather in city Kolkata, let's say, country.
[01:21:47] And you give the condition and everything. So, this is the, you know, beautified paraphrased answer.
[01:21:52] Okay, so this is our weather tool. This is one more tool.
[01:21:55] Another tool we are also
[01:21:57] Giving is RAG. So this is the retrieval engine of RAG where you are writing search the uploaded.
[01:22:03] PDF and return relevant context. Use this when
[01:22:06] The user asks about the uploaded document, resume, policy, notes, or internal knowledge base.
[01:22:13] Okay, again, this docstring, very important.
[01:22:15] You call this?
[01:22:18] You retrieve the based on the retriever question, you retrieve the document and from there.
[01:22:22] You give the, you know, PDF and you show the chunk and all those things you do.
[01:22:27] This is your rack part. So RAG is done. RAG retrieval is done. RAG retrieval is one tool.
[01:22:33] Whether is another tool and search.
[01:22:35] API is another tool. So we have three tools.
[01:22:39] Now, guys, I will initialize the LLL.
[01:22:42] Okay, here is the LLM that I have initialized.
[01:22:45] SIM, like chatter open router. Now, here comes the agent part, see.
[01:22:50] Tools equals to
[01:22:52] It's a list of tools that you have, search tool, weather tool, all the function names you have written, rack tool, all the function names.
[01:22:58] that you created with, you have passed on over there.
[01:23:01] Okay, now system prompt is you are a helpful AI class demo assistant.
[01:23:06] You have access to 3 tools.
[01:23:09] Okay, search tool.
[01:23:11] Use for latest news and current facts, recent information, or external web knowledge. This is the prompt that you are writing.
[01:23:19] Weather tool for weather, humidity, temperature, all these things used for question around the PDF document.
[01:23:25] or private document. This is for rack tool. This is another prompt you have written. Also, your LLM will get access to these things as well.
[01:23:32] When you are passing this tool, and you'll pass this tool your LLM, to your LLM, your LLM will get access to those things as well.
[01:23:40] Now, over here, you have mentioned tool selection rules for whether question, use weather tool only, do not use. These are like guardrails, you have given prompt guardrails.
[01:23:48] Do not use search tool for whether
[01:23:51] questions if either tool returns final weather result immediately answered using the result.
[01:23:57] If the weather tool returns weather tool error, explain the error to the user, do not call another tool.
[01:24:01] Okay, for questions about uploaded PDF, use the rack tool.
[01:24:05] These are like guardrails. Guardrails are basically way to.
[01:24:09] You know, control your responses or control your flow out of LLM, basically. So guardrails can be using prompt as well.
[01:24:17] using parameters as well. So, some of the parameters we have already learned about guardians are temperature and all those things are also guardrails parameters.
[01:24:25] Okay, max token, para top P top K.
[01:24:28] temperature, then other things are also there, let's say, uh…
[01:24:32] Reduction technique, let's say before giving it to the LLM, you will
[01:24:37] You can write a function to redact all the important information out of it.
[01:24:40] So, that is also another guardrail technique people use, okay?
[01:24:44] So anyways, where you want to control, what you want to give it to the LLM, what you want to come out of the LLM, you use guardrails. That could be through a prompt, through a parameter. So if you ever not heard of this term, remember this term is known as guardrails.
[01:24:57] Okay, so majorly we do it using prompt only.
[01:25:00] Okay.
[01:25:02] Okay, so this is your agent creation, agent is created. Now, create agent, you call that create agent which we have imported at the top.
[01:25:09] Pause the LLM model, LLM will decide all these steps, because you have given on a prompt.
[01:25:13] And tools is the tools that you have created over here, this tools.
[01:25:18] And system prompt.
[01:25:20] Is the this prompt you have written, ok.
[01:25:23] Now, guys, let's ask some questions.
[01:25:26] Okay.
[01:25:28] Ask some question as in, uh…
[01:25:35] Now, this is your agent task. So, over here, we ask some question.
[01:25:39] According to the uploaded PDF, summarize the key skills or the main point.
[01:25:42] So over here, we are also printing like the tool that is called.
[01:25:46] And we are asking.
[01:25:48] User question, according to the user uploaded PDF, Sarah is the key skills are the main points, and these are the key skills and the main points it has uploaded.
[01:25:55] Okay, now let's answer, let's ask question about weather.
[01:26:00] Okay, instead of this, let's ask question about
[01:26:03] Weather as well, what is the current weather?
[01:26:08] What is the current weather in Kolkata? Okay, you can ask like this also, no problem, but this is what I was trying something.
[01:26:14] Okay, agent dot invoke in a message kind of a format.
[01:26:18] Uh, so this is recursive limit is, it will try 4 times. If your weather app fails, sometimes.
[01:26:23] That's why I was trying this. If you want to mention, let's say,
[01:26:27] You… this is the plain search. This is like plain queries you are asking, but let's say if your weather app, your API is failing.
[01:26:33] Okay, if you want to try multiple times, you can set a limit over here, so known as recursive limit.
[01:26:38] So recursion limit, it will try that many times, that's all. This is a plain API.
[01:26:44] API hitting mechanism. This has nothing to do with LangChain, LangGraph, anything. It is like
[01:26:48] It is how, like, we hit a API, like, many times.
[01:26:51] Our APIs doesn't answer within few seconds. Okay.
[01:26:55] So we answer, we ask after a particular time limit, let random time limit of 2 seconds, 3 seconds, we ask.
[01:27:02] So, those techniques are known as API heating techniques. So, I was trying that.
[01:27:06] Because my weather app was failing. Okay, so I was trying what is the current weather in Kolkata? So this is how it responds.
[01:27:12] The raw response, and then the beautifully phrased response.
[01:27:16] Okay, what is the latest news about ISRO?
[01:27:20] See, search API tool called.
[01:27:22] And the answer will come.
[01:27:31] What is a… so, search API toolkirt, and this is how the agent is answering, ok.
[01:27:35] So you got some raw response from Google, and then from there it is giving the answer.
[01:27:39] Okay, now let's print this. But this is a multi-tool question.
[01:27:44] Check the current weather in Bangalore and also search for the latest Bangalore traffic news. So, first, it search for location.
[01:27:50] Weather tool, ok.
[01:27:53] It, it came up with the answer of Bangalore and then also the traffic information. This is like using multiple tools.
[01:28:00] Okay.
[01:28:06] Got it, guys?
[01:28:12] Everyone understood.
[01:28:24] So this is a very…
[01:28:26] Idea about LangChain agent similar things you will see with Crew AI as well when we build crew AI. Yes, Neeraj.
[01:28:36] Hello.
[01:28:37] Yes, yes, Neeraj.
[01:28:39] How the… how the coder decided that which tool to be used, just like we have created the three tools.
[01:28:42] LLM, LLM, LLM, you have, you have written the answer. LLM is deciding.
[01:28:48] LLM is the brain, Meeraj.
[01:28:49] LLM, you have written a big prompt telling which tool to use when.
[01:28:54] So, it, it uses its own intelligence. Definitely you do not have control over.
[01:28:57] It is non-deterministic agent. So there are deterministic agents also that we will build next using LangGraph.
[01:29:03] So, in LangChain agents, the problem with LangChain agents is it is it is good for non-deterministic agents.
[01:29:08] Where LLM only decides what to do. It is good as well as bad as well. Good as in LLM is way more intelligent. You might have steps where.
[01:29:16] You actually might not go in a straightforward way. You might require intelligence. That time, this is good.
[01:29:22] But if you have a determined step, then you will use Lange graph for that.
[01:29:28] Got it.
[01:29:29] Okay. And is there any naming convention is there?
[01:29:30] Uh, we need to follow for that, just like that, uh…
[01:29:33] Tool.
[01:29:34] We have created three tools here.
[01:29:35] No, no, no, tool to standard, I think standard for writing any function is
[01:29:40] Okay.
[01:29:41] Both, uh, both small letter and a underscore in Python at least.
[01:29:43] Okay.
[01:29:44] In other languages, I don't know, in Java and all.
[01:29:47] Might be a little different, maybe it is with camel casing.
[01:29:49] Okay, but in Python, this is the most standard way.
[01:29:50] Yeah. Just like we have, uh, just like, uh, we have written the weather tool.
[01:29:54] We can return, we can write this like a climate tool.
[01:29:58] something.
[01:30:00] Yeah, you can similar, similar, same way you can write climate tool.
[01:30:01] Okay.
[01:30:03] I got it. And, uh, sir, uh…
[01:30:04] Same way. There is no taming convention. You can write this as capital also. No problem. You can write this capital also, no problem.
[01:30:07] Okay, okay.
[01:30:10] Okay. And, uh, can we, uh, used to search in our database also?
[01:30:14] Some text, or just like that.
[01:30:16] If, uh, search in our database as in like
[01:30:20] RDBMS, though, doesn't give you access.
[01:30:23] Okay.
[01:30:24] of doing plain searches. RDBMS has its own nature of searching by a structured query language, right?
[01:30:28] Yes.
[01:30:30] So depends on your database. So if your database has the capability of doing search normally.
[01:30:36] Okay. For that, you'll have to use some sort of a BM25 kind of a search, keyword search.
[01:30:44] You take your entire database.
[01:30:46] Okay, put it on BM25 database or Elasticsearch.
[01:30:47] Okay. Okay.
[01:30:51] And then do a text search over there.
[01:30:53] But normally RDBMS is designed to do structured query language search. You cannot do text search.
[01:30:58] Yes, yes. Got it.
[01:30:59] Right, so yeah, so that is the next task actually I was thinking of giving all to you.
[01:31:04] Uh, yes, Alitya, you'll ask me, then I keep that task.
[01:31:10] Sure, are we using the pyrantic model here for LLM output?
[01:31:16] Okay.
[01:31:17] No, no, no, we haven't used it, you can use it, you can use it. Pydanti can be used over here without Pydantic only we have
[01:31:20] Given some structure to weather API, so.
[01:31:24] Whether API we have given like this. Okay, but this will also follow a structure, but this will not be a
[01:31:28] Key-value pair. It will not be a JSON object.
[01:31:30] Okay, this will follow our structure, but not a JSON object.
[01:31:34] Okay, so yeah, Pyrantic can be used over here as well.
[01:31:39] No doubt about it. Okay.
[01:31:41] We'll have to see the syntax and, you know, we'll have to see that for that, but it can be used.
[01:31:47] Okay, now guys, I will give you one more task. So, I will give you access to one more code, just a moment.
[01:31:53] It is just addition on top of this.
[01:31:59] Under one, I'm getting this error on the key, even…
[01:32:02] In spite of putting it multiple times.
[01:32:06] This is the worst thing that can happen, yeah, tell me.
[01:32:08] Yeah, so I, I tried again, I'll share my screen.
[01:32:09] Joey, the weather API, yeah.
[01:32:12] Navo, open router wallai.
[01:32:14] OpenRouter, then though you can move on to Grok as well.
[01:32:20] But show me, show me. Is it 402?
[01:32:21] Okay. But whether I'm getting it for all the… no, it's getting missing authentication header.
[01:32:27] Is the API key working in the rest of the, in another code?
[01:32:32] In that, uh…
[01:32:33] Yeah, I just created everything new today.
[01:32:35] With the new email ID.
[01:32:36] Oh, okay, okay, then can you try out?
[01:32:42] Wait.
[01:32:51] Just a moment, I will…
[01:32:53] I will tell you what to try.
[01:32:56] Okay.
[01:32:57] Try out that Laguna thing.
[01:33:04] Okay.
[01:33:05] Wait, wait, wait. I'm sharing with you.
[01:33:10] Yeah, this code I had given you in the past.
[01:33:14] So, over here, I had told you that if your model is not working, try one of these models. See if it is working.
[01:33:23] Try mostly Laguna will work, mostly.
[01:33:24] Okay.
[01:33:25] And for all the 3?
[01:33:28] Uh, rest of the tool will work, that is only happening from OpenRouter only, missing authentication.
[01:33:33] I'm getting it for all, like, I don't know whether question kill.
[01:33:36] Can you show, can you show? Can you show?
[01:33:37] Ah, give me one second.
[01:33:45] Sort PPI cannot show this kind of an error.
[01:33:49] Yes, sir. Let me know if you can see my screen.
[01:33:59] Huh, close this side my chat option, Gemini.
[01:34:05] Uh…
[01:34:13] Personally, I think this is coming from
[01:34:15] Yeah, same thing is coming for me also, like, everyone. Same issues for me.
[01:34:18] This is, personally, I think this is coming from
[01:34:21] Uh, open router. Okay, because you are thinking it's all there is a mistake over here.
[01:34:26] Your all is also decided by your open router only. Vineet.
[01:34:31] OpenRouter decides which one to call, na.
[01:34:34] So, you are feeling…
[01:34:35] Oh, okay, okay, okay, got it. Uh-huh. Okay, okay, okay, okay, it's not working, uh-huh, got your point.
[01:34:37] Mm-hmm.
[01:34:38] Your LLM is only is not working.
[01:34:39] Got it, got it, got it.
[01:34:40] So, replace that with this. If it doesn't work, then replace your chat open router, that thing with Grok.
[01:34:47] Okay. And I'll do it later then.
[01:34:48] Okay.
[01:34:49] Yeah, yeah, you, uh, you have the grok alternate.
[01:34:54] You do that.
[01:34:55] I got your point. Okay.
[01:35:01] So, your LLM is only failing basically or nothing else.
[01:35:05] Okay, otherwise, guys, if all of these doesn't work, just simply shift to cohere.
[01:35:09] Okay, I try to keep… I'll tell you, I try to keep OpenRouter, because OpenRouter give us access to.
[01:35:14] OpenAI. Okay, so many students sometimes, you know, they feel that if I'm not using OpenAI.
[01:35:21] Then I'm not using anything around
[01:35:24] Uh, in the modern, modern day LLMs, so that I try to keep OpenRouter in the classes as much as possible.
[01:35:30] Okay, via, uh…
[01:35:32] So, via cohere we don't get that.
[01:35:35] And that's why I try to keep OpenRouter as much as possible.
[01:35:39] Anyways, now guys…
[01:35:42] I will give you access to one more code.
[01:36:02] Okay, so…
[01:36:04] So this is a little smaller version of what we have done now.
[01:36:11] So, we have done the concept of
[01:36:13] Three agents are… 3 tools are here also there is SERV API, there is Wikipedia API.
[01:36:20] API. This is free. Wikipedia doesn't require a key.
[01:36:24] And there is a math tool API. This is, I think this is provided by this is known as REPL tool.
[01:36:29] It it actually regular expression.
[01:36:31] uh, some PL is, I think, programming language or something, ok.
[01:36:37] So, it is if you write like what is force what is 16 square or what is 4 square, if you ask this kind of question.
[01:36:44] This tool actually is triggered.
[01:36:45] Okay, so what do you do is…
[01:36:51] Take this code, which I had given.
[01:36:54] And in that,
[01:36:58] In that, please add the Wikipedia tool.
[01:37:01] And maybe a calculator tool or some sort of a tool like calculator tool like this from here, or you can take it from there as well.
[01:37:08] Okay, just do this.
[01:37:10] company FAQ, I know you all will not do that in the class if you do not, you obviously will not do that because against the policy.
[01:37:16] Do this. I'll give you, like, 10 minutes, you can take the help of ChatGPT, anything, give this code.
[01:37:22] And give the reference of this code as well.
[01:37:25] And, and do that. Just a moment.
[01:37:31] If you do not want to take this reference, that's also fine, just in, you know, integrate with Wikipedia as well as some calculator tool.
[01:37:40] Wikipedia is free, guys, you just have to import.
[01:37:43] Wikipedia over here.
[01:37:45] And it works.
[01:37:47] Okay, just like SERP API, you also have Wikipedia.
[01:37:51] Okay, Wikipedia API wrapper.
[01:37:53] Okay, do it, guys.
[01:39:06] Yeah, Azad, uh, so what you have to do is, in this code.
[01:39:11] You can add… see, actually, you should add, like, one or two more tools. So, I am giving you, can you add a calculator tool, which is something like this.
[01:39:19] Where you give an expression like what is 4 square 4.
[01:39:22] It will give this and evaluate.
[01:39:25] Okay.
[01:39:30] Okay, it will evaluate and that you can give or you can give a REPL tool from here as well.
[01:39:35] RDPL tool actually understands, uses LRM only.
[01:39:38] To, you know, figure out what is the thing Python RDPL tool. Same thing, it is like a calculator tool, only math tool. You can write, like,
[01:39:47] What is 4 square 4? It will give you an answer.
[01:39:50] Okay. Or you can add a Wikipedia tool maybe. I'm telling like add one or two more tools.
[01:39:56] Okay, maybe 1 of your tool could be a DB as well.
[01:39:59] If you have a DB ready, if you have a Postgres or something that is ready which you want to calculate.
[01:40:04] you know, connect from your DB, you can do that also.
[01:40:09] Sure, sure.
[01:40:10] So, this is the task, guys. See, ideally in every class or every 2-3 class, we should do some task.
[01:40:17] Okay, so that's why I'm giving you this basic, oh, sorry.
[01:40:22] I'm giving you this basic task.
[01:40:23] Okay, so that you also get a hand of it and you can use any coding tool, no problem, but let's see if you are able to implement it or not. If it is done, share your collab link.
[01:40:52] In the meantime, I will share another collab link with all of you.
[01:40:56] Which is the extension of this thing.
[01:40:58] Which has the concept of memory.
[01:41:01] Okay.
[01:41:16] You all do that, then I will share it.
[01:44:57] Okay, answers are coming.
[01:45:32] Okay, let me…
[01:45:34] Share the next collab link.
[01:45:38] It has to do with memory.
[01:45:42] In the meantime, you all try to
[01:45:44] Attach that tool and send it to me.
[01:46:16] Here is the code. Guys, don't get confused with this code.
[01:46:20] Okay, this is not to be used anywhere as of now. As of now,
[01:46:23] Whatever task I have given you, first you do that. Then we will discuss this.
[01:46:48] Deepan, are you doing it?
[01:46:50] G2
[01:46:55] Okay. Yeah.
[01:46:56] Yeah, yeah, doing it. So it looks like I'm getting some import error, so I'm just trying to
[01:46:59] Fine, fine, fine. If you get error.
[01:47:00] It's fine, because some of these tools are very
[01:47:02] beta stage, they don't work, uh, these…
[01:47:06] the Wikipedia tools and all don't work, but still try to fix it as much as possible.
[01:47:11] Okay.
[01:47:12] Sure.
[01:47:13] If you are getting an error, you can have another tool. You can ask.
[01:47:17] You can have a different kind of a tool, a custom tool, maybe a
[01:47:21] Custom tool which just gives you…
[01:47:23] Even number for a number.
[01:47:27] Satish, you have some audio issue.
[01:49:15] Any notebooks?
[01:49:25] Guys, if you're not able to do Wikipedia tool or any tool.
[01:49:29] You can just…
[01:49:32] Just do any custom tool.
[01:49:35] As well.
[01:49:40] It can be a mathematical calculation also.
[01:49:47] Atish, you have some audio issues.
[01:49:49] Satish, there is some audio issue. If the moment you are unmuting, it is disturbing the class.
[01:50:20] Gunjan, are you doing it?
[01:50:29] Yeah, I'm just trying to do it for this.
[01:50:32] being stuck in between here.
[01:50:34] Yeah, yeah, I know, I know, these people are supposed to get stuck.
[01:50:38] That's why I gave this task.
[01:50:39] Yeah.
[01:50:40] Okay.
[01:50:41] Yeah, because I'm just also doing the same.
[01:50:42] Mm-hmm.
[01:50:49] Okay, guys, so no problem. You all try it, okay? In the meantime, let me show you one part of
[01:50:54] Summary, okay, uh, one part of memory.
[01:50:57] Okay, then we'll come back and we'll take your submissions, but at least let me start off with the memory thing, so that, you know, y'all don't go.
[01:51:05] Yeah, go till the next classes with this thing in your mind that memory was not done.
[01:51:10] Okay, so see, this is a type of a demo which I usually try to avoid as less as possible in the class.
[01:51:19] Because it utilizes a lot of token.
[01:51:22] Okay.
[01:51:26] Okay, so this I usually divide, you know, avoid showing multiple times. Vineet, I will take your inputs since I have started this topic.
[01:51:34] Take your input, but you have done a good job.
[01:51:36] Okay, so this is the kind of demo.
[01:51:40] That usually will take, utilize a lot of token. First of all, definitely because it is using history.
[01:51:47] Okay, and…
[01:51:57] Okay, so this is done, this is done, the same code only, uh, it's just that I have added.
[01:52:02] Some history at the bottom.
[01:52:05] Okay, history management and I will teach you 1 concept of history today.
[01:52:09] That is how to keep full chat history.
[01:52:49] Very good, few people have already started submitting.
[01:52:52] Deepan has given, Vinit has given.
[01:53:03] Oh, Jitu, actually I asked that in the same tool, 3 tools, I added, like, can you add more tools like Wikipedia tools or some math calculator tool?
[01:53:12] Can be a custom tool, you can design also, you can use a Wikipedia wrapper only.
[01:53:16] All those things you can try. So that's what I gave as a task.
[01:53:20] Okay, so anyways, uh…
[01:53:23] When people are trying, I, you know, started this memory thing also.
[01:53:27] Okay, in the meantime, many peoples have started submitting, so we will discuss that, but I will tell you one thing, at least one memory concept.
[01:53:35] Okay, so, see, chat history…
[01:53:39] Has a lot of variations.
[01:53:41] Okay, has a lot of variations. So there could be complete chat history, there could be last 10 messages, like say windowed chat history. This is called as window chat history.
[01:53:48] There could be summary chat history,
[01:53:50] Uh, or there could be, like, summary plus window chat history.
[01:53:55] Okay, so…
[01:53:58] majorly complete chat history, if you understand, you will understand all the rest, okay? The most, longest is summary plus last.
[01:54:07] 10 chart history. The most complex, but if you understand complete, you will understand everything. It is very simple, guys.
[01:54:12] See, many people feel overwhelmed after hearing chat history. Again, same problem like agents agentic.
[01:54:17] Okay, they feel very confused, like, how LLM.
[01:54:21] doesn't have memory, but still, like, how in our chat GPT does that. It is very simple, guys. Create an empty list.
[01:54:28] Okay, create an empty list. I have made the empty list a global variable so that, you know, across function, I can use it, and later also once I can use it.
[01:54:35] So the scope is not limited. Okay, now see empty list is empty now.
[01:54:40] What I'm doing in
[01:54:44] Whenever a user is asking a question.
[01:54:47] Along with the question, along with the…
[01:54:50] Older chat history, I'm attaching the question.
[01:54:52] This is my first messages structure.
[01:54:55] So, whatever the user asks, that becomes my first entry into messages.
[01:55:01] And that messages becomes my
[01:55:04] agent.invoke, so it becomes my part of my input.
[01:55:08] Okay, whatever is the result,
[01:55:10] The final result, if you do final result of messages, that will be part of chat history now. So, after you get the response.
[01:55:16] So messages will have the user question as well as the output as a part of full chat history.
[01:55:21] Okay, and then we printed over here the user question and the answer. The last user question and the answer.
[01:55:28] That's what we do. And if you want to clear chat history, just re-declare again the chat history and make it empty.
[01:55:35] It is done. Okay.
[01:55:37] So this is how full chat history works, guys. Now look at
[01:55:41] This will not come as of now because this is, this is a local thing, so let's remove this.
[01:55:47] Yeah. So now let's start. First, we are creating clearing the full chat history. So let me.
[01:55:57] We are running for the first time, let's clear everything.
[01:55:59] What is the current weather in Kolkata?
[01:56:02] This is the first question I'm asking.
[01:56:05] Okay, let me take it in a…
[01:56:13] See, if I ask this question,
[01:56:15] Weather tool called, just like how we were doing weather tool called.
[01:56:18] What is the current weather in Kolkata?
[01:56:20] Assistant, it goes, uh, assistant responds the current weather in Kolkata like this, like how your weather tool responded.
[01:56:27] I use the weather tool to get this information.
[01:56:29] The current weather in Kolkata is as follows, and this is how it answers, ok.
[01:56:35] So this is the AI assistance. So this is the same response. We have printed the raw response as it is.
[01:56:40] Okay, forget this, but this is the answer.
[01:56:45] Okay. Now, guys.
[01:56:46] Let me ask a second question. Based on that, should I carry an umbrella?
[01:56:50] A normal LLM will never answer this.
[01:56:54] Now look at this.
[01:56:56] Based on that, should I carry an umbrella?
[01:56:58] Given that the weather in Kolkata is currently overcast with a humidity of level of 74%, there is a possibility of rain.
[01:57:04] It should be wise to carry an umbrella.
[01:57:09] Guys, did it answer or not?
[01:57:11] From your previous information.
[01:57:15] Now, guys, did you understand what is history?
[01:57:20] Yes.
[01:57:21] Isn't it simple? Isn't it very simple?
[01:57:23] Yes.
[01:57:24] It is very simple guys, many people never have seen history. That's why they feel like it is a very big thing.
[01:57:30] Like, I don't know chat history, I know everything. Like, I have seen literally people on interviews, I mean, I have taken interviews of others.
[01:57:36] People have come, I have done everything, I have built Landgraph.
[01:57:39] Legendic, non-agentic, fine-tuning of LLMs, everything I have done.
[01:57:43] But I don't know how history works. Okay, because it is such a simple thing. Maybe their chatbot didn't require that. There are chatbots where you don't require the chatbot I first time built using Rack never require history.
[01:57:54] Because it doesn't involve follow-up question. It just involves you searching a query.
[01:57:58] And based on that, the right URL should come and a summary should come.
[01:58:01] Based on that previous query, you don't never ask, okay? That is, like, in that kind of thing, you don't need a history.
[01:58:08] Okay, still I had history concept there only, just for my knowledge, I had it, but you don't require it because that will unnecessarily utilize a lot of tokens as well because
[01:58:17] When you are asking the second question, guys.
[01:58:19] Your messages.
[01:58:21] We'll have the previous question and the answer, so your result.
[01:58:24] We'll have the previous question and the answer, because your result is ultimately.
[01:58:28] The response from the LLM and all the previous messages that you have given. All the previous messages has the entire chat history now.
[01:58:35] So, the entire flow will be there, entire, that prompt that you saw will be there. So, if you ever print it.
[01:58:43] If you ever, if you ever print it or let's not print it here, let's print it here only, full chart history, if you print it, see guys.
[01:58:50] You have the full chat history.
[01:58:52] What is the current weather in Calcutta? This was your first question.
[01:58:55] The answer AI message give you the answer.
[01:58:58] Okay, then you have the second question based on that.
[01:59:01] Should you, should I carry an umbrella?
[01:59:04] Then based on that, user gave another question.
[01:59:07] This is the concept of
[01:59:09] Chat history, guys.
[01:59:11] This is one variation I'm showing, and I'm, you know, pausing it here.
[01:59:15] I will take up now notebooks that few people have submitted and we will discuss. So, Deepan has submitted.
[01:59:21] Let's see what Deepan has done.
[01:59:29] Okay, so what other tools you have added, Deepan?
[01:59:33] Wikipedia and REPL.
[01:59:36] Oh, you have added it, but I don't see it in your notebook. Has it not changed?
[01:59:40] I think… can I share my screen then?
[01:59:43] Yeah, yeah, share it, share it, share it.
[01:59:45] Okay.
[01:59:46] And it is working. Wikipedia.
[01:59:47] Oh, yeah, yeah, it is working, yeah.
[01:59:48] Wikipedia fails a lot. It is some, some lengthy issue is there.
[01:59:53] Right.
[01:59:54] For Vinith, it worked.
[01:59:57] Okay.
[01:59:58] Let me know if you're able to see my screen.
[02:00:08] Yeah, yeah, fine, fine, fine.
[02:00:09] Yeah, so I did a couple of things. There was an import error initially. So this Wikipedia looks like has to be imported from Langchain community and also this also. So I did that
[02:00:10] Good, good.
[02:00:13] And then, so the agent creation, I had to create it newly again
[02:00:19] Yeah
[02:00:20] So…
[02:00:21] Obviously, yes, yes.
[02:00:22] Okay, I think I'm… yeah, I think here is where, right? So I just copy-pasted what you had it there, and then we're creating this agent, I just added these two tools reference also saying that, okay, anything for sports information, you get it from Wiki and anything on mathematical
[02:00:28] Ha. Very good.
[02:00:39] Yeah. Yeah.
[02:00:40] Take it from math tool. And this also I have added and then I was just asking the question who won the
[02:00:44] 2020 World Cup, and then it says rightly on Australia. And similarly, what is the 7 into 7? Then it gave 49 by
[02:00:51] See, RAPL tool it called, but it didn't call the Wikipedia. Why it is printing wiki like that? Because it is calling the search API, see.
[02:00:58] Okay. Maybe is it the order that matters?
[02:01:01] Yeah, yeah, maybe you can, that with prompt engineering, it will change.
[02:01:04] Oh, I didn't see. Okay.
[02:01:05] That with prompt engineering, it will change, but there is an error that is happening on Wikipedia call. If you go.
[02:01:12] Co-op, is it
[02:01:13] Uh, so see, there is an error, so I think there is another import statement that is there in the same code that I have given you.
[02:01:22] There is.
[02:01:23] That's correct. Okay, okay, okay. I saw that, but I thought it was not used, but yeah, looks like it was not giving any error, so I thought all done
[02:01:28] Yeah, because your Wikipedia was never called, no, so that's why.
[02:01:31] No error happened. Now see.
[02:01:33] This is the import statement I have pasted in the chat.
[02:01:37] Okay.
[02:01:41] Okay.
[02:01:42] Okay, so over here search is also there, search API you can remove, but rest of the things you import.
[02:01:47] Okay.
[02:01:48] So, there are two things, wiki run Wikipedia run query.
[02:01:49] And Wikipedia API wrapper, both of the things. But anyways, good job.
[02:01:53] Uh, at least RDPR is working, so that's fine.
[02:01:56] Yeah, yeah, okay.
[02:01:57] Okay, Vinita has also done it, guys, I know this is little difficult because many people face errors.
[02:02:03] with this, but this will give you little, little exposure about all these products, like, all these things, okay.
[02:02:08] See, you might know these terms by just googling.
[02:02:13] And all these things you might know these terms.
[02:02:15] But when you start putting your hand into this, even using ChatGPT also.
[02:02:19] Using any agentic tool, you will face some issue. So, that's why always good to do all these practice.
[02:02:25] Okay, uh…
[02:02:28] I don't see any change in the
[02:02:31] No, no, uh, 29, I've added the Wikipedia. I've done very… I don't know if I've done it right or no.
[02:02:36] So if I started the Wikipedia tool, uh…
[02:02:39] In one of the.
[02:02:40] You haven't pressed Ctrl-S, I think so.
[02:02:42] Oh, , okay. I'll share my screen.
[02:02:44] Yeah, you share your screen and show.
[02:02:45] Better then?
[02:02:53] When you are sharing, let me know because I am on the other screen.
[02:02:55] I'm assuming my screen is visible.
[02:02:58] Just a moment, uh…
[02:03:03] Again, same problem, same problem with your shaker, you have not added.
[02:03:08] Wikipedia.
[02:03:13] Yeah.
[02:03:16] I can see it, yes.
[02:03:19] Oh, this is good. You have built a Wikipedia thing only. Very good.
[02:03:20] Well, this is…
[02:03:24] Yeah.
[02:03:25] Maybe Wikipedia was not working directly.
[02:03:26] So yeah, if we keep it as not working, you can create, you can create a search tool like this.
[02:03:31] It is like a custom Wikipedia.
[02:03:33] Yeah, this is fine, this is fine, good.
[02:03:34] Yeah. I added it in the thing.
[02:03:37] Hmm. Yeah.
[02:03:38] Added this here in the agent, gave this one as this, and…
[02:03:41] I… just for testing purpose, I used my first question as, uh…
[02:03:45] Oh, awesome, you're getting the answer.
[02:03:47] Yeah, this is what I got.
[02:03:48] This is too good. See, it's fine 20404 is fine because
[02:03:53] Ah, oh, second time you got the answer.
[02:03:56] First time error, second time you got the answer.
[02:04:01] So, this is what came out.
[02:04:03] Yeah, yeah, yeah. Dinosaurs are a diverse group, very good, very good, good job, good job.
[02:04:12] Sadish, again, same problem.
[02:04:17] Satis, same problem, we are like your, it's exploding all of a sudden and it's coming up as a noise.
[02:04:27] I have added a currency converter.
[02:04:28] Okay, let me see, let me see.
[02:04:32] I don't see in your code, can you share your screen?
[02:05:03] Let's end this whole thing.
[02:05:05] Just a moment, Shikhar, just a moment.
[02:05:42] Okay, uh, yeah, show, so, show, so.
[02:05:45] Currency converter.
[02:05:49] So yeah, I think the vulnerable.
[02:05:52] Oh, this is the API, open ER API v6 latest, this is what some sort of a currency converter or what?
[02:06:00] Okay, so did it work?
[02:06:01] It's… they're different.
[02:06:07] I did a cushion.
[02:06:08] Did you ask a question and did it work?
[02:06:11] Yeah, yeah, yeah, yeah.
[02:06:14] Awesome, awesome guys, this is what I am.
[02:06:17] You have not printed, nah, which tool it is using, or…?
[02:06:19] Yep.
[02:06:24] Okay, yeah, so if we have not mentioned any tool, and the answer is coming and no tool is being mentioned, so as a
[02:06:29] I hope it is coming from the currency converter only.
[02:06:32] Because other tools it will mention not this tool used, that tool used.
[02:06:36] Okay. But anyways, I saw Satish, you wanted to speak something. Yeah, Satish.
[02:06:37] Yeah, yeah, he's a token now.
[02:06:39] Uh, this time, is it okay?
[02:06:44] Ha ha ha, yeah, perfect.
[02:06:45] Okay, like, can I just share my screen?
[02:06:48] Yes, yes, definitely. Guys, we are done with the content, we are just, you know, seeing what others have done.
[02:06:54] Okay, amazing, guys. You all have literally done very good job with all these things. Wikipedia, Vineet has created a custom Wikipedia.
[02:07:00] Shikar has done a currency converter. That's creativity, guys. Okay, very good. Deepan has also.
[02:07:06] done both by RDPL as well as Wikipedia.
[02:07:09] Good.
[02:07:15] Yes, Atish, you're sharing?
[02:07:16] Yeah, I'm sharing, yeah.
[02:07:19] Okay.
[02:07:20] Yeah, can you be able to see my screen? Yeah, actually, I was running the second program, what you're given. Here, actually, when I run this
[02:07:26] particular, this agent, right? So, I was trying to call from the REPL, but it keeps repeatedly printing this number, but it's not giving them an output.
[02:07:35] Huh.
[02:07:38] Oh, no, this is a problem with RDPL. You can ask, uh,
[02:07:39] Okay.
[02:07:42] Uh, this is fine, this is fine, you have done nothing wrong. REPL has a problem.
[02:07:43] Okay. Okay.
[02:07:46] Like, it will unnecessarily try multiple times.
[02:07:49] And then you'll have to forcefully stop it.
[02:07:52] Okay.
[02:07:53] Yeah, but the result is not coming, actually, I don't…
[02:07:54] Yeah, because, uh, somehow, somehow in its expression evaluation, it is feeling.
[02:07:57] Okay.
[02:08:00] Okay, so that's why it is continuously trying, because it is not able to come up with a result.
[02:08:01] Okay, hmm.
[02:08:04] Okay, so… so…
[02:08:05] Maybe, can I give some other expression, basic expression, it will work? I don't know.
[02:08:09] Yeah, you can give, uh, what is…
[02:08:12] Yeah, just give, sometime even this also doesn't work. REPL is very unpredictable.
[02:08:13] Yeah, not okay.
[02:08:18] unpredictable, that's why.
[02:08:19] Okay.
[02:08:20] Okay. Hm.
[02:08:21] Yeah, so it will happen, it will happen, don't need to worry about it. Can you write, uh, just calculate 4 square.
[02:08:26] like write 4 square, like…
[02:08:28] Like right for F O U R.
[02:08:30] Foursquare.
[02:08:33] Let's see if this comes.
[02:08:42] Okay.
[02:08:43] See, actually, REPL is known for this. First time did you see a different way it has done? Second time, it has done differently.
[02:08:48] So, it tries out multiple expressions, then comes up with one answer.
[02:08:51] But this is a problem with REPL, it will keep on trying, so.
[02:08:52] Okay.
[02:08:55] This is a problem. So, this is fine, this is, this has nothing to do with you.
[02:08:56] Okay.
[02:08:58] Okay, but your tool is working. You have done the right tool. It is calling the right tool also.
[02:09:03] Uh, how did you give the tool and all?
[02:09:04] Okay.
[02:09:05] Yeah,
[02:09:06] Oh, you have done the change over here only, okay, okay, you have not done it.
[02:09:08] So you have to take this, maybe you can take the Wikipedia one.
[02:09:12] Or maybe take a converter.
[02:09:13] Yeah, okay, okay.
[02:09:14] And, you know, integrated in that one.
[02:09:15] Yeah, okay, okay, I will… I'll put that, actually.
[02:09:16] Okay.
[02:09:17] I was, I used to show RDPL before in the classes, but RDPL is very unpredictable.
[02:09:19] Okay.
[02:09:22] It doesn't work at the time correctly. That's why I remove from REPL, I have come to weather app and all these things.
[02:09:25] Okay, okay.
[02:09:28] Okay, but I gave you as a, as a reference point that you can use this or you can use some math tool also.
[02:09:31] Okay.
[02:09:34] or create our own, create your own custom
[02:09:36] Yeah, okay.
[02:09:37] Uh, tool as well inside that you can use LLM only. That LLM only will answer.
[02:09:40] Hmm, okay.
[02:09:43] In that tool, ok, that also you can do.
[02:09:44] Okay. Okay. I thought of actually running this and then taking input, but when I got this error, I stuck there, actually. That's why you couldn't be able to go there.
[02:09:50] Okay, okay.
[02:09:52] I understand, no problem. You don't have to, it's not your fault, REPL's issue is that, that is REPL's issue.
[02:09:53] Okay. Okay.
[02:09:58] Sometimes it works, sometimes it doesn't work.
[02:09:59] Okay, okay.
[02:10:00] Okay, okay. Thanks.
[02:10:03] Okay, okay guys, uh, thank you everyone, uh, I think a lot of new things you learned about memory.
[02:10:10] The first part we will do add two more variations of memory next day.
[02:10:14] So today we did just the full chat history. Tomorrow, next day we'll see windowed chat history. We will see summarization of memory as well.
[02:10:20] And then we will do prompt engineering, and then into LangGraph.
[02:10:25] Okay.
[02:10:27] Okay, guys, great. Thank you guys. See you next week.
[02:10:31] from the leak. Bye, everyone.
[02:10:34] All the best for your…
[02:10:36] Yeah, yeah, yeah, thank you.
[02:10:37] Go ahead. Thank you. Bye bye.
[02:10:47] Thank