1
00:00:00,000 --> 00:00:00,000
Guys.

2
00:00:00,000 --> 00:00:02,000
Here is an amazing crash course on Amazon.

3
00:00:02,000 --> 00:00:03,000
Bedrock.

4
00:00:03,000 --> 00:00:05,000
Uh, many people were requesting for this.

5
00:00:05,000 --> 00:00:08,000
Uh, now, what exactly is Amazon bedrock?

6
00:00:08,000 --> 00:00:14,000
It is the easiest way to build and scale generative AI applications within your AWS platform itself,

7
00:00:14,000 --> 00:00:15,000
right?

8
00:00:15,000 --> 00:00:16,000
Right.

9
00:00:16,000 --> 00:00:18,000
Now many companies are using this.

10
00:00:18,000 --> 00:00:23,000
They are using this because understand one thing that there are so many different, different companies

11
00:00:23,000 --> 00:00:29,000
who are providing LLM models for or LLM models for different different text generation and image generation

12
00:00:29,000 --> 00:00:29,000
task.

13
00:00:29,000 --> 00:00:32,000
Right there is open eye, there is cloudy two.

14
00:00:32,000 --> 00:00:35,000
There is Google, there is even.

15
00:00:35,000 --> 00:00:39,000
Amazon also has its own LM model which is named as Titan.

16
00:00:39,000 --> 00:00:42,000
And similarly there is also Facebook which is like llama two model.

17
00:00:42,000 --> 00:00:45,000
So understand each and every thing is that.

18
00:00:45,000 --> 00:00:49,000
What is the main problem right now if you want to use these APIs, if you want to use these models,

19
00:00:49,000 --> 00:00:53,000
everybody has a different, different setup right now.

20
00:00:53,000 --> 00:00:55,000
What Amazon Bedrock actually provides you.

21
00:00:55,000 --> 00:01:02,000
It provides you one AWS platform where all the models will be available, and through their API calls.

22
00:01:02,000 --> 00:01:04,000
You can probably use any of this kind of models.

23
00:01:04,000 --> 00:01:09,000
Right now, OpenAI is not there, but other than that, I could see almost each and every model that

24
00:01:09,000 --> 00:01:11,000
was available in Amazon bedrock.

25
00:01:12,000 --> 00:01:18,000
Now, why this is important because a single platform here, you don't have to worry about scalability.

26
00:01:18,000 --> 00:01:20,000
You don't have to worry about other things.

27
00:01:21,000 --> 00:01:25,000
Uh, with respect to the cost, that is, uh, uh, in the Amazon bedrock, right?

28
00:01:25,000 --> 00:01:28,000
It is slightly more than the OpenAI.

29
00:01:28,000 --> 00:01:33,000
And probably in the future it may also get reduced, but at the end of the day, you should know what

30
00:01:33,000 --> 00:01:34,000
exactly Amazon Bedrock is.

31
00:01:34,000 --> 00:01:39,000
And probably I'll show you in this particular video different, different tasks.

32
00:01:39,000 --> 00:01:42,000
I will try to code it, and I'll try to show you how you can use these APIs itself.

33
00:01:42,000 --> 00:01:47,000
So here is what is Amazon Bedrock and easiest way to build and scale generative AI application with

34
00:01:47,000 --> 00:01:48,000
Foundation model.

35
00:01:48,000 --> 00:01:50,000
I'll also discuss about what are this foundation models.

36
00:01:50,000 --> 00:01:55,000
As I said, so many different different companies are coming up with some LLM models instead.

37
00:01:55,000 --> 00:01:57,000
So that is the foundation model.

38
00:01:57,000 --> 00:01:58,000
You can do the fine tuning here itself.

39
00:01:58,000 --> 00:02:04,000
You can use any of these models, perform any task, and even directly you can use it in your application

40
00:02:04,000 --> 00:02:05,000
wherever it is required.

41
00:02:05,000 --> 00:02:12,000
Okay, so if I talk about, uh, Amazon Bedrock, it is fully managed service that makes FMS.

42
00:02:12,000 --> 00:02:16,000
That is foundation models from leading AI startup and Amazon available via an API.

43
00:02:16,000 --> 00:02:22,000
So you can choose from a wide range of FMS to find the model that is best suited for your case.

44
00:02:22,000 --> 00:02:25,000
So with bedrock serverless experience, you can start quickly.

45
00:02:25,000 --> 00:02:31,000
Privately customize a FME Foundation model with your own data and easily integrate and deploy them in

46
00:02:31,000 --> 00:02:33,000
your application using AWS tools.

47
00:02:33,000 --> 00:02:38,000
So here you don't have to even worry about the deployment, the scalability, and everything as such.

48
00:02:38,000 --> 00:02:42,000
So, uh, let me just go ahead and click on Get Started.

49
00:02:42,000 --> 00:02:46,000
So this is how it looks like now what all companies it specifically support.

50
00:02:46,000 --> 00:02:48,000
Because I'm also going to show you the entire coding also.

51
00:02:48,000 --> 00:02:52,000
Right how you can use all these models right now in this foundation model.

52
00:02:52,000 --> 00:02:55,000
Uh, there are different different models like from AI 21 labs.

53
00:02:55,000 --> 00:02:58,000
You can see Jurassic two series is there from Amazon.

54
00:02:58,000 --> 00:02:59,000
You have Titan models.

55
00:02:59,000 --> 00:03:03,000
From cloudy you have this cloudy models by Andrew Anthropic.

56
00:03:03,000 --> 00:03:04,000
Uh, you have llama two.

57
00:03:04,000 --> 00:03:08,000
You have stable diffusion by stability AI you have this command by cohere.

58
00:03:08,000 --> 00:03:13,000
So this through this you will be able to perform different different use cases like chat text image.

59
00:03:13,000 --> 00:03:14,000
Right.

60
00:03:14,000 --> 00:03:16,000
And it also provides you hands on lab.

61
00:03:16,000 --> 00:03:20,000
Uh along with that some kind of learning curves, some basic learning course, which you can probably

62
00:03:20,000 --> 00:03:21,000
get started to.

63
00:03:21,000 --> 00:03:23,000
Now here are some of the examples.

64
00:03:23,000 --> 00:03:28,000
Here you can see what all, uh, different different use cases you can solve with respect to different

65
00:03:28,000 --> 00:03:28,000
different models.

66
00:03:28,000 --> 00:03:29,000
Right.

67
00:03:29,000 --> 00:03:33,000
So with the help of Titan text G1, you can see action items from a meeting.

68
00:03:33,000 --> 00:03:33,000
Transcript.

69
00:03:33,000 --> 00:03:35,000
Advanced Q&A with citation.

70
00:03:36,000 --> 00:03:38,000
Uh with llama two chat 13 B right.

71
00:03:38,000 --> 00:03:41,000
This 13 billion parameters you have you can create chain of thoughts.

72
00:03:41,000 --> 00:03:46,000
Then here also you have with 70 billion parameters with cloud you can have character load, role play,

73
00:03:47,000 --> 00:03:51,000
code generation, content generation, contract entity extraction.

74
00:03:51,000 --> 00:03:53,000
Create an image, create an image.

75
00:03:53,000 --> 00:03:55,000
Here you can see creating a table of product description.

76
00:03:56,000 --> 00:04:00,000
Uh, then you have debug code with llama 230 uh 13 billion parameters llama two chat.

77
00:04:00,000 --> 00:04:03,000
Then you have Jurassic, then you have this right.

78
00:04:03,000 --> 00:04:07,000
So as soon as you probably click on anything, let's say I want to go and see that how it is going to

79
00:04:07,000 --> 00:04:08,000
create an image.

80
00:04:08,000 --> 00:04:10,000
So here it is, what it looks like, right?

81
00:04:10,000 --> 00:04:13,000
This is the entire API request that you have to probably call.

82
00:04:13,000 --> 00:04:19,000
And with the help of this this image will be generated let's say I will probably let's see here okay

83
00:04:19,000 --> 00:04:23,000
I can open this in playground and I can give my own.

84
00:04:23,000 --> 00:04:29,000
So HD image of a beach.

85
00:04:29,000 --> 00:04:34,000
So this is the playground where you can with a sunset.

86
00:04:34,000 --> 00:04:38,000
With sunrise, I can basically write like this.

87
00:04:38,000 --> 00:04:38,000
Right.

88
00:04:38,000 --> 00:04:42,000
So as soon as I give this prompt and if I run it, you will be able to see that I'll be able to see

89
00:04:42,000 --> 00:04:43,000
this entire image.

90
00:04:43,000 --> 00:04:45,000
So it actually creates this.

