1
00:00:00,040 --> 00:00:00,400
Okay.

2
00:00:00,440 --> 00:00:02,840
Next up let's work on the prompts.

3
00:00:02,960 --> 00:00:05,040
So we're going to improve the system message.

4
00:00:05,200 --> 00:00:06,920
And let me read you what we've got.

5
00:00:06,960 --> 00:00:10,320
And note again I'm using this trick of just using a global variable.

6
00:00:10,320 --> 00:00:12,960
So it's automatically going to apply everywhere earlier.

7
00:00:13,200 --> 00:00:17,280
So system message you're a helpful assistant in a clothes store.

8
00:00:17,440 --> 00:00:21,480
You should try to gently encourage the customer to try items that are on sale.

9
00:00:21,800 --> 00:00:26,640
Hats are 60% off and most other items are 60% or 50% off.

10
00:00:26,960 --> 00:00:32,240
For example, if the customer says, I'm looking to buy a hat, you could reply with something like

11
00:00:32,240 --> 00:00:32,720
wonderful!

12
00:00:32,720 --> 00:00:36,800
We have lots of hats, including several that are part of our sales event.

13
00:00:37,080 --> 00:00:42,280
Encourage the customer to buy hats if they're unsure what to get.

14
00:00:42,840 --> 00:00:45,720
Okay, so there's a lot of things going on in that system prompt.

15
00:00:45,760 --> 00:00:47,440
We're giving it information.

16
00:00:47,480 --> 00:00:49,240
We're setting the context.

17
00:00:49,280 --> 00:00:51,280
We're also giving it a tone.

18
00:00:51,280 --> 00:00:56,800
And this approach is saying if the customer says then you should reply that's giving like an example

19
00:00:56,800 --> 00:00:58,040
question answer.

20
00:00:58,040 --> 00:01:02,960
And that would be what we would call one shot prompting, giving it one question and answer that it

21
00:01:02,960 --> 00:01:04,480
should be able to replicate.

22
00:01:04,480 --> 00:01:06,200
And we mentioned that before, I think.

23
00:01:06,320 --> 00:01:12,000
So with that new system message, I can just relaunch the chat and I can say hi there.

24
00:01:13,400 --> 00:01:15,800
And of course it has the context.

25
00:01:15,800 --> 00:01:16,680
Welcome to the store.

26
00:01:16,720 --> 00:01:17,600
How can I assist you today.

27
00:01:17,600 --> 00:01:19,480
Are you looking for anything special by the way?

28
00:01:20,320 --> 00:01:23,920
These models are super eager to to to give you their information.

29
00:01:23,920 --> 00:01:26,920
We have an amazing sale going on with most items at 50% off.

30
00:01:26,960 --> 00:01:29,120
Our hats are incredible, 60% off.

31
00:01:29,600 --> 00:01:32,520
I'm not sure what to get.

32
00:01:33,680 --> 00:01:35,440
Maybe a shirt.

33
00:01:36,160 --> 00:01:36,560
Uh.

34
00:01:39,040 --> 00:01:39,200
Uh.

35
00:01:39,200 --> 00:01:39,720
Great choice.

36
00:01:39,720 --> 00:01:41,320
We have fantastic selection of shirts.

37
00:01:41,320 --> 00:01:45,560
Most of them are currently 50% off during our sale, but if you're open to it, I recommend checking

38
00:01:45,560 --> 00:01:46,520
out our hats.

39
00:01:47,760 --> 00:01:49,480
So it's doing what we asked for.

40
00:01:49,560 --> 00:01:51,400
It's encouraging the hats.

41
00:01:51,560 --> 00:01:58,120
Uh, and you can see that it's that it's very it's persistent and it's reflecting the information we

42
00:01:58,160 --> 00:01:59,920
gave it and also the tone.

43
00:02:00,160 --> 00:02:00,520
All right.

44
00:02:00,520 --> 00:02:01,360
Let's keep going.

45
00:02:01,360 --> 00:02:07,960
We're going to add to the system message some more information If the customer asks for shoes, you

46
00:02:07,960 --> 00:02:14,040
should respond that shoes are not on sale today, but remind the customer to look for hats.

47
00:02:14,400 --> 00:02:15,080
Okay.

48
00:02:15,600 --> 00:02:19,760
Uh, so this this, uh, because it's giving more examples.

49
00:02:19,760 --> 00:02:24,920
This is the beginning of what you might call multi-shot prompting, because we're starting to give it

