1
00:00:03,160 --> 00:00:12,970
In this basic application, this basic Elm application, we are going to ask using natural language,

2
00:00:13,240 --> 00:00:15,070
a database.

3
00:00:15,070 --> 00:00:18,280
We are going to to ask questions to a database.

4
00:00:18,280 --> 00:00:25,150
And this is really revolutionary because until now, as you know we are having this problem.

5
00:00:25,150 --> 00:00:31,330
So to get information from a database we had to use complex languages like SQL etc..

6
00:00:31,330 --> 00:00:38,500
So this limited a lot the type of people that can ask questions to a database.

7
00:00:38,500 --> 00:00:44,320
If you are not familiar with the SQL language, you cannot do anything in this in this field, right?

8
00:00:44,320 --> 00:00:51,040
But now what we want is that anyone in our company, anyone in our organization, using natural language

9
00:00:51,040 --> 00:00:55,360
or common language, common English, can ask questions from a database.

10
00:00:55,360 --> 00:00:56,860
This is a revolutionary.

11
00:00:57,550 --> 00:01:02,440
So launching can do this in a very, very simple way.

12
00:01:02,440 --> 00:01:09,460
As you will see we are going to use a predefined chain and it will do the job for us.

13
00:01:09,460 --> 00:01:12,910
So the process is going to be very, very simple.

14
00:01:12,910 --> 00:01:15,010
We are going to load the database.

15
00:01:15,010 --> 00:01:21,790
We are going to create a predefined chain and going to we are going to start asking questions in natural

16
00:01:21,790 --> 00:01:22,480
language.

17
00:01:22,480 --> 00:01:29,950
So if you look at the code in the right side of the screen, the first thing we do is to load the OpenAI

18
00:01:29,950 --> 00:01:34,600
API AP api key as we do always.

19
00:01:34,600 --> 00:01:41,800
And once that is complete, we uh, we are going to load.

20
00:01:41,800 --> 00:01:45,400
Well, we are going to create an instance of the of the Elm.

21
00:01:45,520 --> 00:01:50,320
And uh, we are going to import a couple of components.

22
00:01:50,320 --> 00:01:55,480
One is SQL database and the other one is SQL database chain.

23
00:01:55,810 --> 00:02:01,930
This second one we are getting it from long chain experimental okay.

24
00:02:01,930 --> 00:02:07,450
So this is not the, uh, final approved version of long chain.

25
00:02:07,450 --> 00:02:17,230
This is just like a candidate, uh, for, uh, you know, uh, a final version of a long chain.

26
00:02:17,800 --> 00:02:22,930
This is we are using this way because it's interesting for us right now.

27
00:02:22,930 --> 00:02:27,280
You will see that we have different, many different options in next chapters.

28
00:02:27,280 --> 00:02:29,860
But right now this serves us well.

29
00:02:29,860 --> 00:02:33,880
So the first thing we do is to load the database.

30
00:02:34,420 --> 00:02:42,100
And once we have that, the only thing we have to do is to create a chain using this SQL database chain

31
00:02:42,640 --> 00:02:45,730
and chain does everything for us in this change.

32
00:02:45,730 --> 00:02:49,540
In this chain we enter the Elm and the database.

33
00:02:49,540 --> 00:02:53,080
This one is is is nothing but was true.

34
00:02:53,110 --> 00:02:56,350
We can just remove this thing here.

35
00:02:56,350 --> 00:03:00,880
And the only thing we have to do is to execute this chain.

36
00:03:01,180 --> 00:03:03,760
Once we execute this chain.

37
00:03:03,760 --> 00:03:05,290
And with a question.

38
00:03:06,100 --> 00:03:10,300
ChatGPT starts providing responses.

39
00:03:10,300 --> 00:03:13,870
So if we ask the database we have loaded.

40
00:03:13,870 --> 00:03:24,010
Here is a short version of a public database from the, uh, San Francisco city.

41
00:03:24,910 --> 00:03:31,060
So in this database we have information about the trees in the city, blah blah, blah, blah.

42
00:03:31,060 --> 00:03:31,690
Right.

43
00:03:31,690 --> 00:03:38,080
This is a huge database we have reduced with only 1000 rows.

44
00:03:38,080 --> 00:03:42,130
I think the original one has like 80,000 rows or something like that.

45
00:03:42,460 --> 00:03:45,790
So we are making a couple of questions.

46
00:03:46,090 --> 00:03:49,960
The first one is how many species of trees are in San Francisco.

47
00:03:49,960 --> 00:03:54,850
The second one, how many trees of the species Ficus nitida are in San Francisco.

48
00:03:55,030 --> 00:04:01,930
This is the answer that ChatGPT is going to provide, and in both cases the answers are correct.

49
00:04:02,440 --> 00:04:11,290
We can check that the answers are correct if we are use if we use SQL, for example, or if we use a

50
00:04:11,500 --> 00:04:19,450
Gpt4, we load the database as a file in ChatGPT four and we ask questions about that.

51
00:04:19,450 --> 00:04:24,370
The difference of doing this or using the long chain approach is that with the long chain approach,

52
00:04:24,370 --> 00:04:27,940
we don't need to load the whole database to long chain.

53
00:04:27,940 --> 00:04:34,150
And the process of searching information is going to be much more convenient in terms of time and cost,

54
00:04:34,150 --> 00:04:34,720
etc..

55
00:04:34,720 --> 00:04:35,140
Right?

56
00:04:35,140 --> 00:04:44,290
So as you can see, a long chain has a another, uh, very easy and fast way to solve a very important

57
00:04:44,290 --> 00:04:45,070
problem for us.

58
00:04:45,070 --> 00:04:53,290
So imagine in every company and organization that has this huge, uh, databases that until now were

59
00:04:53,290 --> 00:04:57,490
reserved for the software guys, you know, the database guys.

60
00:04:57,490 --> 00:04:59,710
And now they are available for everybody.

61
00:04:59,710 --> 00:05:04,930
You know, the CEO, people in the finance department, in the marketing department, everybody in the

62
00:05:04,930 --> 00:05:08,020
company can start making questions to the database.

63
00:05:08,020 --> 00:05:10,330
It is really, really amazing.