91
00:04:45,000 --> 00:04:47,000
This is from the stable diffusion itself.

92
00:04:47,000 --> 00:04:47,000
Right.

93
00:04:47,000 --> 00:04:51,000
So here you'll be able to see once we wait, it, uh, we'll be able to run it.

94
00:04:51,000 --> 00:04:54,000
And now here you can see this is an amazing image that is created.

95
00:04:54,000 --> 00:04:59,000
And you can use HD image, cinematic display, all different, different things you can probably put

96
00:04:59,000 --> 00:05:00,000
over here.

97
00:05:00,000 --> 00:05:03,000
Uh, I still go with respect to the overviews.

98
00:05:03,000 --> 00:05:06,000
So as I showed all this is there are there examples.

99
00:05:06,000 --> 00:05:08,000
You can probably see all these things are there.

100
00:05:08,000 --> 00:05:10,000
You can go ahead and check out in the playground.

101
00:05:10,000 --> 00:05:13,000
Let's say there is something called as creating table or product description.

102
00:05:13,000 --> 00:05:16,000
Here you can see this is the prompt right.

103
00:05:16,000 --> 00:05:18,000
Sunglasses keywords polarized is this is there.

104
00:05:18,000 --> 00:05:20,000
Let's say this is your table.

105
00:05:20,000 --> 00:05:25,000
You can probably ask any kind of questions and get with respect to the answers also over here right.

106
00:05:25,000 --> 00:05:26,000
So different different use cases is there.

107
00:05:26,000 --> 00:05:28,000
At the end of the day I'll just not show you this APIs.

108
00:05:28,000 --> 00:05:31,000
Now let's go ahead and implement all these things right.

109
00:05:31,000 --> 00:05:36,000
And there steps, some steps which uh we will be seeing completely from scratch again.

110
00:05:36,000 --> 00:05:39,000
Uh, you can use any of these services as such.

111
00:05:39,000 --> 00:05:39,000
Yes.

112
00:05:39,000 --> 00:05:43,000
There is some pricing because at the end of the day you're using some cloud services, right?

113
00:05:43,000 --> 00:05:46,000
It always depends on the tokens that you are specifically getting.

114
00:05:46,000 --> 00:05:49,000
So based on that, Amazon bedrock basically charges you.

115
00:05:49,000 --> 00:05:54,000
So if you want to see the pricing you can probably go ahead over here and right Amazon Bedrock.

116
00:05:54,000 --> 00:05:56,000
And you can click on pricing right.

117
00:05:56,000 --> 00:06:00,000
So bedrock pricing here is the link.

118
00:06:00,000 --> 00:06:02,000
Here you'll be able to see the pricing overview.

119
00:06:02,000 --> 00:06:04,000
Different different pricing is there.

120
00:06:04,000 --> 00:06:07,000
And this is 4000 input tokens right.

121
00:06:07,000 --> 00:06:08,000
Price per thousand.

122
00:06:08,000 --> 00:06:10,000
Output tokens, input tokens output tokens.

123
00:06:10,000 --> 00:06:12,000
So all these prices is there.

124
00:06:12,000 --> 00:06:14,000
You can compare it with OpenAI models and all.

125
00:06:14,000 --> 00:06:18,000
But still this pricing will get reduced as we go ahead.

126
00:06:18,000 --> 00:06:19,000
More custom solutions will probably come up.

127
00:06:19,000 --> 00:06:20,000
Right.

128
00:06:20,000 --> 00:06:22,000
So this is they're all good things.

129
00:06:22,000 --> 00:06:26,000
And you'll also be able to understand uh, see Titan is also having this multi model embeddings.

130
00:06:26,000 --> 00:06:31,000
But at the end of the day we should know that how we can actually create entirely, completely from

131
00:06:31,000 --> 00:06:32,000
scratch.

132
00:06:32,000 --> 00:06:38,000
So let me go ahead and start, uh, this let's see whether I've opened any VSCode or not.

133
00:06:38,000 --> 00:06:44,000
So I will go ahead and start my VSCode.

134
00:06:46,000 --> 00:06:49,000
Um, so let's see over here.

135
00:06:49,000 --> 00:06:51,000
Here is our folder that I've created over here.

136
00:06:51,000 --> 00:06:56,000
Let me rename this to, uh, AWS bedrock.

137
00:06:56,000 --> 00:06:57,000
Okay.

138
00:06:57,000 --> 00:06:59,000
And let me show you.

139
00:06:59,000 --> 00:07:00,000
Okay.

140
00:07:01,000 --> 00:07:03,000
Um, bedrock.

141
00:07:03,000 --> 00:07:03,000
Okay.

142
00:07:03,000 --> 00:07:07,000
And, uh, let me just quickly show you how you can probably start it.

143
00:07:07,000 --> 00:07:07,000
Okay?

144
00:07:07,000 --> 00:07:13,000
So I'll show you the entire setup from starting and all what all things is basically required over here.

145
00:07:13,000 --> 00:07:16,000
And, uh, you also require an IAM key over here itself.

146
00:07:16,000 --> 00:07:17,000
Right.

147
00:07:17,000 --> 00:07:19,000
So first of all, I will open the terminal.

148
00:07:19,000 --> 00:07:23,000
Now after opening the terminal over here, I will open the command prompt.

149
00:07:23,000 --> 00:07:24,000
As usual.

150
00:07:24,000 --> 00:07:27,000
We will go ahead and create a new environment.

151
00:07:27,000 --> 00:07:28,000
That is always a good idea.

152
00:07:28,000 --> 00:07:29,000
Okay.

153
00:07:29,000 --> 00:07:39,000
So for creating a new environment I'll write conda create minus p v n v python double equal to 3.10

154
00:07:39,000 --> 00:07:40,000
with y.

155
00:07:40,000 --> 00:07:41,000
Okay.

156
00:07:41,000 --> 00:07:42,000
So I hope everybody knows about this.

157
00:07:42,000 --> 00:07:45,000
So this will basically create my V and v environment.

158
00:07:45,000 --> 00:07:48,000
And once that environment is created I will activate it.

159
00:07:48,000 --> 00:07:53,000
Till then I will also go ahead and install requirements dot txt.

160
00:07:54,000 --> 00:07:59,000
Okay so once I install requirement dot txt I will be requiring some libraries like Boto3.

161
00:07:59,000 --> 00:08:04,000
So Boto3 is a library which will actually help me to connect all the services that we have in Amazon

162
00:08:04,000 --> 00:08:05,000
bedrock.

163
00:08:05,000 --> 00:08:05,000
Right.

164
00:08:05,000 --> 00:08:07,000
Uh, AWS bedrock also.

165
00:08:07,000 --> 00:08:13,000
So this is some of the things, uh, along with this, uh, I will also go ahead and import or install

166
00:08:14,000 --> 00:08:14,000
AWS CLI.

167
00:08:14,000 --> 00:08:15,000
Right.

168
00:08:15,000 --> 00:08:19,000
So guys, now after creating the environment I will go ahead and activate the environment.

169
00:08:19,000 --> 00:08:21,000
So V and V.

170
00:08:21,000 --> 00:08:23,000
So my environment has been activated.

171
00:08:23,000 --> 00:08:28,000
Now what I'm actually going to do over here I'll save this requirement dot txt.

172
00:08:28,000 --> 00:08:33,000
And then we will go ahead and install these two libraries.

173
00:08:33,000 --> 00:08:39,000
One is pip install pip install minus our requirement dot txt.

174
00:08:39,000 --> 00:08:44,000
So once I specifically install all these requirements one is two two only libraries are required Boto3

175
00:08:44,000 --> 00:08:46,000
and aws cli.

176
00:08:46,000 --> 00:08:54,000
Now the next thing till this requirement is getting installed, we also need to create and IAM user

177
00:08:54,000 --> 00:08:58,000
so that we will be able to configure it with the AWS itself.

178
00:08:58,000 --> 00:08:58,000
Right.

179
00:08:58,000 --> 00:09:06,000
So what I'm actually going to go I'll go and click on the home page okay I will sign into the console

180
00:09:07,000 --> 00:09:07,000
again.

181
00:09:08,000 --> 00:09:13,000
And here I will search for IAM user okay.

182
00:09:13,000 --> 00:09:20,000
So once you go to the IAM user you will be able to see that I will go ahead and create a user itself.

183
00:09:20,000 --> 00:09:22,000
So right now there are multiple users.

184
00:09:22,000 --> 00:09:24,000
So let me do one thing.

185
00:09:24,000 --> 00:09:25,000
Let me go and see the user already.

186
00:09:25,000 --> 00:09:33,000
Krish is created but I will just create one more user let's say test test admin okay so this is the