50
00:02:24,960 --> 00:02:28,200
different examples of how it should handle different situations.

51
00:02:28,200 --> 00:02:33,960
So I could say, hi there and welcome to the store, a fantastic sales event including hats.

52
00:02:34,120 --> 00:02:35,680
Uh, I'd like to buy some shoes.

53
00:02:36,440 --> 00:02:36,760
Right.

54
00:02:36,800 --> 00:02:38,040
Some shoes.

55
00:02:40,240 --> 00:02:45,360
Uh, we don't have shoes on sale today, but I encourage you to look at our amazing collection of hats.

56
00:02:46,000 --> 00:02:46,680
There we go.

57
00:02:46,720 --> 00:02:48,440
All right, we get the message.

58
00:02:48,440 --> 00:02:49,240
Thank you.

59
00:02:49,280 --> 00:02:51,480
All right, let's do one little bit more.

60
00:02:51,600 --> 00:02:58,880
So you can also dynamically change the system prompt depending on what's happening in the conversation.

61
00:02:59,280 --> 00:03:01,240
Uh, you can probably imagine this.

62
00:03:01,240 --> 00:03:05,760
This might be a bit of an aha moment, but look, this is super hacky and you wouldn't do something

63
00:03:05,760 --> 00:03:06,920
like this in real life.

64
00:03:06,960 --> 00:03:08,650
It's it's is to show the point.

65
00:03:08,650 --> 00:03:10,130
And this is a doorway.

66
00:03:10,130 --> 00:03:13,610
This is a path to many bigger things we'll be doing soon.

67
00:03:13,610 --> 00:03:14,450
But look at this.

68
00:03:14,450 --> 00:03:15,770
Look at what I'm going to do here.

69
00:03:15,810 --> 00:03:21,010
I'm taking a new system message called Relevant system message.

70
00:03:21,730 --> 00:03:29,890
If the word belt appears in the message that the user is making, then I'm going to change the system

71
00:03:29,890 --> 00:03:33,650
message to add in this this extra bit of information.

72
00:03:33,690 --> 00:03:36,010
The store does not sell belts.

73
00:03:36,010 --> 00:03:40,650
If you are asked for belts, be sure to point out other items on sale.

74
00:03:41,130 --> 00:03:45,450
Uh, so that only goes in if they ask for belt.

75
00:03:45,490 --> 00:03:45,650
Now.

76
00:03:45,650 --> 00:03:48,410
Obviously, as I said, this is a silly example because it's only a little bit of text.

77
00:03:48,450 --> 00:03:52,890
You might as well always put it in, but I want to highlight the point, so I put that in there.

78
00:03:52,890 --> 00:03:54,770
Otherwise this is exactly the same.

79
00:03:54,810 --> 00:03:59,010
Oh look I see I'm missing that, that that cleanup thing which if you're on Gemini that would annoy

80
00:03:59,010 --> 00:03:59,130
you.

81
00:03:59,130 --> 00:04:01,210
So let's just go and add that in right here.

82
00:04:01,570 --> 00:04:05,410
Uh, this little line here that that scrubs the history.

83
00:04:05,410 --> 00:04:06,570
We should have that as well.

84
00:04:06,610 --> 00:04:08,170
It's good for you to see me doing this.

85
00:04:08,530 --> 00:04:10,890
Just put it right up at the top there like that.

86
00:04:11,210 --> 00:04:14,330
Okay, so now let's run this.

87
00:04:16,050 --> 00:04:18,610
And now we will do this again.

88
00:04:19,170 --> 00:04:21,170
And we will say hi there.

89
00:04:24,450 --> 00:04:24,850
Okay.

90
00:04:24,850 --> 00:04:26,130
And it says welcome to our store.

91
00:04:26,130 --> 00:04:28,970
How can I assist you a fantastic sale especially hats.

92
00:04:29,010 --> 00:04:30,690
Are you looking for anything special.

93
00:04:30,690 --> 00:04:35,330
So I'll say uh, how are your shoes?

94
00:04:36,690 --> 00:04:37,890
Are shoes are great quality.

95
00:04:37,930 --> 00:04:38,530
Very comfortable.

96
00:04:38,530 --> 00:04:43,090
I should mention not on sale today, but if you're interested, we have a great selection of hats.

97
00:04:43,130 --> 00:04:44,490
Stylish hats.

98
00:04:44,530 --> 00:04:46,730
Perfect addition to your wardrobe.

99
00:04:46,970 --> 00:04:51,370
Actually, I think I want a belt.

