How to use Microsoft Azure AI Studio and Azure OpenAI models

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I'm going to cover Azure AI Studio which is useful if you're looking to build something a bit more complex as either a beginner or a professional developer at a company there'll be five parts to this video first I want to take a look at Azure AI Studio second we'll take a look at how to build models on top of azure open AI Third how to import data to a model from like a CSV or a database fourth how to configure and then deploy that model and then fifth how the API works and how to use and access that model for a project now I'd also like to thank Microsoft for sponsoring this video a lot of what we do today will be built on top of Microsoft Azure service so if you want to learn a little bit more about that I'll add links in the description below Azure AI studio is a combination of tools from Microsoft such as Azure open AI machine learning and other AI services such as speech and vision all in a central place with it I'm able to do things like deploy models and test them on the aure openai service I can add custom data for better prompting such as using a database or a file or a document or even a web address I can Define prompts to work almost like a flowchart this means that the prompt flow feature allows you to create and customize the models and how they function I can also integrate content safety filters this helps me mitigate problems like harm depending on the type of solution I'm building I can also combine multiple AI capabilities to produce a much more advanced generative AI solution here is the Azure AI Studio website I'm going to link it in the description below what's pretty interesting is that there are quite a few different models here ones from meta as well as ones from Microsoft themselves and the ones here from Azure open AI which we'll be looking at today if you want to take a look at all the models and the catalog then you can select here to preview all of them there's quite a few including Nvidia the Microsoft research program and Desi AI and many more for this example I'm going to select Azure open Ai and I'm going to select to use the GPT 4 model but I'm going to need to sign in first so I'm going to sign in with my user account once done I'm taking back to the studio dashboard and here I'm going to have the option to create a new project as well as select a model to use I'm going to create a project called Azure AI Studio demo example then I'm going to scroll down and select to use the GPT model over here so that I can get this deployed and start using the studio properly to deploy it I just give it a deployment name and connect it to one of my projects this takes me into the main dashboard for Azure AI Studio the main part here is the playground if you've used AI playgrounds in the past this is very similar you have your AI settings for the system on the left hand side the chat dialogue in the middle and additional parameter configurations on the right what makes Azure AI Studio unique is a few other things such as the prompt flow which which will'll create later as well as being able to manage your data here in this data section heading back to the playground let me set up a basic environment that we can utilize so I can show you how some of these things work the system message is what initializes the context for the AI and its chat session you can write whatever you want here and there is no limit but be aware that it does count towards your token limit for this example I'll say that this is a coding assistant AI helping me solve problems now there's also Al something called variables I'm going to add one right now called languages and in programming there's lots of different programming languages so I'm going to create a language that we're currently using which will be JavaScript this variable can now be called inside of system prompts as well as chat prompts and this can be useful if you're building out an application I can reference this variable inside of my system prompt using the double squiggly bracket I'll select apply changes and continue to make sure that this model is now updated I'm going to test all of this out by adding a simple prompt here hello what are you and the response back here from the AI is that they're a coding assistant helping me explain problems in JavaScript on the top menu here we have playground settings if you select it you can select which language the AI uses what subscription you're utilizing and if you want speech you can add a speech resource too I'm going to select a save for this and on the right hand side we have parameters you've probably seen this before where you can set the response the temperature top PE but most of these things is useful to keep on default unless you're specifically customizing it for an application I'll have chat history and most of my chats will continue on in the form that the system message presents which is in JavaScript with an explanation of what's happening on the top right here I can change the mode from chat to completions or images and this is useful if you're using other models right now since I'm using GPT 3.5 turbo it doesn't have images or completions but I can swap the models around by selecting a different deployment one toggle I like is so Json which allows you to see the raw inputs and outputs that are being sent to and from the API these include the system message as well as messages from the user and the AI assistant and it's perfect if you want to copy and paste these into just some programming code prompt flows is another feature from Azure AI Studio which has the ability to visually showcase exactly what's happening in a more complex prompt I'll create one here using the custom prompt flow option and it's going to generate this in the prompt flow area it's a visual on the right hand side of an input a chat and an output on the left hand side I see some of the raw code of what's actually happening in the background and this is where I can customize it whether I want to add more steps in this process before or after an input gets generated heading back to the prompt flow dashboard let me create one from scratch there's a few different types you can select from standard to chat flow to eval and there's 's also some pre-existing ones you can use as a demo to get a better idea of how they function let me show you this one with chat with Wikipedia since it's doing a few interesting things like using python adding a few steps and accessing the internet once it's loaded here on the right hand side I can see exactly what's happening which is it's extracting the query from a question grabbing the URL from Wikipedia then searching through the results of that URL and then then processing those search results to send back to the AI while this might seem a bit complex and you'll need to know a little bit of python and other things to be able to code this this is more or less just an example of the scalability that you can build out if you want to learn how to utilize this properly now I'm going to show how to add data to your model here on the left select add your data then select to add a data source this is probably one of the more useful features here in add data you can select from the data sources being Azure AI search Azure blob storage and upload a file which I'll be showing in this example to complete this step you'll need to select your Azure subscription you may need to also select your Azure blob and search resource but once you're done select the name of the index select acknowledge and select next this will bring you to the upload file section you can drag and drop any kind of file that is readable such as text or documents or PDFs I've got this nice handbook from Flavio CZ which I'm going to be using which is kind of like a handbook on nextjs if you have internal company documentation PDFs or resources you want to query the model this is the perfect place to upload it I'll drag and drop it and upload it just here selecting next I can select the search type to be keyword or semantic be aware that using semantic search will incur a cost using Azure you can always fall back to keyword processing here in the background it will upload the file and once it's done it'll index it and it'll be available to use mine's just finished so let me try out a prompt since the file was about nextjs I'm going to ask it what's the best way to run a server side action on a file the response I get back is an example of a bit of code with some information about what this piece of code is doing and if you have a look closely here at the bottom you'll notice that it is referencing the document that I've actually uploaded earlier I can see the citations it's using as context to be able to answer this query properly this can be customized further in the advanc section with how similar or strict content is when you do upload files or data you can head over to the data section under components to see it I've got one here for index.js and another one here I created for search index I can select these and I can see the current version on one which is version one I can add tags to them or I can even upload a new version if I head back to the playground and go to add your data I can also remove the data source if I'm no longer using that specific one or even if I wanted to change it what's pretty interesting is that if you load up the prompt flow with a custom data source you get to see a little bit of what's Happening behind the scenes here you'll see that inputs have a determined intent which extracts the intent and retrieves the document then it formulates a reply and sends that reply to the user under the hood there is actually quite a few complex prompts happening here which is useful if you want to learn some prompt engineering now I want to show how to do some deployments on Azure AI studio and while you can deploy a web app we might take a look at that a little bit later when I select the deployments tab I've got a few examples of instances of the AI model that I've already deployed and I can also create new ones if I want these are currently on Chad GPT 3.5 turbo I might want to deploy a model on Chad GPT version 4 by selecting create and selecting realtime endpoint I've got a number of options for models here these actually are all the models available and I can select GPT 4 right here selecting confirm I'm taking to one more step to deploy the model but I do have an error here to get access to this model I do need to put in a request to the Azure openi service team here in the documentation I can select apply now and this takes me to the form to request access I filled this out earlier passing in my subscription ID and it was quite quickly approved heading back to deployments I can select GPT 4 now and I'm going to select the model that comes with vision I'm going to ignore this message because I do know that I have requested and confirmed my approval selecting create has deployed the model and now it's available for me to use immediately in the playground or with the API which I think we'll take a look at next inside of the playground on the right hand side under deployments I can select to swap it from GPT 3.5 to GPT 4 I can also enable enhancements which for example allows me to add Vision to the this model but you will need to enable this aure service now the final part I want to take a look at using the API for an actual project that I might be coding under deployments I've got my ader and twarog chat GPT 3.5 turbo example and in this example I have the target URL this is kind of of like the endpoint as well as the key that I can pass in as an environmental key the other thing here is the playground itself under playground there's a useful Little Thing Called view code if I select the this button I actually get a preview of a pre-made prompt that I could use inside of some code this one's in Python and it's got the python configuration for a chat completion with the URL endpoint and the key that I need I can also view this in other languages like cop as well as in just a Json format if I'm using a different language like JavaScript or typescript which I think I'll do next by selecting a learn more I can actually go to the documentation website and here I'll have a lot more more info on how to configure using it inside of a project since I want to use JavaScript I'm going to select the JavaScript option and the main thing here that I need is the keys as well as the endpoint URL inside of the Microsoft Azure dashboard I can search up Azure AI Studio these are all the instances that I've created so far what I'm going to do is select the latest one and instead of selecting to launch the AI Studio what I'm going to do instead is scroll down and see the keys as well as the endpoint URL which I can now connect inside of a coding project inside of vs code here's a brand new empty project in vs code I'm going to create a file called index.js in order to query Azure open AI I need to install the package so here I'm going to install at Azure slopen aai next I need to pass the environmental keys so I'm going to create another file here called EnV and the two keys I need is the API key and the endpoint let me select to copy these from the documentation and paste these in let me delete the syntax so it's properly assigned for JavaScript here I'll add one more environmental key the model itself which I'll set a little bit later on for this example I'm going to deploy out a new model I'm going to select deploy a real-time model and this model will be the GPT 3.5 turbo instruct model once deployed I'll need to grab the key as well as the URL that I'm going to use for the endpoint so for the URL I'm going to select to the playground I'm going to go to the view code section and I'm just going to pull the open AI base URL from here I'm also going to grab the model itself or the engine as they put it here and this engine will have the following name gpt-3 dturbo d instruct finally I'll head back to deployments and select the deployment model once more and here I'm going to copy out the key and paste this in here now make sure you keep this private and Anonymous and don't share this out publicly because it is what authorizes all of your requests now back to the index.js file here I'm going to require the constant values of open AI client and the Azure key credentials from at aure slopen aai now I want some environmental keys to be used our require. EnV which we installed earlier calling config what I can do now is call const endpoint is equal to process. env. aure open AI endpoint and this can save it to the value endpoint I'll do the same for the API key as well as for the model itself I also want to define a prompt so I'm going to do cons prompt is equal to and in an array I'm going to add the string the best way to do Hello World in JavaScript is buy I've done it this way because it's not a chat but a chat completion I'll be doing next I want to run a function but I just want it to automatically run so inside brackets I'll do Asing function as an arrow function and I'll call it straight after inside of this asnc function I'm going to do console log and begin this chat completion I'll initialize the client by calling cons client is equal to new open AI client here I'll pass in the endpoint as well as the Azure key for the API I also need to add the deployment ID so I'll pass it in here calling the environmental key that I had earlier set to model finally I'm going to call this chat completion I'll const out the results here and call await client. getet chat completion and then I'll pass in the model through deployment ID as well as the prompt I said earlier to view the results I'll have to Loop through them so I'll call for cons choice of results. choices and here I'll just console log out the choice. text and that's basically it I can now open up the terminal and run this function and hopefully I'll get the result back to run it I'll call node. index.js and here I've got a response back open your code editor of choice and then and as you can see it hasn't finished the final line because this is a chat completion there's probably a default token limit but it gives you an example of how this API completes the sentence of what you're writing if you want to learn a little bit more I've added a link in the description which gives you access to this repo of this project I've worked on as well as the ability to sign up to Azure AI studio and its documentation to learn more I'll be covering a few more videos on Microsoft Azure open a AI so if you're interested in any specific topics or projects then let me know in the description below otherwise I hope you guys enjoyed this video
Info
Channel: Adrian Twarog
Views: 60,900
Rating: undefined out of 5
Keywords: azure ai studio, microsoft azure ai studio, ai studio, ai, openai, open ai, azure openai, microsoft azure, microsoft azure openai, azure open ai, gpt, gpt3, openai gpt, microsoft
Id: fQ9RFR1KTbY
Channel Id: undefined
Length: 16min 37sec (997 seconds)
Published: Fri Mar 29 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.