A ChatGPT Voice Assistant You Can Talk To - Open Source: Vivy

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's going on today YouTube today I'm covering my Vivi Voice Assistant project here's a quick little demonstration of it hey there I'm listening today I had a long day at work and I'm pretty tired but I feel like I fulfilled a lot of things that's good to hear but I had an even longer day at work and managed to fulfill even more tasks plus I still have enough energy to hit the gym after this conversation oh fancy you say that because I also hit the gym pretty hard after this after work that's impressive but I actually hit the gym twice today once before work and once after I guess some people are just more motivated than others funny you say that because I just hit it three times maybe even four haha good one but seriously I think you might be exaggerating a bit I mean I'm all for staying active and healthy but there's a limit to what the human body can handle you don't want to overdo it and risk hurting yourself but I did the gym more than you did okay okay you win this round but let's not forget that there's more to life than just the gym I'm sure there are areas where I excel that you might not be as strong in it's all about finding balance and focusing on our own strengths and passions don't you agree quit and so that's just a quick example who do you think won that exchange but anyways I'm going to show how you can get it downloaded how you can work on it as a developer and then how you can just run it as an executable file if you just want to download and run the voice assistant so let's go ahead jump into it all right what we're going to go through first is the developing part of it so if you just want to run as an executable head on over to the end of the video that's where I'll show that but to do this to follow along here you're going to need to you're going to need python on your computer you're going to need git and then some type of IDE I recommend you do vs code and I'm going to link Down Below in the description on how you can get all of those however I want to use a different python version so we're gonna I'm gonna show you how you can do that today so first head on over to a blank browser and we're going to go ahead and type in Python links are going to be down below in the description and once we're here we're gonna head down down over to 3.10 so we can go to 3.10 let's go all the way down to this page and then click the windows installer 64 bit and then we're going to go ahead and open it so it's going to download and then we're going to open it and then I'll come back once that's done alrighty so it's open I've opened it up and we're going to go ahead and add python exe path click install now and then it's going to install on our computer all right 3.10 is finished go ahead just click disable path limit it doesn't really matter too much and then close it so that is going to be python I'm going to assume that you have git already downloaded and vs code from that previous video so we're gonna go ahead and jump into the repository so here we are in the repository this is my Vivi repository I have a description on how you can use it here if you just want to read it but we're going to go ahead and just do a git clone of it first so I'm assuming you have git installed in your computer so we're gonna go ahead go click code here click the copy button here and then what we're going to do is we're going to open up a file browser and find where we want to download it to so I'm gonna go to the desktop and create a new folder so go to new folder and we're going to going to call this we're just going to call this code so once we have that let's go ahead double click into it and then when you're in here we're going to go ahead and do shift right click and then it's going to open up a Powershell window here so Powershell is going to look like this here um don't worry it's just a command line interface nothing too crazy and once we're in here you're going to type exactly what I have here get clone and then since we copied the GitHub link we're going to go ahead and paste that in here and it's going to download alrighty so it's all finished here so we can go ahead and close out of the Powershell window and let's go ahead head on over into Vivi alright so since this part of the video is going to be for developers I'm going to show that first you can follow along if you don't know any python because I'm just going to show you how you can use the class and how you can set it up you just have to follow step by step on what I do with that aside we're going to go ahead and head over to the python script here we have a requirements text file and we're gonna go ahead and use this later on but it basically just has all of the um pip options that we need to install what we're going to head over to First is the assistance Tab and then we're gonna head into one of these scripts and that is going to be assistant P when you first open it up it's going to give you this window here if you haven't opened things up in Visual Studio I'm going to click Visual Studio code and then click always use this app to open py files python files and then click OK we have this here and this is perfect but um what I prefer to do is actually open up the entire folder inside of vs code so I'm going to show you how you can do that go over to open folder and then we're going to go over to the folder here so um if we just go to your desktop or wherever you put it go into the folder click the name of the repository and then select it it's going to open up in here in order to edit the code you'll have to trust the authors so trust the authors here and then we have access to everything in this left hand corner we got the assistance all of that you're in it read me build and so before we do anything we're going to set up a virtual environment and that is pretty easy to do in vs code so you're going to go ahead and click control shift p that's going to bring this up here you're going to type in Python and then you're gonna do create environment down here then you're going to click venv virtual environment and then you're going to click the 3.10 version of python for your interpreter as I was saying that requirements text file is important so we're going to install all of the requirements we need so go ahead and click requirements.txt click OK and then it's going to create the environment the important thing about virtual environments is it allows us to work on this project without affecting any other projects so if you use a another repository that I have on my GitHub it could interfere with it which is why we're going to do a virtual environment so we don't have packages clashing for different versions all right and so once we have the virtual environment done it's going to show down here that it's 3.10 and it's going to see dot VNV so you'll see that we have here that it is selected as our interpreter so just make sure that this is the option of 3.10 VNV and we're going to be on our way and you may be wondering how you can open it back up in the virtual environment if you close the project so we're just going to go I'm just going to show you that real quick so here I close out of the project in order to open it back up you just have to go back into that folder and select the folder that you're in and it'll Auto Select the virtual environment as you can see down here and in here we're going to go and click assistance and then we're gonna go back down to assistant P down here so so here is the entire script that allows the assistant to basically work so I'm gonna go through each part of these just to give a overview on what it is this beginning part right here is going to be your Imports for the packages that you need in order for the script to run so these two right here are locally defined inside a folder so these are packages that I just built um for the assistant to run and then you have some variable names that you can change here so folder name is going to be the folder name that the conversations get stored to so in this case it's going to be assistant P personality is going to be the name of the personality that you set and those are the prompts that you have inside of the prompts folder so if we go over to prompts here go over to Personnel go over to assistant P dot txt um we have a text for a personality that we want to set for the assistant so going back to assistance P that's your personality then for The Voice name this is actually going to be your 11 Labs voice so I'll show you how you can get that 11 Labs API key but basically this just sets up the voice this variable is to use 11 labs and this one is to use open ai's whisper this block right here is basically just checking to see whether or not it's an executable file or if it's a script file so this is important when you build the script out in order to make an executable file and this right here is just getting all of the path directories you need in order for chat GPT to work and then here we have a instantiation of the Chachi BT class where all of the magic happens for the chatting we pass it the personality directory we pass it a keys directory and then we pass it a voice name below it and then lastly the thing below it is going to be the method that we call from the chat bot class and that is going to be assistant p in this case and here's a description on what it does um I'm not going to read through the entire thing but basically we just pass it the folder name directory whether or not we want to use 11 labs and then whether or not we want to use whisper so so that is how I have the assistant.py set up so how do you get this set up if you just want to use it as a script let's go ahead and run through a test example for that right now so let's just go ahead open up a new text file and what I recommend doing is just going over to one of the pre-made scripts already and then copy and pasting the Imports so we're going to do that here so we're going to copy and paste the Imports and then we're going to go ahead and save it so we don't have these squiggly lines here so just go over to save as make sure you're in the assistance folder and we're going to call it test so it's now going to be called test.py and what we can know and then the other things we can do are copy the variable names here from the other script and copy it and paste it into here and then we can skip this building block as we don't actually need it if we're just running it as a script but what we are going to use from that script block is we're going to need our script directory so what we're going to do is create a variable called Script directories it is dir and we're going to do OS path OS dot path dot der name so we can get the path of this script so we're going to do os.path.absolute path and then we're going to do the name of the file so that is basically just going to return the path of the script and you know you can just copy and paste this from the assistant dot P if you want and then I'm going to now show you some other things that we'll need to get in here as well so we're gonna need three so we're gonna need a full name directory we're going to need a personality directory and then we're going to need a keys directory so you can see that all of those are inside of assistant P here we're using this but to set that up here uh we're going to use this um function that's inside of utils and it takes in a couple of things so it takes in a script directory folder name personality and then assist it and change we're not going to use system change though so to do that all we have to do is create some new variables so we'll do folder name underscore dir we'll do a personality directory and we'll do a keys we'll just leave it as keys and then what we're now going to do is use that function from the utils package and we're going to call get file paths and you can see that it has kind of like a description on like what you can feed it um and so we're just going to go ahead and name we're going to feed it the script directory you need to pass it the script directory first so that it knows where you are in relevance to the files and then let's go ahead and do our folder name and then we're gonna do in the personality so it's okay you don't have to fully understand what is happening here you just have to understand that this is how you get the file paths for the personalities that you need and the folder names that you need so once you have those we're going to instantiate a new a new a new object of the chat GPT class which handles everything so if we go over to the package um the magical tool that handles everything it is this chat gbt class right here and we need to instantiate it with these parameters so let's hop back on over to here and let's call this chat uh we'll just call a chat bot and so once you have it once you have a new variable called chatbot you're going to instantiate it to chat gbt class and then inside you're gonna need to feed it some variables so it tells you intelligently here it needs a personality a keys a voice name and then a device index so we're going to go ahead and set those right now so personality is going to be equals two personality directory so that's why we set this directory here do a comma New line and we're going to do a keys is going to be set equal to Keys that's what we have right here and then we're gonna do one more and we're gonna do folder oh sorry and then um that's not what we need we need voice name here so we're going to set voice name equals voice name so we're gonna do voice name and that voice name is what we have set up here which is REM in this case so that is going to be how you set up the object and then we're going to use that to use one of the methods inside of the chat gbt class so in order to do that we're just going to use the same namesake here and we're going to do chatbot Dot and then it gives me all of the options that I can do in here so because I know what I want to do I want to base it off of assistant P we're going to go ahead and use assistant p and then once again you can see all of the different parameters we can pass it so we're going to do a little bit of um a different instantiation we're not going to use three we're going to use all five of them just to show you how you can pass it different parameters or whatever parameters it needs okay so once again first one we need the save folder name so we have the folder name um right here and then it's going to be folder named dur so save fold the name equals folder name that there and you might be wondering how I'm able to just enter these things in well it automatically will pull up these names here and then I can just use the arrows to choose between them and then click enter to quickly enter that in so comma the next thing that we need is a keyword so keyword we're going to say hello so we're going to use hello instead of hey for this example and then the next thing that it needs is going to be use 11 Labs so this one is pretty simple you just do use 11 Labs equals use 11 Labs we use El the next one is use whisper and simple again just to use whisper equals use whisper and that's what I have up here so you just change the value of what's being passed as a parameter by changing the value up here so that's all that is happening here by me setting it equal to the variables I have here and the reason that I'm able to do this is because I have variables already set inside of the class for these names which is why those names are matching up and then there's one more and that is going to be time out equals a certain amount of time so let's say that we want to time out the conversation after 10 seconds we would put this to 10 and that would time it out and then once if you want to know what happens or what these variables are you know the arguments you can always read it by hovering over it with the intellisense or you can right click into it and then go to definition to see the definition inside of the class so that is how you can get it set up for um for a new python script and with some different parameters you could technically change this to anything so you could say this is voice voice assist and then you would just have to change this down here to voice assist as well so that can change to whatever you need it to be we're going to leave it at chatbot just to keep the same name safe and that is going to be that and so I know if you're a beginner in Python if you don't know anything about code a lot of that would have just gone over your head and so if you have any questions about it I would just recommend that you feed some things into tajubiti to figure out how python code works so you know to understand these you should have a little bit of a basis on how python coding works and you know chatty petite is a great tool to learn how you can do that and now we're just going to go ahead and run the script as we have it alright so here we have the script now it is all up in um it is all up and coded we've got all of the stuff we need set let's just go ahead and run this and see how this can work so we're going to go ahead and click run up here start debugging and then we're gonna go over to python file what we're gonna get here is an error because there are no keys set and so you may be wondering like what the heck happened we set up everything correctly um you're gonna need to set up an API key and get all of the API keys so that's what we're going to work on next so before we do that we're going to go ahead and go over to this left side here and go into Keys examples.txt um simply what we're going to do is click on it right click it and then we're going to rename it as keys.txt and then there are two keys we need to get um we need to get 11 laps key and a chat GPT key we don't need an 11 laps key if you're not using 11 Labs but you know if you have an 11 laps key you'll need to do that so we're gonna head on over to browser and let's head on over to 11 Labs first okay so we're in 11 Labs so I'm gonna go ahead and sign in real quick all right and here we are in 11 Labs I'm not going to show you how you can make voices or anything like that in this video I'm just going to show you how you can select it so in your settings here you're gonna have a first you go to the speech synthesis menu up here in your speech synthesis area you're going to have a bunch of voices you can choose and you're going to want to make sure um the name that you put inside of the script matches what you have here so um it's a capital in this case so if we go back on over to the script it should be Capital as well here so capital r in rem so you're gonna head on over to your account then you're gonna go ahead and click on profile and then you're gonna click on this API uh key right here now you're going to click on this eyeball I'm not going to click it so um but you guys click it and then you go ahead and right click and copy and then you're gonna go ahead and bring that on over into this keys.txt and then paste it so it's going to be something inside of here and you want to make sure it's within these two quotations so that's your 11 Labs key and let's head on over now to the open AI key and get that one as well so so you're gonna see this screen here once again everything is going to be in the description where you can just click the links for how to get to these pages and then we're going to go ahead and click log in alright so I'm all logged in here and what you're going to do is head on over to your account here you're gonna go ahead to view API keys and then you're going to go ahead and create an API key right here that you can use for the chat bot so you can just click create new API key you're going to copy this over to you're going to click the copy copy it over you're going to paste it inside of here for your GPT key I'm going to go ahead and delete that one which you can just do by clicking the trash can here in case it gets exposed and then that is going to be that you do need to do one more thing though and that is set up you know an account for billing as this does require access to their API but it is pretty cheap it is basically cost it basically costs a quarter of a cent in order to get 750 words so that is pretty cheap in my honest opinion um and you you'll probably use like a dollar per month if you're using the assistant continuously but that is how you get this set up and now that we've got our API Keys set up we're going to go ahead and run the script once again so go ahead and click run or F5 I just clicked F5 and you're gonna hear a beep and then you're gonna say something like hey or in this case we would say hello however since I am running this on a virtual computer it is not actually going to run so let me just go ahead and bring this over to my main PC to show you how it works all right so we're in the main PC over here a couple of things are going to happen I'm going to run it I'm gonna say hello it's gonna instantiate and then it's gonna say I'm listening and then that's when you can start talking so I'm gonna show how it'll it'll time out after a certain amount of time and I'm going to lower this to five just to make it quicker and then I'm gonna show how you can be instantiated so this is going to be a quick demonstration on the script that we just made from the um from the class that I have here so F5 to run it hello I'm listening could you give me a recipe for a quick sandwich sure what type of Sandwich are you in the mood for do you have in mind so as you can see there it just timed out hello I'm listening yeah let's use roast beef and white bread great for a roast beef sandwich ingredients and so I'm gonna go ahead and end it there but here are all of the ingredients that it has given to me and it will read all of that out loud um but as you saw there it it timed out and I had to re-instantiate it by saying hello it went back into the conversation so that is what this assistant here does so that's a quick way on how you can use the assistance P method to get a script up and running um I will go ahead and show you how you can make some modifications to the chat gbt class to make the microphone a little bit more sensitive and let's go ahead and jump into that right now so click on the chat GPT class right click and go to definition and it's going to bring us to the gbt assistant py so inside of here if you want to change the model that is being used for chat gbt you can change this right here inside of self.gpt model you can scroll down to here to set the energy threshold for the microphone I have it set as 1000 for me but you could set it the default is 300 but I found that was too sensitive so I set it to 1000 and then you can have a dynamic energy threshold um you can set this to true that basically just adjusts the energy threshold on the go I recommend you leave it at false and then you know once again I said there are all these other things down below that you can mess with if you want to get into more of the coding side of things and then one more thing you can if you want to use the 11 Labs voice just set it to true so with all of the code out of the way I'm going to show you how you can run it as just an executable file if you're just interested in running the script and not doing any coding so this is going to be no code how we can just run the scripts and how we can get that up and running so we're going to go ahead and download it so to do that we're going to go ahead and head back on over to my GitHub repository and we're going to go ahead and head on over to my releases so if you scroll down you can you can see this link right here you can click releases or you can go over to this tags option over here and click it so I just clicked on the tabs option or tags option right here and it's going to bring me to all of the releases that I've done and then I'm going to go ahead and click the 0.2.0 this is going to be my most recent one um and you're going to go ahead and download vivi.zip so just go ahead click it and then save it we're gonna go ahead and save it to the desktop and then once we have it saved we're going to go ahead and extract it so go ahead and click extract all and then we're gonna extract it already so here we are we have it open up here and inside of this folder we're going to go ahead and and inside of this folder we need to set up our API keys so inside of this keys out examples you have two options here your 11 Labs key and then your open AI key so to do that first we're going to change the name of the file so right click it click rename and we're going to call it keys once we're in here if you saw the earlier part of the tutorial you probably set up your API key already but I'm going to go ahead and just reset it so you want to go over to 11 labs and sign up for an account and then go over to your profile click on profile and then you have your API key here so you're going to go ahead and click this eyeball here to show the API key and then you're going to paste it into this option here make sure you leave the quotes so there should be quotes around it next you want to head on over to open AI links are links are all in the description and you're going to go ahead and log in create an account and then you're going to go to view API keys and then you're going to go ahead and create a new secret key that you can paste into there as well so you just copy and paste this into here and so whatever that API key is it's going to be set here and that is going to be your setup for that I'm just going to revoke the key and delete it so you guys can't use it and then if you're using this again you're going to need to set it up as a build account in order to use the API in order to use the API it's really cheap 750 words for a quarter of a cent so you don't have to worry about being charged too much if you're using that okay perfect so let's say you have your API Keys set up everything should be good and running so what we're going to do is we're going to run one of the scripts and when you first run a script you'll probably get something like this is uh you'll probably search for you can click yes or no here and it'll open up the window here so in order to use my microphone I had to head over to my main PC but let's click that same script here and we're going to get a first prompt that says are you using an 11 Labs voice we're going to say let's just go ahead and say Yes And this is assuming you have set an 11 Labs Voice key so we're going to say yes and then whatever name we have here we're going to use in this case I'm going to use me so you have to make sure it is capitalized if you're using 11 Labs capitalized correctly because it is case sensitive so I'm gonna go ahead and click that it's gonna initialize hey there I'm listening what is your name my name is open AI how can I assist you today and then we're going to go ahead and quit so there's a quick little demonstration that is actually the voice that I made for myself um and that is the command you just heard me say at the end quit will exit out of the um executable file and so if you say quit in any of your input it's going to exit out so I probably need to change the logic of that a little bit in case you guys want to quit out of it some other way but further than that for now if you have quit inside of uh whatever you say to it it's going to quit out of it so that is assistance p with voice and here's how it might look if you just want to run it without the 11 Labs key so so you may notice that it is slow to load up sometimes so if you just drag the right side of the screen it'll Boot It Up um and so we're just gonna click no here and then it's going to beep and then it's going to allow for me to say hey hey there I'm listening quit and we exited it out there okay cool so you have all of these executable files inside of the folder here um and so they'll run just as they are and as you can see here's a new folder called conversation so inside of here you have assistant P where you can take a look at the conversations and you know here are here's what it did so it set up the conversation here if you want to modify how it actually responds well you're gonna need to go into this prompts area right here and then change what the prompts are so whatever name of the executable file you have you can modify how it responds inside of the prompts here now you have to make sure that the name stay the same so in this case let's say we want to modify one up exe we're gonna go ahead go to prompts we're going to go ahead go into oneup.txt and then we would just modify what it says here currently it says immediately role play as someone who always has to be a little bit better than me I will say something and you will respond making yourself sound better than me so that is the one up txt instructions and it's it's kind of funny I like that one that one's kind of a troll bot and that is how you can modify it that's really all the modification that you need to do for those scripts and now I'm gonna go ahead and run through what each script actually does what each one does differently and why I have them separated so I'm just gonna do a quick Spike notes of all of these assistants the first one is chat basically you can just instantiate it and talk to it so you just say hey and then you're able to talk to it infinitely it'll just keep going so you know you have to quit out of it manually the interview one uh you can have you can set it up to interview you interview you in whatever topic you want to so you set up the prompt inside of prompts you give the interview bot the instructions and then it'll interview you this one starts off by asking you questions first instead of you instantiating it so it just jumps right into the interview the next one is assistant and there is assistant and there's assistant P assistant acts as kind of like the traditional smart assistant where you instantiate it with a word like a keyword like hey and then it'll run into the conversation part of it and then it'll stop after a certain amount of time of having not heard anything so five seconds or whatnot in this case assistant p is a little bit different than assistant because assistant P stands for assistant persistent so I guess that's a little bit of a tongue twister there but this one maintains and retains the information that you told it earlier so after this one stops listening it'll remember what you asked it before and you can build up upon that and what I mean is it it'll only remember what you asked it before in the same iteration or the same script so if you close out of the exe or the executable file it'll forget what had happened in previous conversations so this one is good if you want to just have it looped in like the background if you wanna um ask it questions and build upon those questions um whereas you know this one might be something that you just run in the background in case you want to ask it a one-off question kind of like how you do with Google you just ask it a quick question and it'll respond in that same fashion and so those are the four assistants slash methods that I have inside of Vivi and you know each one has a python file and executable file pertaining to it you may see that there are other names in here as well such as you have roleplay exe and then you also have one up exe so like I said those ones are um you know those ones are kind of just more fun ones um in this case one up uses one up uses assistant so it doesn't remember what had happened previously whereas roleplay uses chat so this one will just continue chatting with you so once again you can set those you can set how they respond to you by going over into your prompts folder and then selecting it and editing the text so okay so that is how you can get started with my Vivi project if you just want to get it up and running you can just run the exes or if you want to start doing some development on it some enhancement you can jump over into the GPT assistant python file and so that is what today's video is going to be if you have any feature requests if you have any issues please um open up a new issue or a feature request on GitHub you can do all of that with the issues tab I have a tutorial down you know if you want to know how you can open up GitHub issues in the description but that is going to be today's video so once again thank you guys today for watching I'll see you in a future video and uh good luck out there everybody and see you later
Info
Channel: Jarods Journey
Views: 15,420
Rating: undefined out of 5
Keywords:
Id: 0qpar5R1VA4
Channel Id: undefined
Length: 32min 53sec (1973 seconds)
Published: Sun Apr 09 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.