100
00:04:54,170 --> 00:04:57,290
We actually don't carry belts in our store.

101
00:04:57,290 --> 00:04:59,850
But I'd love to help you find something else you might like.

102
00:04:59,890 --> 00:05:02,890
Fantastic sale going on and hats are incredible.

103
00:05:02,930 --> 00:05:04,130
60% off.

104
00:05:05,210 --> 00:05:06,410
All right, all right.

105
00:05:06,410 --> 00:05:07,330
It got the message.

106
00:05:07,370 --> 00:05:14,650
And so you can see, of course, the what happened here is that because I had the word belt in my my

107
00:05:14,650 --> 00:05:15,290
message.

108
00:05:15,530 --> 00:05:20,530
The system prompt had this inserted in there, this extra piece of information.

109
00:05:20,850 --> 00:05:23,450
So, so really that's that's a wrap on the lab.

110
00:05:23,450 --> 00:05:30,130
And I just want to, to just press home how important what we just did was this, this last little step

111
00:05:30,130 --> 00:05:36,210
of adding in a bit of extra context, if we needed to, to to equip the model with more information.

112
00:05:36,410 --> 00:05:40,050
This is your first glimpse into the world of rag.

113
00:05:40,210 --> 00:05:41,210
Rag which?

114
00:05:41,250 --> 00:05:42,050
Which people?

115
00:05:42,090 --> 00:05:44,050
It sounds like it's something so sophisticated.

116
00:05:44,170 --> 00:05:51,850
It's not anything much more than just saying, let's try and figure out a smart way to shove relevant

117
00:05:51,850 --> 00:05:57,370
information into the prompt, into the system prompt, which is going to equip our model to give better

118
00:05:57,370 --> 00:05:58,010
answers.

119
00:05:58,010 --> 00:06:03,090
And all of the trickery and Rag is about figuring out how can you do something a little bit better than

120
00:06:03,130 --> 00:06:04,650
something janky like this?

121
00:06:04,690 --> 00:06:10,570
If belt is, if the text belt is somehow in the user's question, obviously that's going to be very

122
00:06:10,610 --> 00:06:12,210
hacky and sometimes it will work.

123
00:06:12,210 --> 00:06:16,010
But if the user doesn't use the word belt, but says something else.

124
00:06:16,370 --> 00:06:17,490
Then it's just not going to work.

125
00:06:17,490 --> 00:06:19,850
And it relied on me turning it to lowercase.

126
00:06:20,010 --> 00:06:24,570
And so, you know, there's so much about this that's hokey, and rag is about doing something a bit

127
00:06:24,570 --> 00:06:28,850
more bulletproof and smart to select relevant context.

128
00:06:29,130 --> 00:06:32,570
And you might say, why not just always put this in the system prompt?

129
00:06:32,610 --> 00:06:33,410
You could do.

130
00:06:33,410 --> 00:06:39,130
But if this was a store which had a thousand different products, then your prompt would become bigger

131
00:06:39,130 --> 00:06:39,890
and bigger and bigger.

132
00:06:39,890 --> 00:06:45,210
With all of this information and the model's accuracy would start to degrade and you'd be spending extra

133
00:06:45,210 --> 00:06:47,130
tokens and it wouldn't be worth it.

134
00:06:47,170 --> 00:06:54,290
So this idea of selecting relevant context and adding it to the prompt a powerful technique.

135
00:06:54,290 --> 00:06:56,130
It is an inference time technique.

136
00:06:56,170 --> 00:06:57,730
It's got nothing to do with training the model.

137
00:06:57,730 --> 00:06:59,090
We're using the same model.

138
00:06:59,090 --> 00:07:06,490
We're finding clever ways to insert relevant information into the prompt to to educate the model, to

139
00:07:06,530 --> 00:07:10,130
give it expertise so it can answer questions accurately.

140
00:07:10,170 --> 00:07:14,210
Taking advantage of the fact, in this case, that the store doesn't sell any belts.

141
00:07:14,410 --> 00:07:19,970
And it brings me to the final point, which is the business applications of this are never ending.

142
00:07:20,330 --> 00:07:26,090
Conversational agents, conversational assistants, of course, super popular use case and the frontier

143
00:07:26,130 --> 00:07:33,050
models are so good out of the box at giving good answers, and the way that you can add value for your

144
00:07:33,050 --> 00:07:36,930
business is by adding expertise into the prompts.

145
00:07:36,970 --> 00:07:38,010
Of course.

