1 00:00:00,700 --> 00:00:04,430 Let's prepare a question to ask the agent. 2 00:00:05,620 --> 00:00:07,970 We will start with a programming -related 3 00:00:07,980 --> 00:00:12,210 question to see if the agent uses the Python REPL tool. 4 00:00:14,970 --> 00:00:22,640 So, question equals, generate the first 20 numbers in the Fibonacci series. 5 00:00:31,290 --> 00:00:38,540 Now, we ll use the executor to invoke the agent with the question, output equals, 6 00:00:39,370 --> 00:00:51,250 agentExecutor .invoke and the argument will be a dictionary, the keys input and 7 00:00:51,260 --> 00:00:58,700 the value fromTemplate .format of Q equals question. 8 00:00:59,690 --> 00:01:06,880 The argument Q is the parameter of the template, this is the template, it s the 9 00:01:06,890 --> 00:01:12,980 question asked by the user, I am running it, I am running the code. 10 00:01:18,390 --> 00:01:25,640 Take a look at the debugging information, this is the chain of thugs, look how it 11 00:01:25,650 --> 00:01:32,540 chose the right tool Python REPL and generated the first 20 numbers in the 12 00:01:32,550 --> 00:01:35,640 Fibonacci series very well. 13 00:01:36,450 --> 00:01:40,680 By the way, output is a dictionary with 14 00:01:40,690 --> 00:01:52,320 two keys input and output, output of input contains the template and output of 15 00:01:52,330 --> 00:02:03,980 output contains the text response of the agent, that s awesome, the agent nailed it. 16 00:02:05,470 --> 00:02:11,940 Next, let s try a current events question to see if the agent searches the web 17 00:02:11,950 --> 00:02:22,460 using DuckDuckGo, the question will be, Who is the current Prime Minister of the UK? 18 00:02:32,950 --> 00:02:40,560 I am running the code, it chose DuckDuckGo search for this task, it needs 19 00:02:40,570 --> 00:02:55,790 up to date information, very well, this is the correct answer, please ignore this 20 00:02:55,800 --> 00:03:06,590 warning for now, it has nothing to do with Langchain, React or LLMs, let s ask 21 00:03:06,600 --> 00:03:13,570 another question, something related to history so that it will choose the 22 00:03:13,580 --> 00:03:20,640 Wikipedia tool, tell me about Napoleon Bonaparte early life and I am running the 23 00:03:20,650 --> 00:03:35,890 code, very well, it has chosen Wikipedia, the agent nailed it choosing the right 24 00:03:35,900 --> 00:03:39,150 tool for each question and getting the answer right. 25 00:03:40,040 --> 00:03:44,930 Now, let s take a look at the last example to see if the chain of thoughts 26 00:03:44,940 --> 00:03:56,360 features is working as it should, in the template here, I will add answer the 27 00:03:56,370 --> 00:04:08,970 following questions in German as best you can, I am running this cell, now back to 28 00:04:08,980 --> 00:04:19,780 invoking the agent executor, I am running this code, take a look here, the agent 29 00:04:19,790 --> 00:04:25,820 chain of thoughts is clear, to answer this question in German, I will first 30 00:04:25,830 --> 00:04:31,160 gather information about Napoleon Bonaparte early life in English and then 31 00:04:31,170 --> 00:04:40,120 translate it into German, very well, this is the output translated into German, 32 00:04:40,370 --> 00:04:47,080 that s it folks, take your time to soak this all in, it s the key to becoming a 33 00:04:47,090 --> 00:04:48,440 chain LLM wizard,