187
00:09:33,000 --> 00:09:36,000
user that I will specifically create and I will click on.

188
00:09:36,000 --> 00:09:39,000
Next I will say attach policies directly.

189
00:09:39,000 --> 00:09:43,000
I will select this option and I will give the administrator access okay.

190
00:09:43,000 --> 00:09:47,000
So administrator access basically means that we are giving the administrator access itself.

191
00:09:47,000 --> 00:09:48,000
Right.

192
00:09:48,000 --> 00:09:52,000
But again when you are working in the company you will definitely not get this access.

193
00:09:52,000 --> 00:09:56,000
Uh, instead, uh, based on the services that you are specifically using, that access you will get.

194
00:09:56,000 --> 00:09:57,000
Okay.

195
00:09:57,000 --> 00:10:00,000
Um, I will go ahead and create the policy.

196
00:10:01,000 --> 00:10:06,000
So let's see, once I go over here, then it will ask for some permission.

197
00:10:08,000 --> 00:10:11,000
So okay, forget about policies.

198
00:10:11,000 --> 00:10:12,000
Then I will go ahead.

199
00:10:12,000 --> 00:10:16,000
And here you will be able to see that I'll select the next button okay.

200
00:10:17,000 --> 00:10:21,000
After selecting the next button you can see I'm getting the administrator access along with this.

201
00:10:21,000 --> 00:10:22,000
What I will go I'll do.

202
00:10:22,000 --> 00:10:25,000
Go ahead and create the user itself.

203
00:10:25,000 --> 00:10:29,000
Now this is the user that you can see over here test admin right.

204
00:10:29,000 --> 00:10:32,000
And now let me click on this Create access key.

205
00:10:32,000 --> 00:10:32,000
Right.

206
00:10:32,000 --> 00:10:35,000
So I definitely require an access key.

207
00:10:35,000 --> 00:10:37,000
So for that I will go ahead and create this.

208
00:10:38,000 --> 00:10:40,000
Over here you can select Command Line interface.

209
00:10:40,000 --> 00:10:45,000
Since we are going to use it for CLI I will go ahead and click on this I understand and then I will

210
00:10:45,000 --> 00:10:47,000
go ahead and click on the next.

211
00:10:47,000 --> 00:10:51,000
Once I click on the next, you will be able to see that some description value it will ask for.

212
00:10:51,000 --> 00:10:53,000
I will say test key okay.

213
00:10:53,000 --> 00:10:55,000
And let me go ahead and create the access key.

214
00:10:55,000 --> 00:10:59,000
So here you can see I have the access key I have the secret access key.

215
00:10:59,000 --> 00:11:03,000
Now what you can do is that in this particular case you can download this.

216
00:11:03,000 --> 00:11:03,000
Right.

217
00:11:03,000 --> 00:11:06,000
So that later on you will not be able to see this.

218
00:11:06,000 --> 00:11:09,000
So it is a good idea that you download this in the form of CSV file.

219
00:11:09,000 --> 00:11:12,000
So I'll download this in the form of CSV file.

220
00:11:12,000 --> 00:11:14,000
And inside this CSV file I'll get this two values.

221
00:11:14,000 --> 00:11:17,000
One is access key, one is the secret access key.

222
00:11:17,000 --> 00:11:20,000
So let me quickly go ahead and copy this.

223
00:11:20,000 --> 00:11:22,000
And now I will go ahead and configure it.

224
00:11:22,000 --> 00:11:22,000
Right.

225
00:11:22,000 --> 00:11:24,000
We need to configure it over here.

226
00:11:25,000 --> 00:11:30,000
So already you know that we have also made sure that this AWS CLI is available over here.

227
00:11:30,000 --> 00:11:31,000
And it is installed.

228
00:11:31,000 --> 00:11:36,000
Now what we are going to do quickly is that we will go ahead and configure it from the command line.

229
00:11:36,000 --> 00:11:39,000
So let me go ahead and write AWS configure.

230
00:11:39,000 --> 00:11:39,000
Right.

231
00:11:39,000 --> 00:11:43,000
So here you will be able to see it is asking for AWS key ID.

232
00:11:43,000 --> 00:11:45,000
So I will copy and paste it over here.

233
00:11:45,000 --> 00:11:48,000
So I will copy this and I will paste it over here.

234
00:11:48,000 --> 00:11:49,000
Okay.

235
00:11:49,000 --> 00:11:54,000
So once I probably paste it you will be able to see that it will also ask for secret access key.

236
00:11:54,000 --> 00:11:56,000
So here I will copy it.

237
00:11:56,000 --> 00:12:00,000
And let me quickly go ahead and paste it over here.

238
00:12:00,000 --> 00:12:02,000
So here is what I see right now.

239
00:12:02,000 --> 00:12:03,000
You are able to see the access key.

240
00:12:03,000 --> 00:12:07,000
But don't worry, I will delete this as soon as I complete this video.

241
00:12:07,000 --> 00:12:10,000
Now the default region it is basically asking.

242
00:12:10,000 --> 00:12:11,000
So right now it is US East one.

243
00:12:11,000 --> 00:12:16,000
So if I go ahead and see my Amazon bedrock right now where I am pointing to.

244
00:12:16,000 --> 00:12:18,000
So please make sure that you point it to us East one.

245
00:12:18,000 --> 00:12:22,000
If you are not pointing over here, you can basically whatever region you are pointing, you have to

246
00:12:22,000 --> 00:12:23,000
write it over there.

247
00:12:23,000 --> 00:12:26,000
But right now, according to me, I'm going to point it over here, right?

248
00:12:26,000 --> 00:12:29,000
That is with respect to us East one.

249
00:12:29,000 --> 00:12:34,000
Now, one more additional setting you really need to do is that go to the model access.

250
00:12:34,000 --> 00:12:39,000
Because see, initially when you are in this US East one, this model access will not be given.

251
00:12:40,000 --> 00:12:40,000
Right.

252
00:12:40,000 --> 00:12:45,000
So over here you have to access you need to have the status of access granted.

253
00:12:45,000 --> 00:12:47,000
Then only you'll be able to use this specific models.

254
00:12:47,000 --> 00:12:53,000
Now for that when you click on Manage Model access right automatically the selection will come.

255
00:12:53,000 --> 00:12:56,000
And here you will be able to just save the changes here.

256
00:12:56,000 --> 00:12:58,000
One option off activate changes will come.

257
00:12:58,000 --> 00:13:01,000
See in the bottom side like save changes is over here.

258
00:13:01,000 --> 00:13:03,000
So here I've enabled it.

259
00:13:03,000 --> 00:13:05,000
And this access is granted right now.

260
00:13:05,000 --> 00:13:09,000
If it is not granted then this all will be disabled right now.

261
00:13:09,000 --> 00:13:10,000
Right.

262
00:13:10,000 --> 00:13:15,000
So what I will do, just to show you an example, let me just reload this page.

263
00:13:15,000 --> 00:13:17,000
Let me show you whether I have granted some other.

264
00:13:18,000 --> 00:13:25,000
See let's say with respect to Singapore if I'm in Asia Pacific, Singapore region right now, inside

265
00:13:25,000 --> 00:13:27,000
the Singapore region, you will be able to see that.

266
00:13:28,000 --> 00:13:31,000
See, something is not available over here.

267
00:13:31,000 --> 00:13:31,000
Right.

268
00:13:31,000 --> 00:13:31,000
Like this.

269
00:13:31,000 --> 00:13:32,000
Two are not available.

270
00:13:32,000 --> 00:13:34,000
So I will skip Singapore.

271
00:13:34,000 --> 00:13:36,000
Let's go to Tokyo.

272
00:13:36,000 --> 00:13:36,000
Okay.

273
00:13:37,000 --> 00:13:41,000
Just to show you an idea, because I have already activated in US East one.

274
00:13:41,000 --> 00:13:47,000
So if I probably see with this region here, you you'll be able to see this much excess you have available

275
00:13:47,000 --> 00:13:49,000
to a request available to request.

276
00:13:49,000 --> 00:13:55,000
So if I probably click on manage model and if I probably just click on this, let's say these are available

277
00:13:55,000 --> 00:13:55,000
right.

278
00:13:55,000 --> 00:13:58,000
I just need to click on Request Model access.

279
00:13:58,000 --> 00:14:01,000
So for this region only this three models are available.

280
00:14:01,000 --> 00:14:03,000
This two models are available.

281
00:14:03,000 --> 00:14:09,000
So my always suggestion would be that you go to US East one right in US US East one You will be able

282
00:14:09,000 --> 00:14:11,000
to see multiple models like this, right?

283
00:14:11,000 --> 00:14:13,000
Multiple models, you'll be able to see it.

