Main

AWS re:Invent 2023 - Use generative AI to name your pet after your favorite song (BOA208)

Many developers haven’t been able to catch up with new jargon or best practices for generative AI. Whether you’re already getting started with AI/ML or you’re feeling like you’re behind the curve, this session is for you. Join the hosts of the ”Quick Start on AWS: Machine Learning” show, which trained over 7,000 people, to learn how to use foundation models in Amazon Bedrock to name your pet after your favorite song. This session is a builder-focused entry point to the world of generative AI and explores key topics through functional examples to bring the concepts from theory to practice. Learn more about AWS re:Invent at https://go.aws/46iuzGv. Subscribe: More AWS videos: http://bit.ly/2O3zS75 More AWS events videos: http://bit.ly/316g9t4 ABOUT AWS Amazon Web Services (AWS) hosts events, both online and in-person, bringing the cloud computing community together to connect, collaborate, and learn from AWS experts. AWS is the world's most comprehensive and broadly adopted cloud platform, offering over 200 fully featured services from data centers globally. Millions of customers—including the fastest-growing startups, largest enterprises, and leading government agencies—are using AWS to lower costs, become more agile, and innovate faster. #AWSreInvent #AWSreInvent2023

AWS Events

3 months ago

welcome everyone good morning good morning 2023 companies are in a frenzy they flooded developers with an interesting request a way to use generative AI to name pets after their favorite songs sounds absurd right well now while developers aren't being inundated with request for pet names they are really desperate to harness the power of AI for their unique challenges they want a solution something adaptable and transformative I'm Brooke and together with my co-hosts we've already trained over 7,
000 builders in machine learning on our hit twitch show today we're going to show you how the underlying Tech that could name your pet after your favorite Taylor Swift Anthem could be tweaked to solve real world business challenges the magic it's all in the prompt let's dive into the world of generative AI so I'm Brooke and I'll be covering the ABCs of generative AI Fred gracian I'll be covering how we built it and I'm Ben Cashman I'll be taking a look at our prompt and how we decided to do what
we're doing with our application so now you know a little bit about us we would like to know a little bit about you if you haven't been in one of these sessions at reinvent so far that has live polling uh your job as the audience is to scan the little QR code up on screen and then punch in the code 974 591 um if you're watching at home on YouTube in the future welcome enjoy living in the future the the thing won't be up for you but it will be back later all right we've got some votes coming in
that's quick this is really helpful because I think even a year ago we would have all answered this quite differently Ben and Fred would you have answered this differently as well a year ago no absolutely that would I would have been right there at the top too I would have told you XG boost is great I love XG boost I will not accept any extra boost slander here um I also like the first one that says I don't use or build with generative AI I would like to add yet to that one because I think after
the announcements that are happening in the keynote with Swami exactly right now thank you for your dedication to coming to this instead um I think lots of that will change for a lot of people so we're about to close out the poll please punch it in if you have not already look like it does work um so the ABCs of generative AI if we swap back over this started because I speak at conferences all over the world to different developers and lots of people were coming to me and saying that I know I'm
a good developer but I just don't know what to Google to figure out how to work with generative AI there's so much jargon I don't know where to start and I can't get good and clear definitions for lots of the key Concepts so I can then actually build um and then so I was just messaging people in DMS different things oh this is what a Transformer is um and then so I just made it as a blog post publicly so you can view that here we're not going to go through the full alphabet uh today we will go
through some key letters uh but you can see if this address the ABCs of gen AI it goes through from a is to A is for attention to zed is for zero shot learning yes I said Zed not Z I am from Australia look quick yes so West gipping a we're going straight to b b is for Amazon Bedrock Bedrock is the easiest way to build and scale generative AI apps with Foundation models so it's a fully managed service from AWS which I imagine lots of you have heard about during this week and it gives you really e
asy access to work with Foundation models shockingly Foundation models are F which are coming up later in this but it's we're going to dive into this in much more detail in Ben section later so we can move right along from this but you'll learn all about how to integrate and deploy Foundation models into your apps C is for code Whisperer show off hands if you've used Cod Whisperer already yes same uh even my cat has because when you're using code Whisperer um you use the arrow keys to go between
options and you press tab to lock it in I've got a tabby cat so there's a video of the little tabby cat hand pressing the Tab Key now you'll all remember exactly how to use it uh but it's your AI powered productivity tool for the IDE and command line so there's I think at least 15 languages supported now who knows how many that will be by the end of the week and it's trained on billions of lines of code from Amazon internal code and also open source code takes in all sorts of things even when y
ou're Cod C is on the page um all sorts of different artifacts to give you what you're going to use and when you're using Code whisper I've done a lot of demonstrations and sessions about it the biggest tip that I will give everyone it's the same tip I gave Fred because Fred's going to be using Code whisper later on so what happens is you write your code in plain English um and it then uses generative AI to to convert that to code so you're going to write your comment it turns it to code think o
f when you're writing your comments think of that as the prompt so we're going to talk about prompt engineering later with Ben think about how you can prompt prompted to do what you're trying to do especially if it's something that you're not sure how to communicate what you're trying to do thinking about it as a prompt for me at least helps me to get where I need to be going as I promised F is for foundation models it is not the makeup kind it is the building kind so they're pre-trained with bi
llions of parameters and they can be applied to all sorts of different tasks so they're Foundation models because the hard work's been done for you you've got a nice neat Foundation then you can build on top of it that's why it's a building themed name and it's going to help you to build generative AI apps quickly and easily because building your foundation model from scratch is incredibly difficult and also a lot of developers just won't need to do this for the different types of use cases that
they're doing if you would like to train one from scratch talk to Ben after the session now the g-word generative AI which I'm sure you've all been counting how many times you've heard that this week so this can create new content like stories music conversations even videos and it's powered by machine learning called Foundation models so if you think you've got machine learning models Al together then there's a subset of that for artificial intelligence subset of that for deep learning and the
n there's M generative AI nested in under that uh if you would like to go in that in more detail there's a video on my LinkedIn but this is going to help you to do content creation without or with minimal human involvement which is super useful for all sorts of different tasks even things like code generation in code Whisperer this slide is how you can tell they let me pick my own images L is for large language models so this is a type of foundation model that specializes in language and text ob
viously so it can translate it can predict text that will happen and they're going to be using Transformer neural networks if you in mik and Tiffany's session just before us you would have heard more about Transformers you would like to go into them in detail T is for Transformer in the ABCs of generative AI in that blog post and they can learn a new task from just a few examples as you'll see in our prompt with Ben later on P is for prompt engineering so it's a process of Designing prompts to g
uide language models and it involves being really specific about the keywords the context the input even the formatting of what you're putting in so that you can be sure of what you're going to get out and it's about providing all the context that the model needs so it can perform well even when there might be limited data going in um Ben has a fantastic formula for prompt engineering specifically for Claud that we're going to jump into later and uh that will be one to watch as well so now I've
gone through the ABCs I'm going to hand over to Fred who's going to talk about what we're going to be building today all right thanks Brooke and definitely take a look at Brook's blog post it's amazing great set of uh material for going through all the generative AI aspects so let's talk about what we're going to build here so Brooke has her ABCs I have my one two three so number one so as a developer right if you're going to develop an application so I'm a technical trainer try try to keep thin
gs uh simple right so I think of every time I'm creating an application remember these three things number one everything in AWS is an API an application programming interface right so basically it's a contract I'm going hey I'm going to call you and I'm going to send you this information you're going to process it and you're going to return it to me in a certain format that's all there is so just remember that everything in AWS is an API so it doesn't matter if I'm creating an S3 bucket doesn't
matter if I'm creating a Lambda it doesn't matter if I'm calling a Bedrock model all those things are apis you just have to find out what the syntax is so whatever language you're writing it in or if it's a command line what's the syntax so that's number one number two every API call goes through identity and access management or IM every API call goes through I am so I am is where we say who are you you're a user you're an application okay what are what and so who are you first of all are you
allowed to do this thing so what permissions do we give to that user to that application all right so every one of our API calls we're going to check do you have the rights to do what you're asking to do do you have the right to call that Bedrock model OKAY number three all API calls must be signed with an axis key and a secret so when you make those calls we we have a particular signature to make sure that we're there's no m in the middle or anything like that going on so we say this is a valid
signed call a valid set of access keys and secrets so those are my one two 3s I'm going to come back to those throughout the next few slides so let's talk a little bit about what we created all right so what we did to to um for this to to demonstrate this is we have a front-end application written with some JavaScript embedded in some HTML that JavaScript then remember what we have to let's remember our our Mantra there right is that everything's an API so we're eventually going to be calling o
ur Lambda in our second part of this so the first thing we have to do is we have to get permissions we have to get some some permissions now I could hardcoded my access keys and secrets in my in my HTML file bad don't do that don't ever do that right so no what I'm going to do instead in this case I use Cognito configured it to say hey hey Cognito I'm going to use an unauthenticated guest access and I'm going to use go to IM am and say hey I am give me a role to give me the permissions to do the
thing I want to do so the thing I want to do is I want to call that Lambda now Lambda is going to call Dynamo DB it's going to call our Bedrock model we're going to call Dynamo DB because I want to save all of the requests that people so you're going to give us some songs here in a minute we're going to give you back some pet names I want to record those I want to kind of go back maybe I want to audit you know um you how how was How well was our model working what were the choices that it made
do we agree with those were there any of them that we don't you know kind of think are that are that awesome so what can we do to fine tune later on I'm going to call Bedrock we're going to call the anthropic model using a prompt and Ben's going to talk more about prompting here in a second but I'm just calling an API right so I just needed to know what was the Syntax for invoking an API that's it and then finally Cloud watch for anything that goes bump in the night any kind of problems that I m
ight have or I just want to see you know what was the timing between my calls and things like that so anything like that that I would want to log so you know it's a pretty you it's a simple but it's a nice pattern right because I'm not having to hard code anything in that front end it's a simple pattern and later on we'll in our blog post that we have you can go to find out how you can actually get access to this code very easy to reproduce this in uh in in in in your Amazon account all right so
again so what are again what other tools do we use we use code Whisperer because I'm I'm I'm an application person um By Night by day I'm a trainer most my career has been an IT plumber so I'm not a software developer so what I like is I can use code whisper and give it some prompts and say hey I just need to create this I need to create this Dynamo DB table I need to update this Dynamo DB table I need to scan that I can just tell it those things I don't remember that syntax let code whisper he
lps me that syntax I'm not a front-end developer for sure so it it's awesome to be able to use code whisper to help me on that part if you haven't the other thing I I used in this uh de demo was the ser application model or Sam why would I use Sam there's a bunch of different ways that you can develop in AWS um and but the seress application model I like because a couple of things is it's very simple I put together my code I say hey initialize my environment and deploy my code and then it unders
tands what I'm asking it to do I give it a template in that template I when you see that we I gave it the instructions on hey what is it I'm oh I'm Turing Lambda okay cool and I want to create a Dynamo DV table uhhuh okay and here's the keys that it needs and here's the uh the the rooll that my Lambda has that says you can go ahead and update that dynal GB so it's kind of nice so that's why we use Sam um again I use the all the front end using Code whisper because I I am not you'll see in my dem
o I I I'm not the best graphic designer or anything like that but we just wanted a PC right so we accomplish what we wanted I my two customers came to me and said who we need this application and and keep it simple cuz I tried chat Bots and all no we didn't need that we needed something we could leave behind for you folks it's easy to reproduce we were very needy customers very yes they're they're good good customers um demanding though very demand but we so now the thing is okay what do we need
to put into our application because there's that one part that I didn't know I can do all the other stuff I've done it a million times but that last part about calling Bedrock so I had to work with Ben cuz you know and I would send Ben things he's just like Fred Fred no you're making too too difficult and so we worked together to come up with the prompt that we're going to show you and and it met our needs right so we worked all gri so we went through multiple iterations of the prompt cre a sim
ple template you'll see how I just used python to incorporate your requests and then then send that on to our our model and then uh with Ben's guidance we decided to use the uh anthropic CLA 2 U model for our are great for text generation perfect for what we were trying to do all right so that's my piece I'm going to have have Ben come up and talk a little bit more about you know how we're going to build it thanks Fred all right so thanks for answering our poll earlier I'm glad to be helping you
all on your first steps into generative Ai and taking a look here uh I think it's time we introduce the Amazon Bedrock service formally so understanding Brooke mentioned Foundation models a little bit earlier uh I like to think of Bedrock as a hub of a variety of different Foundation models that you have available to you at your fingertips some of them are good at some things and some are designed to be more specific to certain tasks uh in this specific case uh back to what Fred was saying a bi
t earlier uh I'm a huge fan of the keep it simple framework uh if you will um but taking a look uh from my experience as a a Solutions architect uh in the uh independent software vendor Market that's isvs uh we see folks doing a lot of different tasks I'll just speak briefly about those for a moment we have verticals that are using them in financial we have folks that are doing them in cyber security so thinking about I've detected a threat okay so I've classified a threat but maybe I want to un
derstand why we've classified that threat as a threat generating an explanation of why it is that way another very common use case I'm seeing is um the ability to empower our customers to adopt our services and I say our services the independent software vendor Services as well more easily how many of you in here a SQL Developer okay just a very sparse number of hands here um would it be great if we could use natural language to generate SQL queries absolutely so we can start to understand that
some of our isvs in the database Market are also leveraging tools to make their databases and your data which is where we derive value more accessible to you as the customers bring it back to benrock so you have the opportunity to choose from a variety of foundation models uh specifically in the demo that and the p that we've built out we're leveraging anthropic claw but I think we should definitely let you be aware of some of the other options that you have available to you something that we ca
n do we didn't necessarily do it in this POC coming back to the keep it simple framework but you can customize these models with your data so uh if you haven't heard it yet there's a technique called retrieval augmented generation or rag for short so we're enhancing the output of these models with data that we feed to the model at time of inference that's getting a bit more Technical and you can connect it to your own data sources as well so curious anyone maybe heard of uh Amazon Q uh maybe in
the last couple days here as well okay so these these you can see Amazon is adopting these Services uh as I was mentioning we're seeing in our isv space as well so let's take a look at what we currently have available for you today in the Bedrock ecosystem we have our first party models which if you take a look up at the screen right now we have Amazon's Titan we also have access to AI 21 labs they are what we'll refer to as a third-party model you may see that in some of our blog posts as 3p we
have anthropic uh anthropic is actually what I did The Prompt engineering for our POC today that we'll be taking a look at um we can talk about prompt engineer ing here in in a moment in our next few slides um it's an iterative process I I'll just keep it at that and then we also have access to cohere models um so you'll have Titan embedding models coming back to Titan for our first party we also have access to a cohere embedding model in Bedrock as well so if you're not familiar with embedding
s right what that means is I'm taking my natural language I'm feeding it through this model and now I'm representing it in numeric format or or vectors then something you know so I've mentioned first party I've mentioned thirdparty models but we should also be aware of Open Source as well so that's where the Llama comes in uh Brooke had a a slide earlier with the the Llama model um earlier on so we should be understanding that llama is available to you and if you have any use cases where maybe y
ou're interested in developing marketing collateral you can do text to image as well with stability AI okay our prompt so I happened to be a big Beatles fan the Genesis of this project was okay what kind of pet names can I come up with if I talk to this large language model and say uh you know my favorite Beetle song is Dear Prudence and Claude came up and it said prudy it's like that's pretty good okay we can we can develop a simple p use case which is you know as a demanding customer for you k
now we built this thing out so um prompt engineering is going to be different uh across your various different models and I want to point that out because uh if you take a look at this particular prompt um and I apologize we probably should have had it at the top and the bottom as well but if you take a look at this example section here in the middle it says human and it also says a system so when it says human this is what I'm expecting my user input to be so deer Prudence by The Beatles and th
en I'm giving it an example in this particular case where I say assistant and when it says assistant this is what I would expect the model to come up with so any particular prompt that you feed over to bedrock if you're using specifically anthropics CLA will NE need to use human and assistant and something that I have found to be incredibly effective when leveraging these various different large language models is to tell the model who they are and what they're supposed to be doing so in this pa
rticular case you can see we've highlighted role and in this case I'm saying you're a pet naming expert okay but not just any pet naming expert a pet naming expert based on song titles the name and the artist that's being provided as well something else that these large language models tend to do very well is they take they follow rules uh to say the least so uh as an example Fred I know we did a twitch series together uh what was your pet's name mocha How Could You Forget but uninitiated we fea
tured mocha heavily in the series so were you watching or just on the show well yeah yeah mocha is a very good short name that's great yeah absolutely and so if we take a look at rule number three here I probably don't want a 13 syllable pet name coming out of deer Prudence frankly so I can specify that in my rules I didn't mean to forget Mo I'm sorry Fred that's right but she falls in your category so we're good yeah absolutely so some other things I'm I'm asking the model to do I'm saying okay
it's got to be creative um it must Pro you must provide at least four options right so just providing me prudy okay that's great but maybe I might want some more inspiration there for things for me to choose from and then explain your choices so giving the the model a set of rules and then something Brooke mentioned earlier zero shot learning this right here is not zero shot learning this is actually singleshot learning where I've now specified you know I'm going to give the model an example so
coming back to our isv Market thinking about generating SQL queries it would be really helpful if I could let the model know based on this user input this would be an expected output you know and that may be a very specific sorry specific SQL query in this case Dear Prudence we've got prudy sunshine Deary and sunny in my opinion would all be decent names for this model to come up with then we need to feed in the user input so all of these things I have just shared with you are abstracted away f
rom from your users they don't get to see this right so you know they may see a text box which we'll show here in a little bit with Fred you'll input some information and you'll generate the output through a really nice user interface so you take the user input and at this point the model should have an understanding what it's supposed to do and and something else I've seen across large language models if you give it one more sort of command and I it doesn't highlight it on on the next slide her
e but you know based on the song title and artist provided give me at least four pet names it's very well attuned for uh you know the final portion of of the prompt that's being sent over to the model all right so let's get into why we built it this way Fred okay yeah this pot is I I'm extremely online I make a lot of content this part alternate title is pre-answer answering L's the comments I would get on social media if we posted about this um so on this architecture Ben and Fred um why did yo
u choose Cognito right I mean the biggest thing is like I want to have that security posture again you don't want to have put your your your access keys and secrets right so it just gives you a secure way to have that now the only only you know in also in the other aspect of this is the IM role that gets served up that's assigned to that unauthenticated guess roll through Cognito um only can call that Lambda for example right so you would have to um call the Cognito so you'll specify your Cognit
o configuration to your role to your Lambda right but the nice thing is again it's just those access keys and secrets I don't have to store anything in that front end you never want to do that right and we're not I'm sorry one one more things that we use on unauthenticated we're one step away if we add authentic to the front of this now we can just get authenticated users instead right yeah and so this is really a proof of concept this isn't production ready but that's the point of it like we kn
ow you're not going to use this for pets but it's really about how can I take a prompt and put it on an absolutely minimum viable front end so that you can have the whole piece there uh Ben I guess if one of your customers wanted to extend this out for production what are some different considerations they'd need to take into account yeah so Fred mentioned a little bit earlier being able to understand what's happening with you know the inputs and the outputs of the model uh something I could see
being very helpful is keeping track from a security perspective of who's trying to make calls or back to Fred's Mantra what may be making the calls because everything in AWS is an API call that means Services can make API calls over to bedrock so something that we don't highlight in this particular AR architectural diagram is cloud trail right so we can keep an an eye on what's happening within the cloud mhm and I think also that that if you look at that invoke the Bedrock you did anthropic gue
ss what so one line change to change a different model so that's the other aspect of this it's pretty simple to try so you're going to hear all these announcements this week take this one swap in um slight changes you might have to do in responses and things like that we'll talk about a little bit when I demo some of the code here um but yeah it's pretty simple to now try a different model I had before and we simplified it I had 20 of them that we were trying and everything else but we realized
no we don't need that I need to follow what my customers asked for and give them what they ask for so I did yeah and we will be taking questions at the end so if You' started thinking of something you would like to ask uh keep it in your pocket we will take those at the end right all right oh boy excellent so guess what folks it is demo time all right so the first demo I'm going to do is um walk you through uh code Whisperer and how I use it to come up with the dynal DB code that I needed okay d
o we need to swap to your I will yes and look at that all right there we go so because I'm a horrible typer um I there's no way I was going to try and code this by hand so I'm going to do this via a little quick video here here all right so we're going to start off here and you going see that we're going to just kind of go through just look on the left hand side this is VSS code running code Whisperer so um went through here so just making sure code whisper is on everything else I you you'll see
you have to you log in with a your code your Builder ID and things like that but now I'm going to give it a prompt right so I don't think of this as a comment as much as a prompt so the way that in python The Prompt or the the comment is the hash with the comment so here I'm asking you create just a simple python function an update table now notice what it did there it's kind of interesting uh if we just back that up a little bit here not quick enough on my mouse here so I am asking it to do th
at there we go so I'm asking it to create the this simple function right is it running yeah while this is loading if you're ever having trouble getting code Whisperer to um pop up for you I think in Mac it's option C um and it's something very similar in Windows but look that up if that ever just stops where it's not coming up for you uh if you're me and for example swap between several accounts for demo purposes this can happen so just option C and your examples will come straight back up okay
so we'll just we'll let it go here so again so it's going to come up with that comment I backed it up a little bit watch when it pops up the code that it pops up is for a SQL light database well I I don't want a SQL light database I want a d DB table right so I'm going to go ahead and uh I'm like okay thanks for that that suggestion but I don't want to use that suggestion right I don't want a SQL light table I want dyn DB so I need to give it another prompt I'm going to tell it hey give me a pro
mpt to create a table with my model ID is my key field and then my date time is my sort key okay so now I'm giving it I told it what's going to be passed in as results and everything else so that here's you know Let it go ahead and create that code for me now and you know this is nice because you know as much as I've done you know things with Dynamo DB in the past you know I don't do it that often and sometimes in you know now here I'm in Python but maybe I wanted to do this in Java or some othe
r language right so now here it gives me all of the syntax here and I noticed that it threw me boto 3 in the date time here so I'm like well I really don't want those in that function I'm going to pull those out and put at the top simple it but it still gave me everything I needed it knew that I didn't have those yet and put those in there which is pretty cool all right so next thing I want to do is all right cool I want to be able to scan the records that I put into this so let's see if we can
ask it to create a a function so you have cr function P that to scan that table and return all the items give it the pet name and the thing and here we go give me the Syntax for scanning and and that's one I I I messed that up quite a bit um the return items piece I I've messed that up when I've coded this by hand so I like that like cool thank you very much I want just simple python now that just says hey give me a main function and call both of those things in that order all right get my littl
e main function now watch I'm going to be really Brave here it would have been really Brave if I had actually been running this and typing it but I'm not I'm going to run it without debugging okay so let's see what happens so we should get hello reinvent 2023 to come out of here in the response me hopefully it doesn't get cut off too much yeah it's hard to see but you can see behind my uh my prompt here the the screen it did return our hello you know 2023 let's do one more though because we want
to give a good shout out to code whisper why not yeah so resolution on the screen's a little bit different here but we should be able to see in the bottom code whisper this is so cool one more update to our table now this is the code that then I put into our application to then um take all your prompts in okay so this is actually the code that I just literally took from this and pasted into my application okay all right so that's a real quick code Whisperer piece let's spend a little bit of tim
e on some of the application pieces here so if we look at the this is the front end uh piece so in here oh here we go so here these are not real identity pools because I wouldn't want to give you my identity pools but they're hashed out so this will be the code that you'll get you know if you download the app but here so you there's some instructions on how you set this piece up but this is the call to the API call that I'm going to make to get the credentials for my front end app what four or f
ive lines of code get that thing so once I've set up my roll and I've set up Cognito now you know you can think of this is I've got some temporary access keys and secrets so now from the front end go down here put in our function name that's our Lambda function and then here's so there's the Lambda invoke that's your API call okay so all I need to know is what in Python Bodo 3 what do I have to do to invoke my Lambda and that's it for the front end pretty simple now probably the most challenging
aspect of this stuff to be honest with you is the return values coming back in the Json and manipulating the Json but other than that because I'm not a front end developer not but that's nice yes but that was nice to you be able to use things like uh uh code whisper to help me with that so let's look here inside this is the the the Lambda application okay so now this was based on the prompt that my engineer uh gave me here so this is my way this probably not the only way to invoke this but this
is where we're putting the prompt in so now I'm coding this into my Lambda this is the thing I'm going to formulate this call The Prompt to send to our U uh anthropic code and just to Spotlight this if you're used to using llms only through a chat interface and you've wanted to know how to get it going with some sort of a front end this is the answer here so when we're talking about the different abstractions earlier in Ben section yeah yeah this is really how Fred's done this yeah yeah exactly
and there are like I said there are many ways we could have sent this in as a entire block you know from the front end but then we had to code that um so you know here we're doing this and then all I'm doing is you'll see I'm sending in title so that's going the piece that we're going to get from you in a minute we're going to pass this in here we're formatting this thing as Ben said we got the human and assistant aspects of how anthropic wants this call to come in so just a real quick little t
hing here just to this is where I'm kind of formatting it so it's in that human in assistent format all right so I can take that the and put it in there because that's what what uh anthropic is going to want so if this was a different model you could take the same prompt but you'd have to specify differently when you invoke that particular model because each have a different way that they do that um so the temperature is interesting so we've got this thing dialed up to be as creative as as we wa
nt it to be right so we want this to be generative and and anything more you want to say on on some of these uh Ben just some of the choices we made here yeah yeah so we we told the model to be creative but one of the parameters and and this can be configured so temperature at one uh that's we're asking it to be in the way I like to say it is as creative as possible now that's really good for naming a pet frankly in my opinion but just coming back to the use case that we talked about a little bi
t earlier generating SQL queries I really don't want to being creative on that not at all right so in that particular case that one is going to hedge way closer towards zero in that particular case and this is really important to communicate to your Executives and Business Leaders or people asking you to build things like this um that's what I did for a job before I got my current job and so much of it is just giving people a shared vocabulary because they might not even have words to fully desc
ribe what they're trying to ask you to do so as a developer it's a great place to step up if you give people words to talk about what you're trying to do they'll be able to talk about it with you and you'll get to a much better response so if you're starting to get asked about generative AI having conversation about what temperature you want to set even things like top PE with your Executives that's going to really bring them into the development process and help to understand what's happening a
nd then even showing them if you change this parameter this is what's going to happen so if I pull this lever this is what happens things like that they're going to ask you better questions um and it's going to be so much less frustrating for you long term if you've given them some sh vocabulary and this is a great place to start for generative AI yeah I started with slider things and all kinds of things that you know where you could pass these in and I'm like we're going to keep it simple does
slide is in potty Rock in the advanced settings be initiated yes very good good call and here is guess what another API call so now this Lambda has permissions to invoke Bedrock you know there's some other things you you'll do and it's document in our blog post on how you get permissions to be able to use those Bedrock models yeah go ahead Ben do you have to give API keys or anything there Fred or does Bedrock even have API key not in this case no I didn't need any API calls cuz I'm just invokin
g the Bedrock API so that's that's that's pretty much so that's is awesome because mean I can do this in many different contexts all I have to do it's just like any other API that's what I love about it t tier Point Ben that's absolutely right um yeah so so we're following all the same rules all right so we're going to switch back real quick and Brooke you want to take us through this uh section here we're going to kind of swap back and forth here a little bit Yeah so we need an input to put in
to what we've built now so so another poll uh so with without your camera again it's the same address you just put the different code in this time the code is 532 328 um and you'll be able to select your favorite song from a list sorry for no problem scrolling up so I can see the options I think this PO is this the one with Hey Jude by the Beatles whole lot of love by lead Zeppelin Good Vibrations by The Beach Boys and I Can't Get No Satisfaction by The Rolling Stones and Purple Haze by Jimmy He
ndrick um I wasn't born when these songs were out maybe you weren't as well but out of all the things that you can research after reinvent looking up these songs if you're not familiar with them is a great place to start very excited to see how this is going to turn out cuz this is a lot closer than I expected oh this is good yeah do you have a favorite on this list Ben I absolutely do Purple Haze by Jimmy Hendrick right for the uninitiated Ben would play his guitar on our twitch stream when thi
ngs were running and loading and things like that so Ben's really underselling how much of a music fan he is you can watch uh recordings do you have a favorite from this list FR yeah Good Vibrations I I'm a Beatles person or a Beach Boys person that's my era so yeah I was born two years before that but well it looks like the winner I'm going to give you about this is crazy oh I see some cameras coming out to oh they're taking photos of the thing I'm going to close the poll now because it's settl
ed down so Purple Haze by Jimmy Hendrick do you want to swap back over Fred okay here we go so Purple Haze by Jimmy Hendrick oh our screen switched there Fred oh we are good come on manab there hang on come on we are just looking for the one with Fred there go have found it all right so how good is our front end when we talked about a proof of concept and minimum viable this is really able to get your point across so you can show that something happens obviously the way you wrap that up you can
then do with whatever you actually wanted to do for your front end but this is what we're talking about of just having something where you can start the thing and I probably typed it wrong but you know I think our models be able to figure out so we're gonna go fetch our names and then it's fetching because it's pet things so remember now what do we do we went out to Cognito we got an access key we signed the call we call Lambda lamb is calling our our model sending in our prompt and then returni
ng us some results yes all right so okay do you want to read them out Fred the sure we got what hazy perss Indigo hang on a second indigo is three if you remember our prompt it said should be less than two syllables didn't say must right so this is good we found this a lot with the different models sometimes when there was a really good one it did more than the two syllables and I was never mad about it but yeah all right back to our poll everybody good so the other thing sorry just before you s
witch off this Fred it gives you the name and then a description which is really helpful because it helps to understand where the model's coming from if you're not familiar with the lyrics of the song Some of these would seem a bit wild um but it's a good way to see what's happening and additionally because we've got four options here to choose from we're not putting all that eggs in one basket and we really do have different ways to choose from this sometimes for an output you just need one sin
gle output but this is all about understanding your demanding customers um and working out how you can best serve them because usually from all the tests we've done on this in our extensive application testing um we've all been pretty happy with at least one of them on the list so it's always been really good to see do you want to swap us back over for the next call for one more note on that though Brook um so explaining something incredibly helpful I mentioned a use case around this for you kno
w cyber security a threat was detected great we've classified that but why and can the model tell us why based on the information we've provided it why that is so you know why did we pick prudy you know yeah and just while people are filling out this poll currently so the code is 528 683 being able to answer why is really important um one thing that would happen when I was designing machine learning systems for people they would always say could we do this and I would say should you like how far
can you actually get with this or if you do get the answer you can predict what you wanted what are you going to do with it so having this Y part is really helpful context when you're working with it look at this so the option Bohemian rap city by queenia oh something moved Born to Run by Bruce Springsteen Stairway to Heaven by Le Zeppelin and Dream On by AOS Smith Fred do you have a favorite from this list um Hotel California would have been my mine so not to not to you know influence the audi
ence at all but uh I'm just going to go with the popular opinion on this one Bohemian rapity is an excellent song and the movie was good too Bohemian rap city has a lot of cat energy I think does anyone have a pet with Born to Run energy because yes um but Bohemian rapity we're going to pop that into the model in just a second I'm going to swap back to screen we're good he already typed it in which is crazy all right so again AL toog we're getting our exis key we're going to sign the call we're
going to call our Lambda lambda's going to invoke our model we're also recording all of this stuff in Dynamo DB and all in the cloud watch and me get this so yeah here's Galileo again so that was do you want to read these out PR the options got wraps mama so that's interesting Galileo figuro that's a pretty good one right that'd be I like that one the last two more than two syllables but once again I'm willing to allow it do you have a favorite from this list Ben you know as far as a pet name go
es Galileo is pretty good it's a strong name yeah yeah figuro is already in in a Disney movie right so we got that all right we have one more I think one more poll so the newest code is five no that's not a five that's a three I know how to read 324 320 so the options for this are Sweet Child of Mine by Guns and Roses Every Breath You Take by police are the police uh With or Without You by you two Living on a Prayer by Bon Joi and I Of The Tiger by Survivor do you have a favorite Ben from this l
ist Sweet Child the mine's pretty good oh yeah the crowd agrees it seems if you don't agree with Ben now is your chance to run it do you have a yeah I'm going to stick with my answer yeah it's I had right you know for sure big Rocky fan I think in terms of pet names though like Every Breath You Take when my cat's just watching me sleep or something and I just can never Escape it's very accurate oh but things are changing yeah it's getting close if you'd like to choose a side between Sweet Child
of Mine and living on a pre now is your time to shine but it looks like it's settling down you get to type in the whole name Fred you're going to be excited about it Sweet Child ohine by by Guns and Roses we will swap over momentarily all righty one more time let's go fetch those names yes remember our Mont we're calling our API we're going to go get our access keys we're going to sign our access we're going to call our Lambda lamb is going to invoke our function love thisor voice the other thin
g I'd like to point out so you can see in this Top Line Of The Prompt uh Guns and Roses is not and it's an N but the model still knew what we were talking about so depending on the use case that you end up using this for if you don't use it for your pet names thinking about where it can and can't figure out what you mean it's going to be a really important Edge case depending on how important that result is for your business have you seen any applications of that with your customers band of peop
le working with hazy inputs you know I've created some hazy inputs and have delighted some folks with them regardless my spelling errors there's a few of them but underlying everything that's going underneath uh it's the semantic meaning of the words so folks are familiar with that um classic example is king and queen are very similar in meaning in space and so that's really what's happening with these models is they're they're understanding your input based on you know repres sorry numeric repr
esentations of words yeah and that's how they are able to map those semantic similarities you can learn more about and E is for embeddings and V is for vecta databases in the ABCs that we'll go into that with more detail so next steps I would like to preface this was anyone here early and saw me actively cheering off stage that's because that was the moment this blog post went live thank you so much to our content team I absolutely terrorized them this morning um but everything we've talked abou
t is on a blog post right now so this is on a Blog called AWS community so it's community. AWS uh it's where I post all of my AWS content including this one which we co-wrote together and this is going to step you through how to build on this if you can't scan the QR the address is s12d docomo session code b208 if you're watching in the future maybe this will even be updated a little bit when you see it uh but hopefully we'll be able to put the link in the video description for you um this there
's so many different blogs on here from different other people in Deval other people in the community it's a very like underground AWS blog but it's where I've been excited about posting my stuff so there's this post here as well as the ABCs of generative AI are on this page I also have a post about how to learn generative AI from scratch um and this and some others so keep in touch um we're going to answer some questions now so if you have a question

Comments

@brookebytes

Loved getting to present this!