WEBVTT

1
00:00:01.640 --> 00:00:07.260
So, I'm in this Node Express project which I created earlier in this section and you

2
00:00:07.260 --> 00:00:12.040
find it attached by the way, so that you can start with exactly the same project setup

3
00:00:12.040 --> 00:00:13.180
as I have here.

4
00:00:13.700 --> 00:00:18.600
The exact setup theoretically isn't too important, we're not going to build a real

5
00:00:18.600 --> 00:00:23.360
app here just yet, we'll do that later, but nonetheless to have the same starting

6
00:00:23.360 --> 00:00:25.060
point you find it attached.

7
00:00:26.480 --> 00:00:31.840
And now I want to tweak that code a little bit, I want to add some new code to this project,

8
00:00:32.080 --> 00:00:36.820
change the code a little bit and of course I want to use GitHub Copilot for that.

9
00:00:38.060 --> 00:00:44.320
Now I could use the suggestions and completions feature to start writing code on my own and

10
00:00:44.320 --> 00:00:50.260
have GitHub Copilot completed and that could be very efficient, might be the most efficient

11
00:00:50.260 --> 00:00:55.700
way, but of course I could also use the chat to generate and change some code and I'll

12
00:00:55.760 --> 00:00:59.100
do that here to dive a bit into that prompt engineering part.

13
00:01:00.420 --> 00:01:07.340
So let's say we want to build an application here where we can book restaurant tables,

14
00:01:07.440 --> 00:01:12.300
we can reserve a table in a restaurant, we can also cancel that reservation and we won't

15
00:01:12.300 --> 00:01:16.620
build the entire application here, it's just a theoretical example.

16
00:01:18.160 --> 00:01:24.400
Now what we could do of course is open up the chat, the sidebar here let's say, and

17
00:01:24.400 --> 00:01:32.640
say I want to build a restaurant table booking website and hit enter.

18
00:01:34.400 --> 00:01:39.320
Now that's not very specific, sure I'm making it clear what I'm trying to build

19
00:01:40.100 --> 00:01:41.640
but that's about it.

20
00:01:41.820 --> 00:01:47.240
So therefore of course I will get back a response and it might be the response I'm looking

21
00:01:47.240 --> 00:01:49.380
for but it might also not be.

22
00:01:50.860 --> 00:01:54.680
Now for example here I'm getting instructions on how to initialize a project even though

23
00:01:54.680 --> 00:01:56.220
I already have a project.

24
00:01:57.260 --> 00:02:02.840
Now again you might be getting different results but what you can see here and what you probably

25
00:02:02.840 --> 00:02:08.639
can also see in the results you're getting is that whatever you get back here might be

26
00:02:08.639 --> 00:02:14.100
helpful but it's not really helpful for this specific project we have here.

27
00:02:16.000 --> 00:02:21.000
So let's start a new chat and I'll start by bringing in the workspace as a participant

28
00:02:21.000 --> 00:02:30.300
and then I'll say I want to build a restaurant table reservation website and I'll actually

29
00:02:30.300 --> 00:02:38.660
add a new file here in the routes folder, tables.js which is empty right now which I

30
00:02:38.560 --> 00:02:40.140
now want to reference in my chat.

31
00:02:40.560 --> 00:02:54.540
In the tables.js file add the following routes and I'll just add a couple of bullet points

32
00:02:54.540 --> 00:03:05.900
here around for creating a new reservation and then some information number of people,

33
00:03:07.480 --> 00:03:21.280
time, date, that seems reasonable, a route for deleting, canceling an existing reservation.

34
00:03:21.600 --> 00:03:26.580
Now we could add more to edit reservations but here I'll keep it simple but I'm adding

35
00:03:26.580 --> 00:03:33.600
this extra context here and that's very important context for my intent here which is in the

36
00:03:33.520 --> 00:03:39.900
end that I want the AI to generate the appropriate routes and therefore maybe we should say that.

37
00:03:40.180 --> 00:03:44.840
Maybe we should add this sentence here as context that we're building a restaurant table

38
00:03:44.840 --> 00:03:53.900
reservation website but then add more specific intent here and say generate some express

39
00:03:55.059 --> 00:04:04.360
routes for this website in the and then again I'll just add this tables.js file to be really

40
00:04:04.360 --> 00:04:11.600
clear that it's this file that should contain the routes then I'll refer to it again so

41
00:04:11.600 --> 00:04:15.480
actually now we can get rid of that since I'm referring to it here and I describe these

42
00:04:15.480 --> 00:04:16.040
routes.

43
00:04:18.160 --> 00:04:24.940
If I now hit enter, my chances are much higher that I'll get a result that's actually

44
00:04:24.940 --> 00:04:33.020
helpful for me because indeed now it understands that well it should just generate these routes

45
00:04:33.020 --> 00:04:44.660
so I can apply them here to my tables.js file, here we go, accept those changes and I got

46
00:04:44.680 --> 00:04:46.160
these basic routes.

47
00:04:46.240 --> 00:04:51.740
Of course I would yet have to add the logic, it did not do that because I did not ask it

48
00:04:51.740 --> 00:04:58.440
to do that but it set up the basic route where it tries to extract the data I specified in

49
00:04:58.440 --> 00:04:59.900
my prompt from the request.

50
00:05:00.000 --> 00:05:08.400
body and also that route for deleting a reservation and it also tells me how to adjust my main

51
00:05:08.400 --> 00:05:12.860
starting file, the root entry file, the app.js file.

52
00:05:14.040 --> 00:05:17.180
It tells me how to adjust this here.

53
00:05:17.340 --> 00:05:20.160
By the way, you can also click on a file here to be taken to it.

54
00:05:21.540 --> 00:05:29.020
And I can also apply these changes to update this file to, as you see, also bring in those

55
00:05:29.240 --> 00:05:37.760
table routes and then route requests that target slash API, which does not look like

56
00:05:37.760 --> 00:05:39.820
what I want, but anyways, to these routes.

57
00:05:41.360 --> 00:05:44.600
So for the moment, I'll accept these changes, but I'll tweak this soon.

58
00:05:45.080 --> 00:05:47.200
Indeed, I'll tweak the overall code soon.

59
00:05:48.720 --> 00:05:53.480
But this already shows you how important it is to be specific and how to add the right

60
00:05:53.480 --> 00:05:55.120
context to your prompt.

61
00:05:55.440 --> 00:05:59.880
And whilst this might seem obvious, it is indeed what many people get wrong.

62
00:06:00.680 --> 00:06:03.980
Now here's another thing many people get wrong.