284
00:14:14,000 --> 00:14:14,000
Okay.

285
00:14:14,000 --> 00:14:19,000
So you have to request for the access right.

286
00:14:19,000 --> 00:14:22,000
If I probably you can select us East one also.

287
00:14:22,000 --> 00:14:24,000
Or you can also select US West.

288
00:14:24,000 --> 00:14:25,000
It is up to you.

289
00:14:25,000 --> 00:14:26,000
US West two.

290
00:14:26,000 --> 00:14:29,000
So here also they provide you the access of all the models.

291
00:14:29,000 --> 00:14:29,000
Right.

292
00:14:29,000 --> 00:14:32,000
So understand one thing why I'm showing you all these things.

293
00:14:32,000 --> 00:14:35,000
Because initially you really need to request access.

294
00:14:35,000 --> 00:14:37,000
And this is also what I have requested already.

295
00:14:37,000 --> 00:14:40,000
So here you'll be able to find out more use cases.

296
00:14:40,000 --> 00:14:40,000
Right.

297
00:14:40,000 --> 00:14:42,000
So everything is available right.

298
00:14:42,000 --> 00:14:48,000
But by default I will go ahead and use this US east of N Virginia okay.

299
00:14:48,000 --> 00:14:51,000
So right now again my access is granted.

300
00:14:51,000 --> 00:14:55,000
So you if your access is not granted you have to request for it okay.

301
00:14:55,000 --> 00:15:00,000
So once this is done I will go back to my command prompt here.

302
00:15:00,000 --> 00:15:02,000
The default region is US East one.

303
00:15:02,000 --> 00:15:03,000
So I'll press enter.

304
00:15:03,000 --> 00:15:04,000
This is what I really want.

305
00:15:04,000 --> 00:15:07,000
And default output format I want in the form of JSON.

306
00:15:07,000 --> 00:15:09,000
So I will go ahead and write JSON.

307
00:15:09,000 --> 00:15:09,000
Okay.

308
00:15:09,000 --> 00:15:11,000
So this is the initial setup you really need to do.

309
00:15:12,000 --> 00:15:15,000
Now let's start working on different different models.

310
00:15:15,000 --> 00:15:23,000
So so guys now once we have actually configured now we will go ahead and use any of these models as

311
00:15:23,000 --> 00:15:25,000
an example and we'll try to perform various tasks.

312
00:15:25,000 --> 00:15:28,000
So in this example uh, let me do one thing.

313
00:15:28,000 --> 00:15:33,000
Uh, let me take an example of content generation in cloud.

314
00:15:33,000 --> 00:15:33,000
Okay.

315
00:15:34,000 --> 00:15:41,000
So cloudy cloudy one we can specifically take or uh, let's say I want llama two, you can actually

316
00:15:41,000 --> 00:15:41,000
take llama two.

317
00:15:41,000 --> 00:15:43,000
So it's it's up to you.

318
00:15:43,000 --> 00:15:46,000
So let's first of all start start with this llama two itself.

319
00:15:46,000 --> 00:15:52,000
And for this I'm going to specifically use my Lama 270 billion parameters okay.

320
00:15:52,000 --> 00:15:53,000
The chain of thoughts okay.

321
00:15:53,000 --> 00:15:59,000
And with respect to every model you will be getting some model ID content type.

322
00:15:59,000 --> 00:16:01,000
So this is how is the API request needs to go.

323
00:16:01,000 --> 00:16:04,000
So we'll form this entire API request through our code.

324
00:16:04,000 --> 00:16:06,000
And then we will go ahead and hit this okay.

325
00:16:06,000 --> 00:16:10,000
So let me quickly go ahead and start my coding okay.

326
00:16:10,000 --> 00:16:13,000
So here I will rename this to llama two.

327
00:16:13,000 --> 00:16:16,000
The llama two.

328
00:16:16,000 --> 00:16:19,000
So here is the file guys llama 2.py.

329
00:16:19,000 --> 00:16:21,000
So I will start my code over here.

330
00:16:21,000 --> 00:16:25,000
So first of all let me go ahead and write import Boto3 I'm going to import Boto3 along with it.

331
00:16:25,000 --> 00:16:27,000
I'm also going to import JSON.

332
00:16:28,000 --> 00:16:35,000
Uh the first thing as usual you will be able to see that whenever I see this file writes a chain of

333
00:16:35,000 --> 00:16:40,000
thought over here, I have to create my API request with the help of model name model ID.

334
00:16:40,000 --> 00:16:44,000
Then I need to also put content type, then apply accept.

335
00:16:44,000 --> 00:16:49,000
Then my body should look something like this prompt with all this information.

336
00:16:49,000 --> 00:16:50,000
See uh in lambda two.

337
00:16:50,000 --> 00:16:56,000
So basically your uh your uh prompt uh intro will start with or prompt.

338
00:16:56,000 --> 00:17:00,000
First character will probably start with first word will start with this okay.

339
00:17:00,000 --> 00:17:05,000
It's just like an instruction okay I insist then here you have multiple options.

340
00:17:05,000 --> 00:17:07,000
You can probably see this right here.

341
00:17:07,000 --> 00:17:13,000
Uh you have options like max gen length then temperature, then top P 0.9, something like this okay.

342
00:17:13,000 --> 00:17:17,000
So top P basically means I think it is with respect to the probability.

343
00:17:17,000 --> 00:17:21,000
So let's quickly go ahead and set up that entire command prompt.

344
00:17:21,000 --> 00:17:24,000
So what I will do is that I will copy this entirely okay.

345
00:17:24,000 --> 00:17:28,000
And I will create one JSON okay.

346
00:17:28,000 --> 00:17:33,000
I will write test dot JSON so that I have that format over here.

347
00:17:33,000 --> 00:17:35,000
So this is the JSON.

348
00:17:35,000 --> 00:17:39,000
I have to make sure that I have to put all my API requests in this form.

349
00:17:39,000 --> 00:17:39,000
Okay.

350
00:17:39,000 --> 00:17:40,000
For using Lambda two.

351
00:17:40,000 --> 00:17:45,000
Now quickly I will go ahead and write one prompt underscore data.

352
00:17:45,000 --> 00:17:49,000
I will say, hey, uh, this prompt data, I want to do something like this.

353
00:17:49,000 --> 00:17:50,000
I'll act.

354
00:17:50,000 --> 00:18:01,000
I'll say act as this as, uh, Shakespeare and write a poem on machine learning.

355
00:18:01,000 --> 00:18:05,000
Let's say I this is my prompt that I specifically want to use.

356
00:18:05,000 --> 00:18:05,000
Okay.

357
00:18:05,000 --> 00:18:10,000
Now, the most amazing thing is that Amazon AWS bedrock is quite good.

358
00:18:10,000 --> 00:18:12,000
You know, it provides you easy APIs.

359
00:18:12,000 --> 00:18:16,000
The APIs request, you just need to use it and, uh, start serving it.

360
00:18:16,000 --> 00:18:17,000
Start using it in your application.

361
00:18:17,000 --> 00:18:21,000
So I will first of all go ahead and use this bedrock.

362
00:18:21,000 --> 00:18:25,000
So I will write bedrock is equal to Boto3 dot client.

363
00:18:26,000 --> 00:18:30,000
And then I will specifically use my service underscore name.

364
00:18:30,000 --> 00:18:33,000
Uh service underscore name is equal to.

365
00:18:33,000 --> 00:18:37,000
And I have to give the service name as bedrock or dash runtime.

366
00:18:37,000 --> 00:18:39,000
So this is the first thing that we really need to do.

367
00:18:39,000 --> 00:18:41,000
This is the client name.

368
00:18:41,000 --> 00:18:44,000
Like this is the service name that we really need to use.

369
00:18:44,000 --> 00:18:47,000
And with the help of Boto3, we'll be able to connect to the bedrock itself.

370
00:18:47,000 --> 00:18:49,000
So this is my bedrock over here.

371
00:18:49,000 --> 00:18:53,000
Now the next thing is that I need to form the payload.

372
00:18:53,000 --> 00:18:53,000
Right.

373
00:18:53,000 --> 00:18:56,000
So this will basically be my payload structure as a dictionary.

374
00:18:56,000 --> 00:18:59,000
I will try to find give the values in key value pair.

375
00:18:59,000 --> 00:19:02,000
As usual, if I probably see the test duration.

376
00:19:02,000 --> 00:19:03,000
This is what is my body.

377
00:19:03,000 --> 00:19:06,000
So I need to have in the form of key value pairs.

378
00:19:06,000 --> 00:19:08,000
Prompt is equal to some value.

