I Installed Chat GPT In Home Assistant And The Results Were Amazing!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's good everyone I'm really excited about today's video and as you're probably aware there's a lot of hype around chat jbt now everyone and their dog seems to be talking about it how to use chat gbt to make money use chat GPT to do schoolwork use track GPT to do work work chat GPT is changing the game there's a growing number of videos surrounding chat GPT and now it's time for your boy to make one too yeah all aboard this hype train because the next stop well there's no next stop the hype train has no brakes [Music] thank you for those of you unfamiliar with track GPT gpt3 and openai here's the way I think of it open AI is a company whose mission is to ensure that artificial intelligence benefits all Humanity sounds like some iRobot stuff if you ask me they created a powerful language model capable of generating text and code in a conversational sounding way and they call this model gpt3 now there are other models and iterations like it out there like for instance gpt4 but that one isn't really accessible to everyone just yet so I'm just going to talk about gpt3 now you can think of gpt3 like an engine capable of doing work and chat gbt like it's basically like a car that houses that engine which allows people to drive it and like you know experience it now together users can engage chat GPT to answer trivia soft problems and really excitingly get contextual information based off of given data so what make gpt3's features ideal for home assistant well to be brutally honest currently there's no need to use gpt3 and home assistant in my opinion I just wanted to see if I can do it that's all so this is why we're here home assistant is already very capable even if an integration or feature isn't available within home assistant with enough spit and elbow grease you could hack together some kind of solution but this doesn't mean that there's no room for gpt3 what I do find is that using this gives home assistant a more realistic human-y feel additionally gpt3 also allows you to cut down on business Logic for home assistant to arrive at an answer here's like a quick real world problem to explain what I mean so I have the akar button that activates a 30 second timer before setting the house alarm to away mode now if a window is open or something is open in the house during that 30 second period the system will complain that there's a problem but after the 30 seconds and to add insult to in injury right we're not in the house after 30 seconds we're in the car driving down the streets so we don't hear this error message however even without gpt3 the issue is still pretty easy to fix by grouping the sensors and updating the automation home assistant will say up front that there's a door or a window open before starting the timer but what if I wanted to add a little finesse to it to get a little bit more specific I need my automation to be so user friendly it'll take you to dinner and offer to pay please put away your wallet like it needs to be that friendly so to increase the user friendliness of my automation I need home assistant to say the actual names and areas of the that have the doors and windows open so my wife and I don't have to play where's Waldo and find these you know these locations now despite this additional caveat to the automation I can still get this done without GPT however it would take some non-trivial logic to filter through all the valid centers and then I would need to create some kind of fun to read out the names and some kind of conversational way or or hear me out now I could just let gpt3 do it how remember now together users can engage cat gbt to answer trivia solve problems and really excitingly get contextual information based off of given data GPT can answer novel questions if you give it data that it can reference and you can actually check this out on the website right now for yourself on the playground in openai website I gave the prompt a simple Json structure that listed entities and states and I asked it a question and surprise surprise it was able to use the data to answer it so what did I build using chatgpt or gpt3 before I continue if you like this content or find it entertaining I would really appreciate if you could subscribe and maybe like the video I have a goal of reaching 1 000 subscribers and at the time of making this I'm almost halfway there so I really appreciate you guys taking time to watch my stuff so even though I think that there's a lot to explore with gpt3 I wanted to minimize the gimmickiness and ensure that it improves my automations instead of complicating it and even if it complicates it it needs to provide enough value to justify that additional complexity well let's take my initial example where I use gpt3 to enhance my alarm automation since gpt3 is fantastic at interpreting data and giving a human-like response I don't need any additional logic to filter through the data and craft the message to announce any open door window this is a scenario where gpt3 simplifies my workflow and also gives it a personality with its conversational like responses none of the sensors are on this is the most ideal scenario however I didn't make an overly complex change to incorporate gpt3 in the hopes that it would benefit me more than it would annoy me and this over complication came through me completely overhauling my home assistant chatbot code to include gpt3 as a decision-making engine to solve problems let me go over this really quick just to give you an idea as to how gpt3 is incorporated into home assistant um this is my Ingress point for telegram within home assistant it's also the Ingress point for Siri or my web hooks into home system as well this is at home that webhook integration point I'm not going to go over that right now but this is the one from telegram so whenever I send a message from telegram this is what it hears and picks up and then it starts so just to give you a high level idea this used to be a lot simpler I'll see if I can find an image or I'll post an image of what it looked like in its simplest form sorry I thought I saved the image but I apparently didn't but it used to look as long as this this is as long as what it looked like um but now as you've seen it's gotten rather complex but for good reason um when we receive a message from home assistant we have a lot of cool things happening behind the scenes uh first it takes the data it normalizes it so wherever the text is coming from along with some other information uh it kind of puts it into an organized fashion in that it checks to see if there's an intent or if there's an intent that was saved within a system an intent simply meaning that the system was trying to do something if there was an intent then we have two different branches one branch basically says that if there's an intent to Simply start the flow from where it last went off if there's no intent then we're going to check to see if it's a command or a question this is using a combination of open API as well as NLP at this point we haven't done anything with open API yet we just simply are asking the NLP look at this question and then tell me if or look at this prompt and then tell me if it's a question or command if it uh and then from there we're gonna go and create a payload for open API and then we're going to send it to open API to interpret open API is going to basically tell us what the associated intent is or what the question ID is because certain questions within the system have specific IDs and certain intents have certain actions that's associated with it so this is going to receive let me actually click on it so this is going to receive uh uh an object where it's going to interpret and it's going to return back hey this is the intent or the ID that you want based off of what was said and then we'd go back and we refer to this question whether or not it was a question or command if it's a question then we know that we're going to basically uh use let me make sure yep so if it is a question we're going to check to see if there was any ID if if open API wasn't able to find an ID then basically we're going to just go through and ask open API again hey we weren't able to find an ID this is a question so here answer the question to the best of your ability and then it basically returns it back to the uh to telegram or the app that I'm using to type to it otherwise if there was an ID then we simply go and grab the information based off of that ID and then we send that information back to telegram otherwise if it wasn't a question and it was a command then we checked to see if there was no intent if there's no intent then we tell the assist or what do they call it now the conversation API or the conversation integration that home assistant has internally we simply ask that hey we have a command try to handle it and it basically responds back with whatever the response is from that otherwise if there is an intent then that means we have a special custom command that we want to run and we simply pipe it through we find any additional actions that comes with that intent and then we fire it off and we let our internal systems handle it rather complex it seems overly complex but what this actually enables us to do is to take in any question or command look at it basically determine whether or not if it's something that we can handle or can't handle if we can handle it then we simply route it to the appropriate sections that can if we can't handle it then we simply ask open API hey this is probably a question for you can you just give me some kind of answer back and as a result we're able to handle a multitude of situations okay so here's an example utilizing the system that I just mentioned here this is the telegram app which is where my home assistant chatbot is created we're going to basically ask it to change the volume of the master volume and we're going to tell it to change it to 0.5 when we send it off it's going to ask us a confirmation back and then we're going to say change to 0.5 and then notice how it changes that fast all of this is using the system that I just previously that I just previously showed by including gpt3 I was able to simplify the code in some respects where I no longer need training data but the overall logic did increase as you see here in complexity I can create a separate video for deep diving into how this works later and how you can set up your own home assistant chatbot okay so what are some areas for improving knowing the gpt3 model is capable of understanding code I got curious to see if it's able to run code okay so in this example I'm basically giving capture PT a class called ice cream shop where you can take in a single flavor I also have one method that's going to return a string that says yeah my favorite ice cream and then the flavor and then I'm just gonna instantiate this new class and then I'm going to call this method and it's supposed to say yum my favorite ice cream vanilla let's see what it says yes it is it's able to run code gpt3 is so impressive but is it useful on the surface it seems like gpt3 is like MSG sprinkle it on everything and it just makes it better but while working with it I realized that gpt3 excels at interpreting and summarizing data and even searching for answers but all of these are analytical tasks I found that gpt3 helps you to learn about your home automations and devices which is useful but what would be more useful is if it could actually affect change in contrast home assistant conversations integration or I think it's called like home assistant assist that's actually really good at making changes to your devices you can tell it to turn off the light and it will turn off the light but gpt3 doesn't have that kind of access to your system and and technically even if it could right even if let's say gpt3 could generate code that can dynamically execute on your home assistant platform then as useful as that would be would be an extreme security threat like you wouldn't want to do that technically I mean like if you're adventurous you could up to you and this is a small one but the last thing is that I personally wish it was free that's just me like at least at least as a Dev right like it's not expensive but it's still digging into my pockets and I don't like people digging in my pockets that's just me though I mean like maybe you like that have people rummaging around just keep your hands on my pockets but overall I'm impressed more and more people are incorporating gpt3 into everything they do so we'll see more creative uses and applications for this technology and technically it will only get better in the meantime I know I'm not the only one exploring these options so I would love to hear from you all and get your comments I ideas triumphs failures using gpt3 in the future I'm gonna give you a more detailed account about how my home assistant chatbot works and how I use gpt3 and NLP to enhance my user experience okay bye [Music] thank you
Info
Channel: Technithusiast
Views: 109,192
Rating: undefined out of 5
Keywords: montaque, chatgpt, home automation
Id: lXOtpL8iMgk
Channel Id: undefined
Length: 14min 27sec (867 seconds)
Published: Wed Apr 26 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.