πŸ”΄ Copilot + PowerShell + Polyglot Notebooks

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign [Music] hey what's up folks we are live welcome to the BS code live stream I'm tidying at my desk area as we speak with this uh look at this y'all I made this with my my bare hands from my headphones what do you think I could have bought one for like nine dollars but I made one instead don't act like you're not impressed how you doing Chad good to see everybody uh we got a very good stream for you today uh we have we're gonna do a lot actually we're looking at the title of this thing it was uh it's co-pilot it's Powershell and it's notebooks probably a lot of notebooks if you're not sure what polyglatin notebooks are stick around we're gonna do that we're gonna get right to it and bring our guests on before we do that let's uh let's throw back Thursday go ahead if you work on multiple projects or languages then you know that you can quickly rack up a long list of extensions and find yourself toggling between different settings depending on your current workflow well you can now use the profiles feature in vs code to customize different setups for all your development scenarios right now I have my custom work and demo profiles each with their own extensions settings shortcuts and more now I also want a profile that only includes the setup I need for my data science workflow in the settings menu I can easily create a profile and I'm going to create an empty one but you can also create one from your current profile for data science I'm going to need the python extension pack which includes the Jupiter extension as well as the polyglot notebooks extension and I also like to make each profile have a different theme so I'm going to install the Panda theme and set that for this profile now I have my nice clean setup that I can switch to anytime I'm doing data science work and one of the best parts is that you can Import and Export profiles so it's super easy to share your setup with others [Music] amazing profiles are great y'all if you haven't used them use them it's kind of like getting a new vs code set up right out of the box right you just get a fresh install without reinstalling then you can toggle back and forth what's up Pablo hey Ahmad good to see you all right let's bring on Doug what's up Doug Doug Fink is here with us Doug is uh Doug is an MVP and that's all I know about you Doug and you're in uh you're on the west coast tell us about yourself there you go um well thanks for having me on Burke uh this is really exciting today I I've been around the industry for a long time and uh I enjoy doing stuff in Powershell wrote a book in Powershell years ago um I wrote a book I type it the same way in and on I always get those mixed up I wrote it right yeah uh the Powershell for developers and I love wiring things up the Powershell and uh especially since it's cross-platform and you can connect it to pretty much anything um yeah so I've been a developer for a number of years and just as a quick note I know we don't have much time but uh the I actually started in the industry on the Mainframe and I was one of the first people to get a PC on my desk like in the world in probably in Manhattan really what was going back like a trash 80 or something oh no there was this was an actual IBM PC I'm not sure if it was called an XT but it had a five minute five and a quarter inch floppy um that's how you uh booted and it was really expensive to get the disc and uh it was it changed I looked at it I was like wow this is going to change things and the main framers were like that's a toy and I feel like it's the same thing with AI and chat CPT so it's a good set of bookends that's awesome so uh we need to we should get a link to Doug's book on Powershell Doug let's go ahead and bring up your screen here and we'll get right into it but before we do that are you gonna do an introduction just like a quick like if you had to describe Powershell and one sentence it's an object-oriented shell and scripting language and it's cross-platform um and it's much different in things like bash and whatnot uh for example bash is something that's where you where you pipe text from one command to another and in Powershell you can pipe objects from one to another so it kind of eliminates the parse and pray process in bash you actually have to parse the text do stuff that you want to it convert it from let's say text to integers multiply it convert it back to text and put it down put it back on the pipeline um so that's my explanation of Powershell awesome well I'm just a simple JavaScript developer but uh I've seen parasol I've used it I've used it a little bit but uh I know it's it's a lot of people really like it what's up Adnan Tyrone is here what's up what's up man and T what's going on thanks for being here all right Doug you got some power you got some we're gonna start with PowerPoints we don't see a lot of PowerPoint on the Venus code live stream yeah cool so I'm just going to go through a couple of slides and then the rest of it's demo heavy um so first I want to just talk about you know this whole thing about AI that's really kind of what I'm talking about here today in different environments embracing the power right there's a lot of discussion about doomers and deniers of of AI and I'm looking at it as something that's uh something a skill I need to get involved with um Andre carpathy previously a director at AI Tesla and he's back at open AI he says the hottest new programming language is English so we're going to look I'm not going to go deep into prompt and prompt engineering today but you'll see I'll use a bunch of prompts and it's all about how you talk to them the model and so-called programming and I like this this next statement AI will not replace you but a person who knows AI will because they're going to be able to get super powers from using this yeah um so one of the interesting things about chat TPT they went to 100 million users in two months and this is just a chart to show things like Tick Tock Instagram Google translate how it look took 9 to 78 months to get to that amount of uh users so it's a it's caught the world on fire in certain ways yeah fastest growing app in history there you go so and that says a lot about a lot of things we won't go deeper on that so the big thing is warnings I don't know how many people know that uh robot on the side there that comes back in my time Amazon lost uh Lost in Space Lost in Space yeah Didn't They reboot that didn't they make a Netflix made a series on that or something they rebooted it multiple times even into certain types of movies yep and always loved that Rob that robot and danger Will Robinson and that's the theme about GPT don't trust anything that comes out of GPT don't push code into production right away you are responsible for ensuring the quality and reliability of your code at the end of the day AI is a tool so you need to check your automation bias you know that's the tendency for humans to favor suggestions from Autumn automated decision making systems people look at and go hey this looks good they Chuck it into their code and off they go uh don't do that and the Sun so this interesting doug because I found that you know one of the complaints about this about AI generated code is that like well you don't know if it's accurate or not and this is why folks you still need to be very versed right in your area of of study because the same is true for me when I'm if I know the code well if I know the language well then as it's generating I can quickly move through the suggestions checking them as it goes but if I don't know it well like I was doing python yesterday it's very slow it's hard to know if it's going to work got you can't you got to be an expert you can't you can't just let the AI be the expert that that's a great Point absolutely correct I can have it generate code in languages that I know and I can spot issues and then I can have the conversation with GPT to correct them and to tweak it um but yeah somebody who doesn't know the language are just gonna get code try it out it's never going to work and you get into a really unfortunate cycle so yeah why use it if you can't trust it because it makes you so much faster if you know what you're doing but it's not going to do your job for you exactly totally agree and kind of to sum all that up this is not my line but chat GPT is like a box of chocolates you never know what you're gonna get so you got to stay on your toes uh test your code and this is just not a not about code although I think I'll be showing mostly code scenarios today um but this can help you write your markdown files your documentation um so on and so forth even find your favorite restaurants so the agenda today um we're going to take a look at polyglot interactive notebooks and chat GPT then I'm going to take a look at chatgpt at your fingertips without leaving the console and using your automation scripts I've written a Powershell AI module that integrates chat CPT to Powershell and then sum it all up with uh we'll finish with a dime tour of GitHub co-pilot and vs code wow man we're testing like every hot area here's a Powershell notebooks vs code AI chat GPT like what other buzzwords oh man that's a great question throw in everything possible all right so let's first talk about is that big enough or yeah I think that's good okay so I'm going to talk about this is a ipy NV file this is and I'm in the visual studio code and I have the polyglot extension installed um and polyglot interactive notebooks Formerly Known as.net interactive notebooks so if you've ever worked with or heard of things like Jupiter notebooks this is what that is um so I can do and what's cool about it is I'm going to be showing Powershell because they have a kernel for power cell usage I'll click on that but you can do you can write these cells do interactive work with C sharp F sharp HTML JavaScript kql mermaid SQL Etc so it's a very versatile piece of work and environment and what's interesting is for example this is one type of cell this is a programming cell and I'm actually typing Powershell I've typed Powershell in it and then I can hit the Run button and there's shortcut keys which I'll use to actually execute that you can think about this as being at the console for example or in a script where you're typing this pressing enter or pressing the Run button what else is cool about it though is up here I have a I have some images so if I double click this it actually is a markdown cell and I can put any kind of markdown in here that I want and then when I click it and render it it's like having a markdown file preview in Visual Studio code I tend to look at notebooks as executable documentation so you can actually sit here and you can create all kinds of like you know run this cell you should expect XYZ you can then do this this and this people use this for incident response um as an example and as many others and as you'll see as I kick this off open AI plus Powershell I'm going to load up for example this um I'm going to dot Source this PS1 file s me how long it took I had no output but other ones other cells down below will show output uh and what's interesting what are you doing there are you just running that file executing that file uh yeah that's uh that's like that's dot it's called dot sourcing so I'm loading up that Powershell file into memory so I can use it in the other cells because the business is will actually use whatever I execute it will be available to the next cell so that was a good question also if you want to grab my module and play along uh you can do an install hyphen module hyphen name Powershell AI one word and you can do what I'm doing here and what's in that file you're sourcing yeah good question is that like your key and all that stuff for opening um yep so I'm pulling in my key which uh I should on uh when you download it'll show you how to do it do a bunch of params um and then I have a bunch of helper functions that actually integrate Powershell not only with open AI but it also integrates with the uh Visual Studio code notebook as well so I can do certain kinds of operations wow your code looks so clean Doug I feel ashamed years and years of practice I've been doing Powershell for 14 years I think I don't want to admit that um so what I'm going to do is there's I have a function called get gpt3 completion it's also Alias to GPT and what's cool about it I like which is why I built it is I can then extend it by wrapping that function inside another function and what I'm going to do inside this function is I'm going to since I'm working with prompts I'm just going to create a bunch and prompts to just text right the sort of English text I'm going to wrap I'm going to pass in some stuff to this function and then I'm going to wrap it in additional text to describe a prompt that I want to pass to gbt in this case I'm just going to ask it to translate from whatever I'm going to pass it in I want to translate let's say I want to translate from Powershell or from python to Powershell or whatnot GPT is amazing at translating not only programming languages but even the spoken the spoken language and we'll show a couple of examples so that's what I'm doing here I'm just wrapping the GPT piece further to make life easy so let's try and play with that so for example I have a piece of code here in uh in some text dollar code that's a hear string and Powershell and there's a thing called print hello world that happens to be Python and let's say I didn't know how to work with python I didn't but I wanted to convert that from python uh we're gonna have a good day the demo Gods it has happened but I think I yes because I didn't run my next cell which has that function let's try it again awesome so we can see how long it takes there we go three seconds um and it actually converted the hello world example of python into into Powershell can you convert it to um Cobalt yeah that's true that's a great question let's do it right python to Cobalt I don't know what is it what do you think of all is I bet it's like just display I was gonna say prints in all caps but display good point and then that's just a display and that clearly you know wow I have knowledge of cobalt but there's a whole bunch of um scaffolding you need for to run a call ball program but that's kind of so this is kind of like to start to plant some seeds what you can do with this not just with my tool but you can do this with chat GPT web or you can do it with co-pilot you can start typing in these types of sentences and then you can wrap you can say hey translate this from you know rust into go and then you can give it a snippet of code and you're Off to the Races and again keep your eye on what it gives you because you never know but what else you can do with it so the same set of code I'm going to do is same call to convert I'm going to convert this Carl command into a Powershell command um and I'm kind of I'm giving it I'm steering the model by starting out with you are an expert at Powershell people go why don't why would you ever want to say that well you can help guide GPT in the conversation by doing some of this kind of work up front let's run this see if I can convert it so what model are you using GPT or DaVinci uh I'm using under the covers I'm using um I believe it's da Vinci and I can look at the code so it's a completions model exactly exactly and on all of the stuff I have a hyphen model parameter so you can choose the models you want and you can build your own chat Bots with this and so on so yeah this one is particularly DaVinci so it's instruction based um so I'm telling it what to do and for those who know Powershell you can uh give me a fact check this is actually taking that curl command converting it to a method post it pulls out the post pulls out the URI content types and it even grabs it so I'm ready to go if I wanted to do this into JavaScript right I can say curl and I can just change this to JavaScript I won't show that but that's kind of where this is the unfortunate somebody asked for Fortran can you even do this unfortunate oh and I uh the curl yeah yeah I have no idea God I know Fortran too formula translation let's see what it does I have no idea it may never come back let's see it just goes to lunch oh no it did girl The Fortress I have no idea if that's correct it looks correct the double colons yeah that looks good to me um and also I have on here a Max tokens I think I'm setting it initially at 256 so if this is not a long enough Fortran module you can bump that up to 1024 or whatever the maximum token size for the model that you're using so fortranet Works awesome that's why uh GPT gives you super powers what's also cool about gbt is it goes the other way you can actually give it a piece of code and you can go hey I don't know what this does um so I'll run that I can give it a piece of code and ask it to explain it and it says this is a Powershell function called greet takes a single parameter of type string so you can see that I've actually typed the dollar name so it takes that and the function simply prints out the string hello followed by the string parameter that was passed in this works with any language so again I can actually walk and we'll see some of this stuff in the copilot well I'm not going to show this in copilot I apologize but to give a little hint the new stuff co uh the GitHub co-pilot chat is next level that's all the co-pilot X stuff and uh they make they do some really amazing things that you can make this uh very easy to work with so you can explain code you can you can translate code let's see what else we can do how many people like SQL I'm not a fan not a fan it's fun when it works exactly and every time I look at my sequel look I look at it and I go that looks like it's going to work and then I run it and it's never the case inner join outer join left outer Join one of those is Right figuring out which one exactly so let's I'm going to go to gbt in this case I'm going to say so here's my string right dollar p is going to take this whole string and for SQL create a customer table um with the following columns so I took take the columns and pass it off to GPT and this is tough to do this on a Thursday morning chat GPT looks a little slow today and there we have it so we took that and created uh what I looks to me it looks to me like it's correct SQL to create the table it figured out from ID said oh looks like you want to do an integer and we're going to make that a primary key it even corrects the first name and last name by putting underscores in it and off it goes so uh yeah it can help there English to regex super nice because that's the kind of thing where even when you know SQL getting the syntax right is such a pain it would be just much easier to say hey create a table that's got these fields in it I mean this natural language that was the statement from from Andre right the English is a new programming language yeah English is the hottest new program and and you're absolutely correct like you could be an expert I could be an expert in Powershell I don't have the entire language memorized I don't know all the different things that are integrated chat GPT does right up until 2021 um and then there's new features coming out for chat GPT so you can bring that so now I can actually sit there and uh let it figure out things and I can eyeball it and go okay that looks pretty good and I don't have to memorize it and I'm much it gets me it may be wrong but it gets me 80 90 sometimes 100 if I only have to figure out 20 of what I'm doing already I'm more productive so everybody likes to talk about regex so Let's uh write a regex matching a URL that's a minimal effort prompt pass that off to GPT and that's what it comes back with I'll let other people fact check that so there's uh again planting seeds about what can you do with with GPT um just curious uh yeah so um one of the challenges is that it confidently gives completely wrong answers what's your take Doug how do you deal with that wow well it's like talking to a human being right I know that I've explained things to to teammates or colleagues and friends and I'll talk about technology and people come back and they think I think I'm explaining it correct they think they're hearing it correctly and they'll give a great answer and go hey this is this and this and this and then it's not until you get into the devil's into details I look at um as being a drunk co-pilot you know it's I have to assume that it's going to be wrong and um I cannot have that automation bias I have to constantly be aware of that otherwise I'm going to copy paste and do something but I will take something like this and I will then put it into a a unit test and I'll throw a bunch and I can even ask it to actually create a unit test for me and I can ask it to create examples to throw at it so I can get pretty con I can't just go hey write a regex matching this and then I'm off to the races I got to do some more work so the thing Doug that's interesting though is that like when you're talking to a human being human beings unless you're talking to a pathological liar they will they should say I don't know or I don't remember or something like that right whereas the difference with AI is that it just fabricates what it doesn't know instead of saying I don't know it just makes something up and it states it with so much confidence do you have no idea whether or not it's true right you can't even tell it's not even like well I think or it's possible that's a great point but I I don't I haven't met a ton of people that I've talked to that like to say they don't know everybody likes to have an answer and feel like they know they like this is the way it should be um and I can say that using GPT I have certain modules that I work in that I have in Powershell that I have up on the gallery and it's on GitHub and they've been around for a bunch of years and they're fairly you know people like them and I've actually asked questions about my module saying how would I use it to do X Y and Z it will fabricate it will hallucinate is the terminology it will hallucinate function names that I don't even have yeah and the weird part is I look at it and I go that's a better name than I have so it's improved exactly and it improves it like wow that's a better readability right there so again it comes back to the box of chocolates you never know what you're gonna get so all you need you need to be on you can't assume but then again I mean I've I've been in meetings I've been on scrums and whatnot and people are very confident about how certain things operate and they turn out not to be correct yeah that's true humans overestimate their own knowledge of something what is that the dunning-kruger where you and actually it's the other way right the less you know the more confident you are and the more you know the less confident you are which is a hundred percent true the more I learn about something the more I'm like I think this is the answer I'm not 100 on this there's probably edge cases and and at the end and that's 100 I agree with that and at the end of the day AI GPT has been trained on human language so it's picked up you know how else is it going to sound yeah except confident about everything since it's learned from Human writing all right yeah so just to take it out of the realm of programming uh we can even do stuff like uh list 10 science fiction books um command GPT you slowing me down I don't think I'm going to make the 45 minute Mark but that's okay so here's a way that you can say list the right so lists out 10 science fiction books for me what's what's interesting here is I've been playing with this since last November and even earlier so they used to have to do stop conditions and those but as models have gotten uh better and better trained less of that is needed so that's another interesting approach we won't go through deductive reading we'll play with Excel for example so here I am I'm going to say if a cell A1 is less than 10 show yes if not sure no now how does it know I'm talking about Excel I don't know Third Base but that's an old joke so it's just it deduced that from the that's pretty interesting that's that's amazing now that is correct now I'm going to go the other way and say well take that formula and explain it for me right and the formula checks for a value in cell one it returns yes if the value is less than 10 and know if the value is greater than or equal to 10. wow now when people send me questions for fun and just to play with the models I will take their questions and pump them into GPT just to see the answers and it's usually a better formulated answer than I can do I will be will do because I'm kind of lazy right I'm not going to spell out every little piece so this is amazing that I can go from here's my question there's a solution I don't even know how I figured out Excel as I said before and then I can take something that somebody gives me an example of code and I can drop it in and see if that all begins to make sense and have a certain kind of conversation with people or myself or whatever this one I like so this is pay attention to this one so I'm going to ask it to list the top five vegetables and terms whatever that means it's a markdown table okay but I'm gonna yeah exactly so now if I wanted to convert this into a markdown table I'd have to write a bunch of code I'm just going to ask GPT to do that and then I'm going to show you some more capabilities inside of um The Notebook so there you have it it gives me a piece of markdown and what's really cool is I can copy paste this make a markdown cell and I'll put that in and now I've got a rendered table now I use this technique a lot inside of copilot which I'm not going to demo today but I'll talk about a bunch of stuff and I'll say dude as a markdown table let co-pilot generate it and I'm in my markdown file so it's already ready it's already there and it's rendered so uh that's super human right so and I could even ask it about the code base I'm working in because copilot knows what tabs I have open and it can it uses that as a context wow that's a great use for copilot I think I may steal that for some content Doug like because markdown tables are just a nightmare to work with I mean markdown itself is so elegant and then markdown tables is like the worst possible user experience I don't understand exactly all right 100 and when I and I've stumbled across these things and other people have and uh yeah once you start there's like well I would never go back and people go well would you pay for this tool and I'm like I don't live with about it um you once you once you get into using it and you find all the use cases you're like oh gosh how do we even get by before this is like you know this is back when we used to see um you know when Snippets came out or Auto completion started coming up we're like oh my goodness this is I can actually look at all the enums on a on a function and on a parameter I don't have to look them up overflow I remember when stack Overflow was popular I was like oh my gosh I don't have to search like dozens of forums anymore the answer is just right there oh my gosh and GPT is the next level and it actually consumes a stack Overflow and on that point like I rarely go to Google and I rarely go to stack Overflow there might be some esoteric or Fringe cases that I need to it's all here but will GPT tell you that your question is stupid like stack Overflow well you know that's a really excellent question that is really excellent in the end we love you stack Overflow but I have been accused of asking stupid questions let's stack over foot before absolutely and I'm almost suspect of GPT because I I will tell it like I'll say hey I'm trying to come up with an article on blah blah blah and almost every time GPT comes back and goes that's a great idea let me help you figure that out yeah what are you doing that's stupid I'm not doing this with you exactly I need some negative feedback so let's play around with Dolly so dolly is tech text image what we saw before here is it's text code text markdown um so on and so forth so I've also they have an API so I wrap that in Powershell of course and I make it so you can actually display it inside of um the notebooks which is Dolly open AI yes it is okay so Dolly's all part of that that's Google for some reason uh no they have their own but open AI is uh has Dolly and um yeah so now when I said Cat in the Hat it didn't go out and find a picture of a Cat in the Hat it composed it now what's really cool is just to show the way um prompt engineering works so I want a bird in a top hat with a cane I want to use the Unreal Engine I want a marble sculpture and I want it to look like as if M.C Asher wrote did it so that's what it comes up with so yeah that's like how do you get that where do you find that information how do I debug that how do I know to even specify that stuff well that's what prompt engineering is all about that's why things are changing this is not about programming dollar a equals one dollar b equals two and then printing out a dollar a plus dollar B it's a little different it's it's the next level um and this is just again to plant some seeds and so Doug the the biggest applicability I can see for things like Dolly to Engineers if like myself is like creating things logos and things that I can't do because I'm not a very good designer right and this is one of the places where I feel like Dolly just falls down is if I need like just create me like a simple logo for a website about shoes right and it can't do that and I don't know what are your thoughts on that I totally agree and it's ever evolving and this is also using the um not the latest version of Dolly they haven't pushed it out to the the apis yet and I totally agree and in fact if you ask it to do humans often you'll see humans without and if it includes hands it can't do all the fingers it'll add one it'll take one away and you get into really unusual spaces but stable diffusion and mid-journey have taken that to the next level and yeah mid journey is quite good at this yes so um and Dolly's up and coming in that whole space and you can wrap the mid-journey pieces as well so yeah it's a it's an evolving space and right now you can do some cool stuff that looks like fun um I'll often do this kind of stuff and generate images for my blog posts so just for fun but yeah I I've seen people try to do this for marketing material and they have a kind of a rough time getting it to work yeah somebody had posted I posted it to Twitter with this image of AI accepting taking your job right it's a bunch of handshakes and the hands have like 20 fingers on them because AI is just so bad with some things like hands eyes is another one that it can't get right for some reason it's really funny it's interesting that they've trained this and they you know training something like Dolly takes months and months and months and then it has the reinforcement uh capabilities with human feedback and it still has an issue so it kind of shows us where we are with the AI space but going back to that original chart that chat gbt had 100 million users in two months we've had gpt3 and GPT three five and four within the last three months uh gtp5s on the horizon this space is moving ridiculously fast so we'll see where it goes have you all seen Chad have y'all seen the uh the beer commercial that was AI generated have y'all seen that oh have you seen it done yeah yeah yeah very cool stuff yeah I wish I had a link to it it's hilarious uh but anyway let's keep it that's a good point too because Nvidia and all these other companies in Adobe are going in really hard on AI and even Nvidia has like text to 3D text to animation uh and they're starting to look I think Hollywood is actually doing all kinds of stuff with AI for the next set of movies so we notice the space is going to just rapidly improve all right so let's uh let me see because we're already at 11 30. um but I do have something called an MB co-pilot that I wrote and again it integrates GPT and it integrates um notebooks and let's just do a really so here I'm going to say MB co-pilot write a Powershell core function adjust the function no explanation do not show how to use it that will show with date and time so that's pretty easy so not only does it generate it and it finished but it also then inserts it into the notebook itself oh nice I can actually run it and if I actually call it I could say get time actually see if I can see if it works so now here's another way that I use it like hey I don't know how to get take time obviously is a simple example but as I get more complex I can actually have it inject right inside my notebook and be ready to run and test it let's see if we can do I'm going to take uh let's do kql so you can actually ask it to give me a sample kql query so that's stuff that we use on Azure for example to look at app Insight logs and do all kinds of good stuff yeah what is that what do they call it custom query language exactly um and there's some Cousteau and it actually gives me explanations and whatnot and I can sit here tweak it copy paste it and make sure it works so there's all and again right so this is kql so this is a kernel that exists this kql exists and works inside of the notebook so I can actually generate kql and run it and be ready to go and I can show the same examples to do JavaScript mermaid and so on so that's that's one third of my demo with 33 of the way there so I don't know if we're gonna make it so let me just show you one a couple more things that I think are cool about um let's go to I'm gonna use something called so inside of um notebooks they also have uh they have a plotting tool but I decided I was going to try and integrate my own uh something called Scott plot um and it's the similar Concepts just different kind of graphics and I like it because I can then use that outside of the notebook and I can use it in my Powershell scripts Etc so again I have my helper file and I run that and here I can actually say well create three different plots I want to create a bubble plot scatter plot and a bar plot once again my show Scott uh plot in Notebook helps me so I can actually when I generate the uh the image I can actually display it inside of um here and Scott plot's kind of nice it's got tons of different it's got signal charts right so you can do all kinds of cool stuff I think that actually does a lot like matplotlib looks very eggs exactly so if you're familiar with matplot this is also again the reason I chose it was that I could um matplot lives in Python uh at the moment um uh polyglot notebooks doesn't support python it's it's coming and um so and I can also use this outside of the notebook environment to generate graphs and whatnot and the cool part was that just created one million random points and that's how quick it is so generate again that's a million points plotted and that was all using well it was using Powershell but it was using the Scott plot c-sharp dll and the examples go on and on and on which is really cool and the one yeah do some do some more oh okay uh let's play with a histogram there we go let's and I can clear the outputs right so that's what's called I can clear the outputs rerun it if I can make tweaks to the code um in addition when I save this I can actually give the ipymb file I can put it up as a gist I could put it in my GitHub or I can email it to a co-worker a friend or family and when they open it they'll see all the stuff generated ready to go yeah right so somebody had asked that they're like where can you play with these notebooks online so yeah you can publish them is just right but they will display it statically right so basically render if you actually want to play with it code spaces would be the the way to go right you got it code space is the exactly it's all supported in code spaces um yeah code spaces is free for everyone y'all I think you get like 30 hours or something every month which is a lot uh so yeah if you're not using it use it it's free it's there it's free absolutely worth it when you go to github.dev um and you get the visual studio editor when you you can take a repo you can hit the dot on your keyboard it opens up that repo in Visual Studio Dev that uses um containers and whatnot and then that's I think is underlying all the code space stuff as well um yeah so if you don't want to install all this stuff um off you go to the code spaces and you're good to go yeah that's exactly right all right um all right you want to go to the command line let's see the command line let's do it all right so let me know I got six minutes I'm out uh it's all right if we go a little over okay um so now let's bring up some Powershell nope that's not what I want okay so here we have some Powershell interface and I'm gonna do a get module so that's the module I have I have it installed locally um I'm already up to 0.7 I'm not a full release yet but it's uh very stable a bunch of contributors um highly recommend using it so first up I have something called a enable AI shortcut key so that allows me to do shortcut keys and to get certain kinds of activity or output so what I'm going to do is I'm going to make a comment and I'm going to say what is my IP address I'm gonna hit Ctrl shift G that's actually communicating with GPT and I have this a little tuned for knowing its Powershell and uh uh so in there I have something like you're a Powershell expert and then I append the what is my IP address to that prompt and um it tells me here's how you get your IP address so now so by doing the control shift G on a comment I get a response and then I'm ready to execute it straight away in console we can do another example Let's uh list all the markdown files oops Ctrl shift G and that is correct um get child item that's d-i-r or LS and it knows markdown files start end with a MD kind of amazing uh I won't run that so let's see what else it can do so I have a if you don't want to use the shortcut keys or you want a little more control I can use the GPT function and I can say for example translate hello to Spanish French and Korean and there you go and I can go beyond hello I can say hello world I can add my name whole bunch of different things oh actually my next example well it's really nice you can interface the GPT right from the terminal yup never have to leave and the cool part is is since I'm in a shell so there we go hello my name is Doug and I translated to three languages and if I wanted to I can actually say clip right and then it'll do its and it actually then puts it on the clipboard for me and it's all going to be wrong but let's do it this way so it's better we can see it better I put that all up on the clipboard so I can actually interact with the command line put things on a clipboard save it to a file on and on and on so I don't have to sit and chat TPT web I can do everything right here in my console now back to SQL because I love SQL but if I wanted to do SQL to calculate total sales by month let's see what it tells me now this is great like if I'm stuck and I want to brainstorm this is a somehow I start initially when I start asking questions um and GPD comes back and says well you can do this now if I wanted to say what if I wanted to get the total number of sign ups oops let's get the copy paste right total number of sign ups in the last 30 days yeah sequel's easy um so I can start brainstorming with it around a whole bunch of different things and again we're not limited to translating languages or using SQL I can ask kql questions remember GPT is the culmination of the Corpus of text in the planet and I can probably I'm not going to try it now but I wonder if I said use that do that SQL but house Shakespeare would say it might actually come out with something now I have another function called AI so it's the same thing it wraps GPT um and I'll show you what the difference is so I'm going to ask here a list of planets only names is Json now that looks good right that looks like yeah uh now let's go kick it up a notch I'm going to do the same thing now here's the how is this different from the GPT function uh that's what I'm just about to show you good question here we go so now oops let's try it again so now I'm going to do the same so notice on the left hand side I'm saying give me a list of planets so we know it's going to go due to Json but then I'm going to pipe that output from from uh GPT or from chat gbt and I'm going to pipe it into another and say now convert it to XML so I'm going to make true round trips here you'll see thinking recycle back to zero here we go that's the second call so now I'm asking it to get it in for Jason for whatever reason and then I can pipe it back into Ai and I can convert it to XML now so you may want yeah that's that looks like Lang chain to me or like semantic kernel right like it's like an agent but except for you're giving it the steps to take instead of it figuring out itself so it's really great talking to you Burke I love it um oh and I didn't do it with the stuff correctly so this is the box of chocolates but you're exactly correct Lang Chang um and auto gtpt that's this is in that direction but that Lang Chang is far more um involved and I'll be uh producing some more pieces on that but that is the general direction of thinking that is correct so the language stuff's super interesting I was I've been messing with it chat yesterday trying to figure it out and so my wife owns a small business and it's very small she doesn't make a lot but she has orders that come in and I took that CSV file and I was using Lang chain to see if I could just ask questions right like what were sales from 2023 or what month had the most orders right and last and so I was doing that just in the morning last night I got an email from openai saying hey you've hit your warning API limit of five dollars and I'm like how many times is Lane chain calling the open AI API I think it's a bunch because when you ask an open-ended question it's basically just going in a circle right it has like a thought and it's like well I need to I need to convert this column to a date time and then I need to do this I need to do that so the thing that my thought last night was I was like this is untenably expensive well you got to pay to play but you're you're exactly you're exactly correct and so I pay 20 bucks a month for chat GPT web and in the in the gpt4 I can enable the browser and I can enable plugins access exactly so when I also have access to the SDK in building plugins which is a whole nother discussion when that's awesome but by doing by doing the GPT um browse with Bing I can ask it a question it will go out to the Bing search engine multiple multiple times in a single query so yes you can but it's not going to be as expensive if you think remember you pay per thousand tokens and a token is not a word right so about 750 words fit into a thousand tokens and depending on the model that you're using it's going to range between like a fraction of a penny for those thousand tokens and and then you have to pay for the tokens coming back so it is expensive um and I'm sure Lang chain is doing tons and tons of you know what did it come back with is it correct let's go out and ask these questions let's update the prompt and go do further investigation oh so it's a token size that's costing me money well that sounds like you got to utilize embedding yes but you can't in at least in my experience you can't embed a CSV right it's not text so you can't you could do like an Fai SS you know indexing on it but it then you then it ends up doing like weird answers where it's like I don't know you only gave me four rows I don't know what your answer is and that's because or maybe I'm wrong Sam tell me I'm wrong um you're on the right track and what's interesting is for example there's this thing called a LinkedIn reader in gpt4 in the web as a plug-in and basically you can tell I've been able I sit down and I can tell it read the CSV file from this GitHub repo and let's do analysis on it so that's coming that's that's kind of here you have to pay for it um and it's on its way but that's the general again the trending direction of what this is is doing and where it's going and that's why Lang chain is is really cool in that way but yeah um it could be expensive and the prices are coming in fact the recent release of the turbo uh 3.5 models I think they reduce the price yeah they did yeah it's less and that's what I was using with three five turbos so yeah because I think because it's sending that whole CSV file it must be trying to send that whole file over to open Ai and I just I don't know it seems like there's a better like I don't know how we do this right um that's a great question I mean so then the chat model so it has context and memory so to speak air quotes the the chat model is um you're basically sending the entire conversation up as it gets appended to every time so you can actually run out of um token space and yeah Lang chain what it does it also measures how much tokens you have sent and received how big it is already and then what model you're talking to and it will adjust the prompt based on it the token Max but yes you're paying for what goes up and what comes back but again you're on fractions of the dollar and uh I think anthropic just came out with a hundred thousand tokens you can send that's like five hours of reading material that any human can do so like if you're like Doug if you're a developer and you're saying because it seems to me like the first thing everybody's going to want to do is I want a chat GPT cool I want to do it on my own data set right I got a database with every order that we get every day for a legitimate business that's you know thousands of orders a day I want to be able to just give this to like our support customer support So when people call in customer support can just ask and get an answer back the problem is like how in the world do you get do you get chat GPT to go over that massive data set you can't send the whole thing so what do you do great question and um that kind of that kind of Harkens back to the Mainframe days right you can't you can't sort a million Social Security numbers because back in the day they didn't really have magnetic disk right you had to do it all on tape right so you have to do a concept called chunking right so initially maybe the one way you would approach it is you'd actually every night like we did back in the olap and all uh the olap days right where you would actually say oh I'm not going to update my multi-million rows I'm just going to update the changes from yesterday you might build a bunch of embeddings about the new data that came in right after you did the entire first Suite of all your data and then you say okay every night I'm going to add this stuff as embedding so when somebody comes over a question you'll search the embeddings to find the most relevant hits and then you would take just that subset of text from the the indexes into the database and you would send that up as the prompt so it's not for free it's not a silver bullet and for that kind of stuff that you're talking about that's the next level of what you got to do does that make sense so yeah definitely so daily push it's like you gotta the anonymized look daily push look you got to come on the live stream show me how to do this you up for that show everybody there's something up for it absolutely and these are great questions and this is exactly you know you know you look at all the hype around Ai and you go oh it's going to take my job uh not really and if you depending on contact size of your token limits yeah you have to start coming up with whole different models of how to make this stuff work so awesome all right well Doug we're uh a little over time I know you've got more I think we're gonna have to have you back to do more chat GPT stuff and I think it would be cool for us to do another stream maybe on like let's build a chat bot on your SQL data source so your CSV file if you're up for that maybe using Azure search possibly I think that's that would be the the way to go but I'm just guessing Okay and maybe we start with a small data set so we can get some cool results yeah I've got one I think my wife's data set has like 2 200 rows in it right like it's not very big and perfect so awesome well y'all uh check out Doug's but first of all buy Doug's book If You Don't Own Doug's book and and you use Powershell what are you doing what are you doing buy Doug's book um what else Doug uh definitely follow me on on Twitter d-f-i-n-k-e um I talk I'm on there all the time and I'll talk about this and I talk about the releases I do with different modules including the chat GPT and there's more to come so and then we can have I love to answer questions and interact so it'll be great awesome make sure you follow Doug we will have Doug back to do more AI GPD stuff that was this was amazing we have got to do this again this is great thank you so much thank you chat hey if you want to come back here in two hours one hour one hour we're gonna do our Blazer stream uh and try to make some more progress on our app today we will see you back there thanks Doug thanks Chad thank you bye everybody bye foreign [Music] [Applause]
Info
Channel: Visual Studio Code
Views: 4,957
Rating: undefined out of 5
Keywords: copilot, polyglot, code, vscode, powershell, microsoft, beginner
Id: U9S4BMqJPQ8
Channel Id: undefined
Length: 52min 26sec (3146 seconds)
Published: Thu Jun 22 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.