379
00:19:08,000 --> 00:19:15,000
Then you'll be able to see max gen length, some value temperature, some value top underscore p some

380
00:19:15,000 --> 00:19:15,000
value.

381
00:19:15,000 --> 00:19:18,000
So similarly I will also give my payload in this format.

382
00:19:18,000 --> 00:19:21,000
So here I will write prompt colon.

383
00:19:21,000 --> 00:19:26,000
And here I will go ahead and write I honestly since this is my intro right.

384
00:19:26,000 --> 00:19:33,000
And uh, this intro will be concatenated with my prompt underscore data.

385
00:19:33,000 --> 00:19:34,000
Right.

386
00:19:34,000 --> 00:19:37,000
So this I'm concatenating with my prompt underscore data.

387
00:19:37,000 --> 00:19:42,000
And in the end I have to probably also end this instruction okay.

388
00:19:42,000 --> 00:19:46,000
So this is how my prompt this this prompt body has got created right.

389
00:19:46,000 --> 00:19:48,000
This this is what it has got created.

390
00:19:48,000 --> 00:19:48,000
Right.

391
00:19:48,000 --> 00:19:50,000
Because the prompt will get inserted over here.

392
00:19:50,000 --> 00:19:55,000
Now along with this prompt I need to provide some more different different values.

393
00:19:55,000 --> 00:19:55,000
Right.

394
00:19:55,000 --> 00:19:57,000
What all values I need to provide.

395
00:19:57,000 --> 00:20:02,000
One example is that I'm getting from my API max gen underscore length okay.

396
00:20:02,000 --> 00:20:04,000
And this will also be in the form of key value pairs.

397
00:20:04,000 --> 00:20:07,000
And here I will mention phi to L okay.

398
00:20:07,000 --> 00:20:16,000
And then the next thing is that I will go ahead and write temperature with colon 0.5 comma.

399
00:20:18,000 --> 00:20:23,000
Top underscore p colon 0.9 okay.

400
00:20:23,000 --> 00:20:26,000
So these are my initial values that I've actually set up.

401
00:20:26,000 --> 00:20:30,000
And this is not thing but this is my payload the payload that is specifically going over here.

402
00:20:30,000 --> 00:20:35,000
So once we do this the next thing what I will do this is basically my body.

403
00:20:35,000 --> 00:20:42,000
So I will write body json.dumps I will basically convert this into a JSON and I will use my payload

404
00:20:42,000 --> 00:20:43,000
over here.

405
00:20:43,000 --> 00:20:43,000
Okay.

406
00:20:43,000 --> 00:20:48,000
So once my body is basically created the next thing what I'm actually going to do over here, I'm going

407
00:20:48,000 --> 00:20:53,000
to basically write my model ID and your model ID name.

408
00:20:53,000 --> 00:20:56,000
As usual, the model ID name is this one meta.

409
00:20:56,000 --> 00:20:58,000
This one version one something.

410
00:20:58,000 --> 00:20:58,000
Okay.

411
00:20:58,000 --> 00:20:59,000
So I'll paste it over here.

412
00:20:59,000 --> 00:21:02,000
So this basically becomes my model ID itself.

413
00:21:02,000 --> 00:21:04,000
Now I'll go ahead and create my response.

414
00:21:04,000 --> 00:21:09,000
Now in that response what I need to do I just need to write bedrock, the bedrock object that is created

415
00:21:09,000 --> 00:21:15,000
over here dot invoke invoke underscore model okay.

416
00:21:15,000 --> 00:21:18,000
Now inside this I will give my first parameter.

417
00:21:18,000 --> 00:21:20,000
The first parameter is nothing but body.

418
00:21:20,000 --> 00:21:23,000
The body will be initialized to this specific body itself.

419
00:21:23,000 --> 00:21:30,000
Uh, whatever body we have actually created, the second parameter is nothing but my model ID, so model.

420
00:21:30,000 --> 00:21:32,000
Oops, just a second bedrock.

421
00:21:32,000 --> 00:21:38,000
So I have to use this model id okay.

422
00:21:38,000 --> 00:21:42,000
So this will basically be my second parameter that I really need to give model ID.

423
00:21:42,000 --> 00:21:49,000
And this I will initialize to what we need to initialize to this model ID, right?

424
00:21:49,000 --> 00:21:51,000
So my second parameter is also done.

425
00:21:51,000 --> 00:21:51,000
Body is done.

426
00:21:51,000 --> 00:21:53,000
Model ID is done.

427
00:21:53,000 --> 00:21:57,000
After model id I need to give my accept token as usual.

428
00:21:57,000 --> 00:22:03,000
What is the accept token in test.js on it is nothing but application slash JSON, so I'll paste it over

429
00:22:03,000 --> 00:22:03,000
here.

430
00:22:04,000 --> 00:22:04,000
Oops.

431
00:22:05,000 --> 00:22:06,000
I'll paste it over here.

432
00:22:06,000 --> 00:22:07,000
Done.

433
00:22:07,000 --> 00:22:12,000
The next parameter after this will be nothing, but let me see.

434
00:22:12,000 --> 00:22:16,000
Content type okay, so I have to also give my content type over here.

435
00:22:16,000 --> 00:22:19,000
This will also be my application slash JSON I guess.

436
00:22:20,000 --> 00:22:23,000
Again I'm just seeing this API, so whatever values are there my body is ready.

437
00:22:23,000 --> 00:22:26,000
My accept model ID content type, everything is ready.

438
00:22:26,000 --> 00:22:29,000
These are the four parameters I need to give in my invoke model, right?

439
00:22:29,000 --> 00:22:31,000
What model I'm specifically invoking.

440
00:22:31,000 --> 00:22:35,000
Now, once I get this, uh, you will be able to see that once.

441
00:22:35,000 --> 00:22:39,000
I probably go ahead and write response underscore.

442
00:22:39,000 --> 00:22:42,000
This will basically be my response inside this response.

443
00:22:42,000 --> 00:22:43,000
Understand?

444
00:22:43,000 --> 00:22:46,000
Once I get this specific response, I'll write.

445
00:22:46,000 --> 00:22:48,000
I'll take the body part okay.

446
00:22:48,000 --> 00:22:52,000
So inner part, uh, because there'll be a lot many different different contents that will be coming

447
00:22:52,000 --> 00:22:52,000
up.

448
00:22:52,000 --> 00:22:58,000
So if I write JSON dot loads I will take this value and I will say response dot get.

449
00:22:58,000 --> 00:23:02,000
So inside this there will be a key which will be called as body okay.

450
00:23:02,000 --> 00:23:07,000
Inside that body you will find out entire information of the response that you are able to get.

451
00:23:07,000 --> 00:23:12,000
In this particular case, whatever text I'm writing, act as a secretary and write a poem on machine

452
00:23:12,000 --> 00:23:12,000
learning.

453
00:23:12,000 --> 00:23:16,000
So this is basically my prompt and it will give that specific text inside this body.

454
00:23:16,000 --> 00:23:16,000
Okay.

455
00:23:16,000 --> 00:23:18,000
So I will write this.

456
00:23:18,000 --> 00:23:18,000
Okay.

457
00:23:19,000 --> 00:23:21,000
Um, this body dot read this is done.

458
00:23:21,000 --> 00:23:23,000
Now I will go ahead and print.

459
00:23:23,000 --> 00:23:25,000
I can also print it, but I don't want it.

460
00:23:25,000 --> 00:23:28,000
So let me go ahead and write response underscore text.

461
00:23:28,000 --> 00:23:33,000
Now inside this one thing that you will be able to see that whenever we use llama two.

462
00:23:33,000 --> 00:23:38,000
If you don't know, I've also created videos with respect to llama two, the open source model.

463
00:23:38,000 --> 00:23:41,000
If I use this response underscore body, they will also be a key.

464
00:23:41,000 --> 00:23:44,000
See, inside this body there'll be a body key.

465
00:23:44,000 --> 00:23:49,000
Inside that there will be another key which will be called as generation which will have the entire

466
00:23:49,000 --> 00:23:51,000
text of the response that we want.

467
00:23:51,000 --> 00:23:52,000
Okay.

468
00:23:52,000 --> 00:23:56,000
So I will just go ahead and print this response.

469
00:23:56,000 --> 00:23:57,000
Underscore text.

470
00:23:59,000 --> 00:24:00,000
Done.

471
00:24:01,000 --> 00:24:07,000
Now let's see if everything is working fine or not and whether we will be able to see each and everything.

472
00:24:07,000 --> 00:24:08,000
So this is very simple.

473
00:24:08,000 --> 00:24:09,000
A prompt is over here.

474
00:24:09,000 --> 00:24:11,000
We have invoked the bedrock.

