1
00:00:03,590 --> 00:00:15,200
So one of the things that, uh, we software developers, uh, do a lot is to interact with external

2
00:00:15,200 --> 00:00:16,160
APIs.

3
00:00:16,160 --> 00:00:19,790
So we request data from external APIs.

4
00:00:19,790 --> 00:00:27,800
And in order to do that, until now, we have to do it by writing code and understanding the API endpoints.

5
00:00:28,280 --> 00:00:36,200
So this is a process that is really it takes time effort you know, trial and error etc..

6
00:00:36,200 --> 00:00:36,560
No.

7
00:00:36,560 --> 00:00:43,880
And now what we want is to request data from an external API using natural language.

8
00:00:44,420 --> 00:00:50,630
And as you will see, we can do this with an LM application very easily.

9
00:00:50,930 --> 00:00:54,680
And it's going to be a very simple process.

10
00:00:55,190 --> 00:01:00,620
Uh, just with these, uh, three steps here, you are going to define the API.

11
00:01:00,800 --> 00:01:07,580
You are going to create a chain, and you are going to start asking questions in natural language to

12
00:01:07,580 --> 00:01:09,770
request data to this API.

13
00:01:09,770 --> 00:01:17,900
So if you look at the right side of the screen, you see that as always we ask for the OpenAI API key

14
00:01:18,230 --> 00:01:23,000
and we start creating an instance of the LM model.

15
00:01:23,240 --> 00:01:32,870
Once we have that, and this is a crucial step, we are going to define what we can call our API documentation.

16
00:01:33,410 --> 00:01:40,760
This is very important because what we enter here is really what matters to this application.

17
00:01:40,760 --> 00:01:44,690
So in this case for example we are going to use an API.

18
00:01:45,360 --> 00:01:53,340
That is associated with a huge database with data about, you know, all the countries in the world,

19
00:01:53,340 --> 00:01:53,610
right?

20
00:01:53,610 --> 00:01:59,250
So they have information about, you know, the number of people living there, the language they speak,

21
00:01:59,250 --> 00:02:01,740
and thousands of different indicators.

22
00:02:01,740 --> 00:02:02,250
Right.

23
00:02:02,640 --> 00:02:14,040
But the only information we are going to access is the information we define here in our API documentation,

24
00:02:14,040 --> 00:02:19,770
because this is the information that is going to be passed to the GPT.

25
00:02:19,770 --> 00:02:22,710
So this is like the prompt right.

26
00:02:23,310 --> 00:02:31,290
So in this prompt what we are saying is this is the URL where the API is the base URL.

27
00:02:31,290 --> 00:02:40,950
And in this API we are going to show interest in three endpoints just in three endpoints instead of

28
00:02:40,950 --> 00:02:43,620
I don't know 100 endpoints that they provide.

29
00:02:45,540 --> 00:02:51,900
So in this case, the only thing we are telling ChatGPT that we are interested in is the name of the

30
00:02:51,900 --> 00:02:56,400
country, the currency they use and the language they speak there.

31
00:02:57,780 --> 00:02:58,860
So.

32
00:03:01,100 --> 00:03:10,850
Once we have that, the only thing we need to to do is to import a predefined chain from line chain

33
00:03:10,850 --> 00:03:11,780
called API.

34
00:03:11,810 --> 00:03:17,060
Chain this chain we are going to configure our our instance.

35
00:03:17,150 --> 00:03:23,630
Instance of this chain using the LM we created and this API documentation.

36
00:03:23,630 --> 00:03:26,090
We have configured this verbose through.

37
00:03:26,120 --> 00:03:26,990
Don't worry about that.

38
00:03:26,990 --> 00:03:30,110
You can just remove it and it will work the same.

39
00:03:30,710 --> 00:03:37,880
So once we have that we just make questions to the API.

40
00:03:38,600 --> 00:03:42,800
So we can ask this question.

41
00:03:42,800 --> 00:03:46,670
Give me information about France in less than 100 words.

42
00:03:46,820 --> 00:03:56,000
So ChatGPT is going to this external API is going to look for information about France using the endpoint.

43
00:03:56,000 --> 00:03:58,730
And it's going to provide us this summary.

44
00:03:58,730 --> 00:04:06,620
We can say we can ask questions more you know complex like list the top three biggest countries where

45
00:04:06,620 --> 00:04:08,330
the official language is French.

46
00:04:08,330 --> 00:04:12,680
So in this case they are looking for the official language.

47
00:04:12,680 --> 00:04:18,980
And also three countries, uh, from biggest to smaller.

48
00:04:19,970 --> 00:04:23,870
And probably they are using the population size here, I don't know.

49
00:04:24,080 --> 00:04:30,680
So, uh, the answer here is that the top three biggest countries with official where the official language

50
00:04:30,680 --> 00:04:34,880
is French are France, Canada and Belgium.

51
00:04:34,880 --> 00:04:41,240
And I understand that here they are using the population size, because my understanding is that Canada

52
00:04:41,240 --> 00:04:48,320
is a larger country than France in, in, in, in size.

53
00:04:48,320 --> 00:04:50,990
But, uh, well, I don't know.

54
00:04:50,990 --> 00:04:56,540
So this may be a question to, to to study further.

55
00:04:56,540 --> 00:04:56,990
Right.

56
00:04:56,990 --> 00:05:07,400
But right now what we have is a very, very simple application in order to request data from an external

57
00:05:07,400 --> 00:05:09,950
API using a natural language.

58
00:05:09,950 --> 00:05:17,840
This is really powerful and is going to change the way we as a software developers or software engineers

59
00:05:17,840 --> 00:05:19,250
work on a daily basis.

60
00:05:19,250 --> 00:05:21,050
So this is really revolutionary.

61
00:05:21,050 --> 00:05:29,720
And we are, just as I say, in the elemental, simple basic stage of LM applications.