146
00:07:38,010 --> 00:07:40,810
So, you know, that's how this becomes something better than salespeople.

147
00:07:40,810 --> 00:07:46,890
Just go to ChatGPT because you're able to add things, add content into the prompting to make it applicable

148
00:07:46,890 --> 00:07:51,450
to your business, and so that that is the to do for you.

149
00:07:51,490 --> 00:07:56,810
Figure out how could you build something, use this for your business or for your your home work or

150
00:07:56,810 --> 00:08:03,330
whatever, but it should be super easy to knock up a demo of having something which is answering questions,

151
00:08:03,330 --> 00:08:08,770
maybe doing a sidekick for some work that you do have something which which takes information in and

152
00:08:08,810 --> 00:08:15,610
is able to give expertise and be applied, applied specifically to your business area, to your business

153
00:08:15,610 --> 00:08:21,020
problems, with expertise in the prompt and a lot of what we're going to be doing over the course of

154
00:08:21,020 --> 00:08:27,180
the next eight weeks is about figuring out how can we, in an automatic way, improve these prompts

155
00:08:27,180 --> 00:08:32,540
to to educate our model better and better about our business and our situation?

156
00:08:32,580 --> 00:08:36,500
These are all the inference time techniques that allow you to get more from a model.

157
00:08:36,500 --> 00:08:38,860
But you've got enough right now to be building something.

158
00:08:38,860 --> 00:08:40,940
And so you should you should build something.

159
00:08:40,940 --> 00:08:42,740
You should put it in community contributions.

160
00:08:42,740 --> 00:08:43,820
You should share it.

161
00:08:43,900 --> 00:08:47,980
You also know now that in Gradio you can just put share equals true and other people can use it.

162
00:08:47,980 --> 00:08:51,860
You can use auth equals to add in some user ID and password should you wish.

163
00:08:52,060 --> 00:08:56,220
Uh and you should not only should you, you must go and do this.

164
00:08:56,220 --> 00:08:57,580
I insist and share it.

165
00:08:57,580 --> 00:09:01,940
Post it on LinkedIn so I can weigh in and I'll have a play with it as well, which I always enjoy.

166
00:09:02,100 --> 00:09:04,780
And I can't wait to see what you build.

167
00:09:04,820 --> 00:09:06,260
And I'll see you for the wrap up.

168
00:09:06,260 --> 00:09:08,620
And so that's it for week two, day three.

169
00:09:08,660 --> 00:09:11,460
And I would describe week two, day three as short and sweet.

170
00:09:11,500 --> 00:09:14,020
It was it was quite short and it was very sweet.

171
00:09:14,340 --> 00:09:15,180
At least I thought so.

172
00:09:15,220 --> 00:09:21,180
So you have reached the 20% point and hopefully you feel like a bit About 20%.

173
00:09:21,220 --> 00:09:22,740
You feel like you've got.

174
00:09:22,780 --> 00:09:25,020
You've got some material under your belt.

175
00:09:25,500 --> 00:09:26,380
Talking about belts.

176
00:09:26,660 --> 00:09:33,340
Uh, so, you know, you've got some skills, you know, the foundations of the sort of transformer

177
00:09:33,340 --> 00:09:33,900
space.

178
00:09:34,100 --> 00:09:37,020
Talk about tokens and contacts, windows and all that kind of stuff.

179
00:09:37,260 --> 00:09:41,940
Uh, you you can code with the chat completions API with frontier models.

180
00:09:41,940 --> 00:09:48,860
You know them well, and you can build now an AI chatbot assistant with an interactive UI.

181
00:09:48,900 --> 00:09:55,020
You can even share it and give it security, uh, at least basically, uh, and you also know how to

182
00:09:55,060 --> 00:10:01,140
deal with things like multi-shot prompting to give it examples and you know how to to mess around with

183
00:10:01,140 --> 00:10:06,820
the system prompt, adding in information as relevant to try and give it expertise.

184
00:10:06,980 --> 00:10:07,660
Wow.

185
00:10:07,820 --> 00:10:08,660
It's a lot.

186
00:10:08,940 --> 00:10:13,540
But next time, next time we get to tools and tools is such a big deal.

187
00:10:13,540 --> 00:10:20,580
And of course, particularly for for Agentic AI, uh, it's going to be your first first look at using

188
00:10:20,660 --> 00:10:21,180
tools.

189
00:10:21,220 --> 00:10:22,540
Super exciting.

190
00:10:22,580 --> 00:10:23,540
See you tomorrow.