475
00:24:11,000 --> 00:24:13,000
Then there is a payload.

476
00:24:13,000 --> 00:24:18,000
Then here you have this entire body, uh, body I've created in the form of JSON.

477
00:24:18,000 --> 00:24:20,000
Then model ID accept content type.

478
00:24:20,000 --> 00:24:23,000
The main thing is understand this test JSON right.

479
00:24:23,000 --> 00:24:24,000
And then you will be able to do it.

480
00:24:24,000 --> 00:24:25,000
So perfect.

481
00:24:25,000 --> 00:24:31,000
Let's execute this now and let's see whether everything is working fine or not okay.

482
00:24:31,000 --> 00:24:37,000
So I will just go ahead and write Python Llama two.

483
00:24:37,000 --> 00:24:38,000
Oops.

484
00:24:39,000 --> 00:24:40,000
Clear the screen.

485
00:24:40,000 --> 00:24:40,000
Okay.

486
00:24:40,000 --> 00:24:44,000
Python llama 2.py.

487
00:24:44,000 --> 00:24:45,000
Okay.

488
00:24:48,000 --> 00:24:50,000
So it'll take some time again.

489
00:24:50,000 --> 00:24:56,000
Uh, as you all know, uh, some response time it will take with respect to the APIs that we have.

490
00:24:56,000 --> 00:25:01,000
Uh, and again, now we are hitting the specific API from the cloud, uh, from the AWS server itself,

491
00:25:01,000 --> 00:25:01,000
right.

492
00:25:01,000 --> 00:25:02,000
In AWS bedrock.

493
00:25:03,000 --> 00:25:06,000
So, so here is the entire text.

494
00:25:06,000 --> 00:25:12,000
Here you'll be able to see in the fair digital rain where data dot flows free.

495
00:25:12,000 --> 00:25:13,000
A wondrous art dot.

496
00:25:13,000 --> 00:25:15,000
RAR is called machine learning.

497
00:25:15,000 --> 00:25:19,000
You see this is a this is a science, a craft, a mystic spell.

498
00:25:19,000 --> 00:25:23,000
The dot enable machine to learn and tell with algorithm sharp and data set vast.

499
00:25:23,000 --> 00:25:27,000
Our computers do not don't gain wisdom and their insights do not.

500
00:25:27,000 --> 00:25:27,000
Last.

501
00:25:27,000 --> 00:25:30,000
And again based on the token size it will be charging.

502
00:25:30,000 --> 00:25:34,000
Okay, so all the information see you know whatever prompt you want to give over here.

503
00:25:34,000 --> 00:25:35,000
Right.

504
00:25:35,000 --> 00:25:39,000
Let's say I'll go ahead and write what is generative AI like.

505
00:25:39,000 --> 00:25:42,000
Um write a poem on generative AI.

506
00:25:42,000 --> 00:25:43,000
You'll be able to see this.

507
00:25:43,000 --> 00:25:45,000
You'll get some response over here.

508
00:25:45,000 --> 00:25:46,000
So I'll save this.

509
00:25:46,000 --> 00:25:49,000
Now I will go ahead and run it okay.

510
00:25:50,000 --> 00:25:52,000
Now similarly you can actually do it with cloudy too.

511
00:25:52,000 --> 00:25:54,000
You can do it with the stable diffusion.

512
00:25:54,000 --> 00:25:57,000
I'll also show you an example with respect to stable diffusion.

513
00:25:57,000 --> 00:26:01,000
And then you can also explore that uh as said uh now let's go ahead.

514
00:26:01,000 --> 00:26:04,000
Uh, you know, we will try to do it with the help of cloudy two.

515
00:26:04,000 --> 00:26:07,000
And again, uh, with respect to that also, we'll try to see okay.

516
00:26:07,000 --> 00:26:09,000
So this is one text generation.

517
00:26:09,000 --> 00:26:15,000
So here also you can see um, in the realm of code and circularity, a marvel of man's ingenuity, a

518
00:26:15,000 --> 00:26:17,000
creation that not rival the generative.

519
00:26:17,000 --> 00:26:21,000
I wonder to see so all the information are specifically coming over here.

520
00:26:21,000 --> 00:26:23,000
Now let's try another API.

521
00:26:23,000 --> 00:26:29,000
And then after this we will go ahead and try, uh, you know, the image generation with the help of

522
00:26:29,000 --> 00:26:30,000
stable diffusion.

523
00:26:30,000 --> 00:26:31,000
So cloudy.

524
00:26:31,000 --> 00:26:33,000
Uh, let's see where is cloudy.

525
00:26:33,000 --> 00:26:35,000
Cloudy content generation.

526
00:26:35,000 --> 00:26:36,000
Okay.

527
00:26:36,000 --> 00:26:38,000
So so here is my API.

528
00:26:38,000 --> 00:26:40,000
I will copy this.

529
00:26:40,000 --> 00:26:41,000
Um, um.

530
00:26:42,000 --> 00:26:45,000
It is always good to keep a test JSON like this.

531
00:26:45,000 --> 00:26:49,000
Okay, now almost each and everything is same okay I will tell talk about like what?

532
00:26:49,000 --> 00:26:50,000
All changes will basically happen.

533
00:26:50,000 --> 00:26:54,000
Okay, so llama two uh, let me just copy this.

534
00:26:54,000 --> 00:26:56,000
Four lines of code will be almost same.

535
00:26:56,000 --> 00:26:58,000
Then I have my payload.

536
00:26:58,000 --> 00:27:01,000
I will also copy this and then we'll change the payload.

537
00:27:01,000 --> 00:27:03,000
Okay, so we'll change the payload.

538
00:27:03,000 --> 00:27:07,000
So inside this payload you have prompt is equal to human.

539
00:27:07,000 --> 00:27:08,000
You are an expert social media generation.

540
00:27:08,000 --> 00:27:11,000
So whatever prompt basic prompt data right.

541
00:27:11,000 --> 00:27:16,000
So here I don't have to probably create this I don't want this okay.

542
00:27:16,000 --> 00:27:19,000
So this will basically be my prompt data done.

543
00:27:19,000 --> 00:27:21,000
Then let's go with the next parameter.

544
00:27:21,000 --> 00:27:24,000
So what are the next parameter.

545
00:27:24,000 --> 00:27:26,000
La la la la la la la.

546
00:27:26,000 --> 00:27:28,000
Baba baba baba.

547
00:27:29,000 --> 00:27:30,000
Come on guys.

548
00:27:30,000 --> 00:27:30,000
Till then.

549
00:27:30,000 --> 00:27:32,000
Hit like I'm working so much hard here.

550
00:27:32,000 --> 00:27:33,000
Come on.

551
00:27:34,000 --> 00:27:36,000
We we we will.

552
00:27:36,000 --> 00:27:36,000
Okay.

553
00:27:36,000 --> 00:27:37,000
Anthropic version is there.

554
00:27:37,000 --> 00:27:38,000
Stop sequence.

555
00:27:38,000 --> 00:27:39,000
Is there temperature?

556
00:27:39,000 --> 00:27:40,000
Uh, this is there.

557
00:27:40,000 --> 00:27:43,000
Max tokens is there say max token to sample is there?

558
00:27:43,000 --> 00:27:47,000
So let me just quickly go ahead and write what all things I require over here.

559
00:27:47,000 --> 00:27:48,000
So I will go ahead and write.

560
00:27:48,000 --> 00:27:49,000
Max.

561
00:27:49,000 --> 00:27:51,000
Uh, tokens.

562
00:27:51,000 --> 00:27:52,000
Okay.

563
00:27:52,000 --> 00:27:54,000
So this will be 5 to 12, uh, max tokens.

564
00:27:54,000 --> 00:27:55,000
Then I have my temperature.

565
00:27:55,000 --> 00:27:59,000
Then I have my the stop parameter looks something like this.

566
00:27:59,000 --> 00:27:59,000
Okay.

567
00:27:59,000 --> 00:28:02,000
Power point top P will be point eight.

568
00:28:02,000 --> 00:28:03,000
Okay.

569
00:28:03,000 --> 00:28:05,000
Something I'm putting some values.

570
00:28:05,000 --> 00:28:05,000
Temperature.

571
00:28:05,000 --> 00:28:07,000
Let's keep it 2.8.

572
00:28:07,000 --> 00:28:09,000
Let it be more creative okay.

573
00:28:09,000 --> 00:28:11,000
So this is basically my payload okay.

574
00:28:11,000 --> 00:28:12,000
Now everything almost looks same.

575
00:28:13,000 --> 00:28:16,000
Uh, you'll be able to see that I will uh mhm.

576
00:28:16,000 --> 00:28:16,000
Mhm.

577
00:28:17,000 --> 00:28:17,000
Okay.

578
00:28:17,000 --> 00:28:20,000
I think uh there is another one.

579
00:28:20,000 --> 00:28:21,000
Let's see.

580
00:28:21,000 --> 00:28:24,000
Content generation is also there.

581
00:28:24,000 --> 00:28:25,000
This is also there.

582
00:28:25,000 --> 00:28:26,000
Okay fine.

583
00:28:26,000 --> 00:28:27,000
No worries.

584
00:28:28,000 --> 00:28:28,000
Okay.

585
00:28:28,000 --> 00:28:31,000
So I will I think I've used another version.

586
00:28:31,000 --> 00:28:33,000
Let me use another one also which I have already tried.

587
00:28:33,000 --> 00:28:35,000
So it will be looking good okay.

588
00:28:35,000 --> 00:28:36,000
So cloudy two.

589
00:28:36,000 --> 00:28:40,000
So let's quickly go ahead and create my body.

590
00:28:40,000 --> 00:28:42,000
So here you have this one.

591
00:28:42,000 --> 00:28:46,000
So body JSON dumps payload model ID will be this one right.

592
00:28:46,000 --> 00:28:51,000
Bedrock this everything is there body model ID application and content type.

593
00:28:51,000 --> 00:28:56,000
So once we get the response this time when we get the response body okay.

594
00:28:56,000 --> 00:28:57,000
Like this.

595
00:28:57,000 --> 00:29:02,000
When we get this specific body now inside this body you will be able to see that they're in the case

596
00:29:02,000 --> 00:29:03,000
of llama two.

597
00:29:03,000 --> 00:29:05,000
Inside this body we have generation.

598
00:29:05,000 --> 00:29:10,000
But here inside this body we will be having some more steps okay.

599
00:29:10,000 --> 00:29:12,000
So that will be some more, uh, key value pairs.

600
00:29:12,000 --> 00:29:14,000
So here I've written it.

601
00:29:14,000 --> 00:29:17,000
So it will be nothing but completions of zero.

602
00:29:17,000 --> 00:29:19,000
Get data and then get text.

603
00:29:19,000 --> 00:29:23,000
So in completions there it is just like a list of key value pairs.

604
00:29:23,000 --> 00:29:28,000
So I will just take the first one and then probably display the data inside that whatever text is basically

605
00:29:28,000 --> 00:29:29,000
coming.

606
00:29:29,000 --> 00:29:34,000
And then we will go ahead and response underscore text okay.

607
00:29:34,000 --> 00:29:39,000
So now everything works fine I think I've used this model or other model.

608
00:29:39,000 --> 00:29:41,000
So this is version two okay.

609
00:29:41,000 --> 00:29:44,000
In cloudy let's say in cloudy.

610
00:29:44,000 --> 00:29:45,000
Some other version is also there.

611
00:29:46,000 --> 00:29:51,000
Um I don't know from where I found out, but it was available here only.

612
00:29:53,000 --> 00:29:54,000
Advanced Q&A.

613
00:29:54,000 --> 00:29:56,000
Yes, I used I used this one, I guess.

614
00:29:57,000 --> 00:29:58,000
Yeah.

615
00:29:58,000 --> 00:29:59,000
Advanced Q&A.

616
00:30:00,000 --> 00:30:02,000
I used this model ID, I guess.

617
00:30:03,000 --> 00:30:04,000
Okay, perfect.

618
00:30:04,000 --> 00:30:08,000
So once we do this, uh, let's go ahead and run it now.

619
00:30:08,000 --> 00:30:10,000
Now I'll go to my terminal.

620
00:30:11,000 --> 00:30:14,000
Now let's see whether each and every thing will run fine or not.

621
00:30:14,000 --> 00:30:16,000
Once I tried with llama two.

622
00:30:16,000 --> 00:30:17,000
Now I'm tried with cow two.

623
00:30:17,000 --> 00:30:18,000
Right?

624
00:30:18,000 --> 00:30:24,000
So I will write Python cloudy to cloudy.py.

625
00:30:24,000 --> 00:30:30,000
Okay, so here also you'll be able to see the print statement how this was quite fast right.

626
00:30:30,000 --> 00:30:35,000
So here you can see O gentle AI with your boundary power to think and create with no efforts.

627
00:30:35,000 --> 00:30:38,000
So you are specifically getting this specific output also.

628
00:30:38,000 --> 00:30:40,000
So this was with respect to cloudy.

629
00:30:40,000 --> 00:30:42,000
Again you can try anything that you want.

630
00:30:42,000 --> 00:30:43,000
Just take this JSON.

631
00:30:43,000 --> 00:30:44,000
Just try to play with it.

632
00:30:45,000 --> 00:30:49,000
Uh, let's say I take this information only and use this model.

633
00:30:49,000 --> 00:30:52,000
Let's see I will paste it over here.

634
00:30:52,000 --> 00:30:55,000
I will take this entire thing and paste this model.

635
00:30:56,000 --> 00:31:00,000
So here itself I'll change it.

636
00:31:03,000 --> 00:31:08,000
I think cloudy, I may get an error because I don't know whether we are able to manage it or not.

637
00:31:08,000 --> 00:31:09,000
So I sold Access denied.

638
00:31:09,000 --> 00:31:10,000
See?

639
00:31:10,000 --> 00:31:12,000
So this model is not available.

640
00:31:12,000 --> 00:31:13,000
The version one is available I guess.

641
00:31:13,000 --> 00:31:17,000
I think I, I explored this earlier find it somewhere.

642
00:31:17,000 --> 00:31:20,000
If I probably search this you will be able to find it I guess.

643
00:31:20,000 --> 00:31:21,000
Let's see.

644
00:31:22,000 --> 00:31:26,000
But anyhow, you try it out from your end I any I'll be giving you the code Like this.

645
00:31:26,000 --> 00:31:30,000
We are not able to search advanced Q and A and all.

646
00:31:30,000 --> 00:31:30,000
Okay, fine.

647
00:31:31,000 --> 00:31:36,000
Uh, let's start with, uh, I think, uh, c in US why that is not working.

648
00:31:36,000 --> 00:31:36,000
Right.

649
00:31:36,000 --> 00:31:41,000
Because if I go ahead and see the model access, the cloudy model is not available.

650
00:31:41,000 --> 00:31:44,000
C cloudy instant is not available.

651
00:31:44,000 --> 00:31:46,000
So that is the reason that version one was available.

652
00:31:46,000 --> 00:31:47,000
And I was still exploring things.

653
00:31:47,000 --> 00:31:48,000
Right.

654
00:31:48,000 --> 00:31:52,000
And I probably got in that, But no worries, I will now go ahead with stable diffusion.

655
00:31:52,000 --> 00:31:57,000
So let's go to the base model, see version 2.1.

656
00:31:57,000 --> 00:31:59,000
This is all models are specifically there.

657
00:31:59,000 --> 00:32:02,000
If I go to examples uh let's see with respect to stable diffusion.

658
00:32:02,000 --> 00:32:04,000
So 1.2 is there 0.8 is there.

659
00:32:04,000 --> 00:32:06,000
We'll go with the recent one.

660
00:32:06,000 --> 00:32:09,000
And again I will go ahead and copy this okay.

661
00:32:10,000 --> 00:32:14,000
So this will basically be my next text JSON okay.

662
00:32:14,000 --> 00:32:16,000
So I will keep all these things over here itself.

663
00:32:16,000 --> 00:32:19,000
Now let me quickly create one more file.

664
00:32:19,000 --> 00:32:23,000
Save this one more file stable diffusion.

665
00:32:23,000 --> 00:32:28,000
Now here we will try to create an image in AWS itself from AWS dot Pi.

666
00:32:28,000 --> 00:32:30,000
Okay now for stable diffusion.

667
00:32:30,000 --> 00:32:32,000
Also almost all the things will be same.

668
00:32:32,000 --> 00:32:37,000
I've already created the code, but here what I will do, I will just show you what all things I will

669
00:32:37,000 --> 00:32:37,000
do.

670
00:32:37,000 --> 00:32:40,000
See, stable diffusion basically means I have written a prompt data.

671
00:32:40,000 --> 00:32:41,000
See?

672
00:32:41,000 --> 00:32:43,000
Provided me a 4k HD image of beach.

673
00:32:43,000 --> 00:32:45,000
Also use blue sky, rainy season and cinematic display.

674
00:32:45,000 --> 00:32:52,000
Okay, now with respect to this text JSON here you can see body has something called as text prompt.

675
00:32:52,000 --> 00:32:54,000
And then you have text information.

676
00:32:54,000 --> 00:32:57,000
And with respect to the text information this is basically my prompt.

677
00:32:57,000 --> 00:33:01,000
Along with this you have parameters like weight cfg, scale seed, this, this, this is there.

678
00:33:01,000 --> 00:33:05,000
So what I do first of all I will set in that format only.

679
00:33:05,000 --> 00:33:09,000
So first of all I create my prompt template where I have my text my prompt data with weight.

680
00:33:09,000 --> 00:33:09,000
Okay.

681
00:33:09,000 --> 00:33:12,000
So this becomes my entire this information.

682
00:33:12,000 --> 00:33:13,000
Understand this thing right.

683
00:33:13,000 --> 00:33:14,000
You just need to set it.

684
00:33:14,000 --> 00:33:15,000
That's that's it.

685
00:33:15,000 --> 00:33:17,000
Text is equal to this information with weight.

686
00:33:17,000 --> 00:33:20,000
So I've kept it in the form of list with key value pairs.

687
00:33:20,000 --> 00:33:23,000
So that is what I am getting it over here inside this prompt template.

688
00:33:23,000 --> 00:33:27,000
Now I have used butter client I've used the service name runtime.

689
00:33:27,000 --> 00:33:29,000
Now remaining is all my payload.

690
00:33:29,000 --> 00:33:31,000
So inside this whatever payload you require.

691
00:33:31,000 --> 00:33:33,000
See first of all I require text prompt.

692
00:33:33,000 --> 00:33:37,000
The second thing that I require is seed steps width height right.

693
00:33:37,000 --> 00:33:38,000
Width height.

694
00:33:38,000 --> 00:33:39,000
So let me do one thing.

695
00:33:39,000 --> 00:33:42,000
I will change this to 1024.

696
00:33:44,000 --> 00:33:45,000
I will also change it to 1024.

697
00:33:45,000 --> 00:33:47,000
So these are all the parameters I've set.

698
00:33:47,000 --> 00:33:49,000
Step size is nothing but 50.

699
00:33:49,000 --> 00:33:50,000
Width is 1024.

700
00:33:50,000 --> 00:33:51,000
Height is 1024.

701
00:33:51,000 --> 00:33:53,000
So this becomes my entire payload.

702
00:33:53,000 --> 00:33:54,000
I have converted this into JSON.

703
00:33:54,000 --> 00:33:59,000
I've used this model ID because this is the same model id I'm able to get it over here right.

704
00:33:59,000 --> 00:34:02,000
Stability dot stable diffusion X1V1.

705
00:34:02,000 --> 00:34:03,000
It's very simple.

706
00:34:03,000 --> 00:34:05,000
Once you do one right everything will be able to use it.

707
00:34:05,000 --> 00:34:06,000
So here I've used that.

708
00:34:06,000 --> 00:34:10,000
Then I have invoked this model with content type model ID body everything.

709
00:34:10,000 --> 00:34:12,000
Once I get the response.

710
00:34:12,000 --> 00:34:15,000
Now see what response you will get in this format right?

711
00:34:15,000 --> 00:34:20,000
When you probably see the response body there, you'll be getting key value pairs with something called

712
00:34:20,000 --> 00:34:21,000
as artifacts.

713
00:34:21,000 --> 00:34:26,000
Inside that you will find a base 64 encoded response of the images.

714
00:34:26,000 --> 00:34:29,000
So what we did is that we took this particular artifact of zero.

715
00:34:29,000 --> 00:34:31,000
We took that base 64.

716
00:34:31,000 --> 00:34:33,000
We encoded it with UTF eight.

717
00:34:33,000 --> 00:34:37,000
And this is how you read any encoded image right from that encoded image.

718
00:34:37,000 --> 00:34:38,000
We have converted that into bytes.

719
00:34:38,000 --> 00:34:42,000
And then we have saved that particular image to some output directory.

720
00:34:42,000 --> 00:34:44,000
So output directory output folder will get created.

721
00:34:44,000 --> 00:34:47,000
And I am creating one image over here.

722
00:34:47,000 --> 00:34:47,000
Right.

723
00:34:47,000 --> 00:34:51,000
So uh that is what we are specifically doing with respect to this.

724
00:34:51,000 --> 00:34:51,000
Right.

725
00:34:51,000 --> 00:34:55,000
So uh file name will be nothing but inside that particular output directory.

726
00:34:55,000 --> 00:34:57,000
And then we can open that specific image if you want.

727
00:34:57,000 --> 00:34:58,000
Okay.

728
00:34:58,000 --> 00:34:59,000
We are writing that image.

729
00:34:59,000 --> 00:34:59,000
Sorry.

730
00:34:59,000 --> 00:35:01,000
We are writing that image inside this particular PNG.

731
00:35:01,000 --> 00:35:02,000
That is same.

732
00:35:02,000 --> 00:35:07,000
See whatever things we did over here, only the thing that is changing how you converting that bytes

733
00:35:07,000 --> 00:35:10,000
information that we are getting into an image and saving that in our folder.

734
00:35:10,000 --> 00:35:11,000
Okay.

735
00:35:11,000 --> 00:35:14,000
So let me quickly execute and run it and show it to you.

736
00:35:14,000 --> 00:35:17,000
And then you will be able to understand okay.

737
00:35:18,000 --> 00:35:23,000
So here I will be showing you Python stable diffusion dot pi.

738
00:35:23,000 --> 00:35:28,000
So once I execute it here you know okay request steps 400 generation error.

739
00:35:28,000 --> 00:35:29,000
What is this error?

740
00:35:29,000 --> 00:35:30,000
Let's see.

741
00:35:31,000 --> 00:35:34,000
Uh, so okay, there is an error.

742
00:35:34,000 --> 00:35:36,000
Let's see what is the error.

743
00:35:36,000 --> 00:35:39,000
So bedrock invoke invoke model.

744
00:35:39,000 --> 00:35:40,000
Let me see.

745
00:35:46,000 --> 00:35:49,000
I think there was a small minor mistake.

746
00:35:49,000 --> 00:35:50,000
Which one version.

747
00:35:50,000 --> 00:35:52,000
This this this slight entry.

748
00:35:52,000 --> 00:35:52,000
Okay.

749
00:35:52,000 --> 00:35:54,000
And also let me see here.

750
00:35:54,000 --> 00:35:54,000
Yeah.

751
00:35:58,000 --> 00:35:59,000
So now it is working.

752
00:35:59,000 --> 00:36:02,000
I did some minor mistake over there which I have fixed it.

753
00:36:02,000 --> 00:36:02,000
Okay.

754
00:36:04,000 --> 00:36:06,000
So this is the byte information that we are getting.

755
00:36:06,000 --> 00:36:07,000
See the image bytes.

756
00:36:07,000 --> 00:36:11,000
Now if I see my output folder this is my image okay.

757
00:36:11,000 --> 00:36:19,000
So if I go ahead and see find in folder okay sorry I will go ahead and preview in folder reveal in File

758
00:36:19,000 --> 00:36:19,000
Explorer.

759
00:36:19,000 --> 00:36:22,000
So if I go ahead and create this image see this image.

760
00:36:22,000 --> 00:36:24,000
This is how the image is basically created.

761
00:36:24,000 --> 00:36:25,000
And it's look good right.

762
00:36:25,000 --> 00:36:27,000
But what is the prompt I've used over here?

763
00:36:27,000 --> 00:36:35,000
If you see uh, with respect to this, uh, my stable diffusion dot p y here, we have basically created

764
00:36:35,000 --> 00:36:36,000
something like this.

765
00:36:36,000 --> 00:36:38,000
Provide me a 4k HD image of a beach.

766
00:36:38,000 --> 00:36:40,000
So I hope you got an idea with respect to this.

767
00:36:40,000 --> 00:36:44,000
Now in the upcoming videos, what I'll do is that I'll create some amusing projects by using this specific

768
00:36:44,000 --> 00:36:45,000
APIs.

769
00:36:45,000 --> 00:36:48,000
But in short, once I deploy these projects, I can deploy it any way I want, right?

770
00:36:49,000 --> 00:36:51,000
Hugging face spaces anywhere itself.

771
00:36:51,000 --> 00:36:56,000
So my suggestion would be that try as many as you can see different different like character role play.

772
00:36:56,000 --> 00:36:59,000
What is the input prompt you really need to give based on that?

773
00:36:59,000 --> 00:37:02,000
Try to create use cases which will be amazing for you.

774
00:37:02,000 --> 00:37:02,000
Right?

775
00:37:02,000 --> 00:37:04,000
So this was it from my side.

776
00:37:04,000 --> 00:37:04,000
I hope you liked this particular.

