This is excellent stuff! Finally some tutorials that are bringing HA with NodeRED beyond the basic level. You've quickly become my favorite Home Assistant channel.. :) While I can see where you're going here, others may find my implementation useful (while waiting for your next video): The way I've set this up now is to differentiate between Home Assistant Assist (control) requests and GPT requests (as they cost money) by using a keyword (or a pre\postfix) in the Telegram message. That way I can consiously decide whether I want GPT or Assist to respond to the request, as not every request needs to be routed to GPT. This is a lot easier and more user-friendly than switching assistants in HA, and also quite easy to do in NodeRED..
@technithusiast Жыл бұрын
Thanks and I’m glad you enjoy! I think you’re really gonna like the next episode as it touches a bit on what u described here. I don’t think my implementations are perfect (I’m simply exploring possibilities) but like you realized, there is a need to be efficient with the call we make to OpenAI.
@ArkodeLeeuw Жыл бұрын
Excellent video, really well explained. Thank you very much. I haven't used Node-Red much but with this I'm willing to try.
@technithusiast Жыл бұрын
Glad you like the content!
@steampunkrobot Жыл бұрын
Excellent video. Thanks for taking the time to create a walkthrough in detail. Regarding triggering devices, the easiest option could be to just capture the response from telegram and pass it on to assist. I'm using a keyword before issuing the command, which then triggers a different branch in the code (using conversation/process); if not then it is treated as information and uses openai, like you demonstrated in your video.
@technithusiast Жыл бұрын
Thanks for feedback! There’s definitely room for improvement since part of my focus was introducing node-red concepts and paradigms.
@steampunkrobot Жыл бұрын
@@technithusiast love the content, and the way you present it, making is super easy to understand and replicate. Really appreciate it. Look forward to more such videos in the future.
@marcelrose6042 Жыл бұрын
Great tutorial! I can't wait to see the next episode! Are you able to ask follow-up questions or make conversation with the bot? Mine seems to create a new conversation each time.
@technithusiast Жыл бұрын
Great question! So currently GPT3 doesn’t do followup questions. There are some “hacks” you can do to fake it but I’m hoping with GPT4 this would come out of the box
@Albert-kb1sh Жыл бұрын
man what you did is awesome … I really like your approach to teach things that go over what most of people do with HA, simply awesome!
@technithusiast Жыл бұрын
Thanks I really appreciate the encouragement!
@MrCyberplanete Жыл бұрын
A comment From France.... Great job .. I always wanted to that but could figure it out !! Great job !!
@technithusiast Жыл бұрын
Thanks, Glad you enjoyed!
@蘇家宏-m7b Жыл бұрын
thanks for ypur tutorial it is very useful but l have a question is why my funtion get a error is TypeError: Configuration is not a constructor please tell me thanks u very much
@technithusiast Жыл бұрын
The code in chaperone may be outdated as OpenAI is in active development and can deprecate their APIs. I updated chaperone so try again but for you will have to keep the APIs updated yourself from there.
@蘇家宏-m7b Жыл бұрын
@@technithusiast thanks for your reply I get new chaperone but I have a question is why it say "No credentials provided" I try to change const name but it still not solve
@zephirusvideos Жыл бұрын
@@蘇家宏-m7b Same error
@inzemix73 Жыл бұрын
Following you since your first video about chatGPT and HA, and your content is so great, you way to talk is nice, and your ability to share things which are not easy for me (I’m a nurse, coding is not my thing, but I like to learn new things) is amazing ! I hope you’ll get a lot more subscribers soon ! Thanks you ! (I’m French, I understand English fluently, but I’m not super easy typing it, so excuse my errors)
@technithusiast Жыл бұрын
Thank you so much! I really appreciate your comment and I’m really happy you’re enjoying the content!
@poshsims4016 Жыл бұрын
YASSS we love to see a brother into AI & tech!!!🥹
@technithusiast Жыл бұрын
✌🏾
@denis23818 ай бұрын
Nwords
@MAMDAVEM Жыл бұрын
Great video, now to take it to the next level you need to use the speech to text and text to speech capabilities of HA to make it possible to interact with the chatbot using voice.
@technithusiast Жыл бұрын
I definitely plan to get incorporate speech to text at some point but there are a few more things we need to do to make the chatbot useful. In the next episode I have some interesting stuff planned 😬
@gielkonink Жыл бұрын
Awesome video, and thanks a lot for explaining. Please, next time, let me know if I can copy the code from the website before typing everything out. I prefer being lazy over being tired. 😊
@technithusiast Жыл бұрын
Ahhh fair point :)
@dping2856 Жыл бұрын
I have really enjoyed this set of videos and seeing whats possible.. I manually followed for Step 1 of your Chaperone and it worked. I imported from the Chaperone Step 2 but it's not working for me. I get everything up through the Template Answer questions node but nothing shows in debug after OpenAPI. It also kills my Node-Red addon and have to restart it after a few messages/deploys. I am not sure what I am doing wrong. I did put my OpenAI API key in that node.
@technithusiast Жыл бұрын
I’m glad you’re enjoying the videos! I’ll take a look at the node red flows. I believe the API for OpenAI has changed which is why it may not work.
@the_smart_home_maker Жыл бұрын
Love this one 👍🏻
@technithusiast Жыл бұрын
Much appreciated!
@czi2011 Жыл бұрын
I did not count how often I was watching ep.1 and ep.2 to find what is going wrong. According to my beginners opinion it happens already in node set.property. I would have expected that the link to the incoming telegram text is changed from msg.payload.event.text to msg.prompt, but it remains unchanged and the function node Open AI never fires. I have added another debug node behind set.property and the contents look still identical to the outcome of event node telegram_text, whereas your debug node 43 shows at 7:12 [prompt: „what is …..“] my debug node behind set.property but before function node OpenAI shows [text: „what is….“]. Maybe I am not yet qualified for the master class? Thank you for these outstanding lectures even I did not pass the examination
@technithusiast Жыл бұрын
I recognized that there’s a lot of moving parts so I created Chaperone where u can export these nodes in a (hopefully) working state. Have u tried it?
@LaneLarson Жыл бұрын
Amazing content. Thos is next level HA integratins. 😂
@technithusiast Жыл бұрын
It’s gonna get wild in the next video 😏
@fenmoveification Жыл бұрын
Great video and you did what I was always thinking of doing. So now I don’t have too 😂
@technithusiast Жыл бұрын
Glad I could help😂
@ThomasPrikowitsch Жыл бұрын
amazing, i subscribed immediately, but.... nodered crashes on me... in the api i can see, that gpt answers, but i dont get the answer back... have to restart node red on my homeassistant every time
@technithusiast Жыл бұрын
Thanks for the sun! Some viewers mentioned this too. The consensus was that they ran out of tokens and openai would return an exception that crashed their system.
@giantbrain5793 Жыл бұрын
good tutorial, I'm stuck in the playground, I can't find the view code tab, any suggestions from you sir,thank you
@technithusiast Жыл бұрын
I’m not completely sure where you are stuck so it’s difficult to help. Email me the details and I’ll do my best to help
@giantbrain5793 Жыл бұрын
now, i can fix it, but i'm stuck in Open AI node,i have update Node.JS ,but allways appear error massage "call service node is missing api "service" property, not found in config or payload".please help me.import OpenAI from "openai"; const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY, }); const response = await openai.completions.create({ model: "gpt-3.5-turbo", prompt: "", temperature: 1, max_tokens: 256, top_p: 1, frequency_penalty: 0, presence_penalty: 0, });
@technithusiast Жыл бұрын
Based your error, it seems like the Call Service node is not getting the right data. You should put debug nodes after the function node that call OpenAI api so see what gets returned and work backwards from there.
@shenglong9818 Жыл бұрын
Damn this is amazing
@technithusiast Жыл бұрын
Glad you liked it 😁
@RiOGaMez Жыл бұрын
You make me want to disconnect everything and start completely over lol I love it here good video
@technithusiast Жыл бұрын
I get what you mean 😁
@videocreations2710 ай бұрын
I have tried many different ways to do this but I am ALWAYS getting a syntax error. Telegram receives but open ai function does nothing i've tried playground version, and copying exactly what you have on screen to no avail. Thoughts?
@technithusiast10 ай бұрын
People have ran into similar issues. The code in the video is probably not going to work since OpenAI changes the way their API works making my code obsolete. I have other videos which as Easily use ChatGPT in your Custom Automations! | Node-Red Tutorial kzbin.info/www/bejne/gGHCnpxtipWqea8 which show you how to install a custome plug-in I created that will provide a low-code way to connect to OpenAI. You can use that and try to complete complete this tutorial.
@kasoma70 Жыл бұрын
very nice thanks
@technithusiast Жыл бұрын
👌🏾👌🏾
@ruppy4103 Жыл бұрын
Hi! Great video, thanks:) What exactly is this AI? Is it the ChatGPT you use through openAI's site? I just spent half an hour talking to it through telegram and I'm really confused. It tells me it's human, but not of physical form. It say it's not an AI, and that it's a human being. It says it's not related in any manner to OpenAI or GPT. I'm scared 😂
@technithusiast Жыл бұрын
😂😂
@LiviTech11 ай бұрын
When I get to the openAI fucntion i'm getting can't access openai before initilization
@technithusiast11 ай бұрын
Hey thanks for watching This is pretty outdated so I’m sure some things may not work as intended. To help, I created this tool that will connect your automation to GPT. Easily use ChatGPT in your Custom Automations! | Node-Red Tutorial kzbin.info/www/bejne/gGHCnpxtipWqea8
@sdfhjklhsfdjdsflhkds Жыл бұрын
Great stuff and I look forward to seeing this through to the end. I had to fool around with the actual OpenAI call and (since text-davinci is going away), used the openai.chat.completions.create call instead with gpt-3.5-turbo. This is what is currently used in your latest flow on Chaperone. My only issue is that it takes a really long time (10+ seconds) to get a response back to Node-RED. It's almost like the API is waiting for a timeout before sending the response. This is on basic Inject -> Change -> Open AI function -> Debug flow for testing purposes. Is there any way to speed this up? Or am I missing a setting somewhere?
@technithusiast Жыл бұрын
Perhaps it’s the version of GPT. Try updating to the latest version of gpt. I signed up for access to GPT-4 and use that version in my videos so I was unaware that the others were that slow.
@sdfhjklhsfdjdsflhkds Жыл бұрын
@@technithusiast You are correct. gpt-3.5-turbo seems to be anything but turbo, based on complaints on the OpenAI forum. I switched to gpt-4 and responses are averaging around 2 seconds. Thanks for the suggestion and the hard work! Now to get cracking on some entity filtering ...
@technithusiast Жыл бұрын
Lolol glad I can help!
@sdfhjklhsfdjdsflhkds Жыл бұрын
@@technithusiast Thanks again. Like I said - awesome content. Enjoy those coffees.
@technithusiast Жыл бұрын
@@sdfhjklhsfdjdsflhkds 😮😮😮 that was you!! Yooo much respect and appreciation ✊🏾
@kraddoomsters Жыл бұрын
you described how to include filters, but how can I exclude some entities from there, like some specific lights for example
@technithusiast Жыл бұрын
You could do one of two thing: 1. Rename the light entity I’d so it doesn’t fit your rule ( not recommended) 2. Add a secondary filter node to reduce your filtered list further (preferred)
@sureshtaurus5108 Жыл бұрын
I copied the updated code from chaperone and added my api key. however, I get the following error message on santize response: TypeError: Cannot read properties of undefined (reading 'data')
@technithusiast Жыл бұрын
I recently update the json files. I’ll take a look at them on my free time.
@samuraiintellectual Жыл бұрын
Are you running supervised or in docker? I think not docker as I have had some issues with the openai node.
@technithusiast Жыл бұрын
I’m using the supervised on a VM. What issues are u finding on the docker version?
@samuraiintellectual Жыл бұрын
@@technithusiastUsing your flow (modified for me of course) it locks up Node-Red each time I send a message. I have to think it was the loading of the openai library, but I’m not sure.
@technithusiast Жыл бұрын
Something to watch out for is if you run out of credits from openai, it may cause your system to crash or behave oddly.
@Taterxxwardy Жыл бұрын
I think I'm doing something wrong here but it seems I might have too many lights alone. My msg.prompt is getting cut off prior to sending to gpt. Is this something you've run into yet? Also, I've tried splitting up the prompts into chunked responses to send the entire data set to gpt and then ask it to answer a question but, it seems that when I do that it's remembering old context and telling that some lights are on when they aren't or that some that are on are not. Hoping you have a suggestion and looking forward to your next video!
@Taterxxwardy Жыл бұрын
I've also tested incorporated elevenlabs voice generation into its response when using HA's voice Assist and it works flawlessly, eventually I want to hook this into your setup and cast to my sonos. If you can't tell I'm a fan of archer and it's mimicking his voice perfectly!!
@technithusiast Жыл бұрын
I’ve kinda seen that issue though it could be a misleading quirk of the debugger. Try adjusting the parameters for openAI they do have a max number of characters they can handle… something else I discovered is that openAIs services goes down occasionally which will throw errors in the app. It’s best you catch the failing request to prevent home assistant from crashing.
@kraddoomsters Жыл бұрын
I don't know what's changed, but the OpenAI node crashes my node-red now
@technithusiast Жыл бұрын
OpenAI did update their API and deprecate a few models so you may want to check on that perhaps 🤔
@Jasonhartley31 Жыл бұрын
And here I was thinking my Node Red GPT Weather report was awesome 😂
@technithusiast Жыл бұрын
Oh it gets soo much better 😁
@crushkitty Жыл бұрын
looks like for me the function node "openai" does not work... as soon as it goes through the node.... my node red crashes....you said when you add open ai to the model it will install whats needed.... put i think it does not, any tips or something i can look at you can suggest ?
@technithusiast Жыл бұрын
OpenAI is actively enhancing their code which mean that there is a high chance the code you are copying from me is deprecated. You can use the code i provide as a reference but you will need to go to the OpenAI developer playground site to get the updated version of their API.
@rmiles7721 Жыл бұрын
Getting an error message when I attempt to send any TG message, from the function node: "TypeError: msg.answer.data.choices[0].text.replaceAll is not a function"
@technithusiast Жыл бұрын
In general the error means that msg.answer.data.choices[0].text isn’t a actually a string (most likely it’s undefined) but I would need to know a lot more of what your data looks like to truly help. Though at a glance shouldn’t it be msg.payload instead of msg.answer?
@rmiles7721 Жыл бұрын
@@technithusiast That's straight from your tutorial. From the function node, On Message tab: msg.gptAnswer = msg.answer.data.choices[0].text.replaceAll(" ").trim() return msg; Slightly different than the code if I copy/paste from your web site but the results are the same (for me).
@rmiles7721 Жыл бұрын
@@technithusiast I figured it out. Had to upgrade NodeJS as replaceAll is not supported on older versions, which meant I had to update my raspi first then Node.
@technithusiast Жыл бұрын
Glad you were able to get it working! Issues due to difference in versions and machines are always tricky to figure out.
@4sayken Жыл бұрын
Dude, great video is there any way that I can support you Patreon etc honestly, I would do anything and pay anything to get all of those videos right now?
@technithusiast Жыл бұрын
I appreciate it! I don’t have anything like that but feel free to buy me a coffee if you like 😁
@MatSmithLondon Жыл бұрын
I was a bit confused by the initial chat: - which windows are open? - office windows (right and left) are open - Is anything open? (I was thinking - is that last question a trick question? Is he making sure ChatGPT is sure? 😂)
@technithusiast Жыл бұрын
lolol no trick questions here. During testing I ask the AI the same question many times so it was probably left over from the previous tests
@tutacat8 ай бұрын
Do not use friendly names as values. Put them under a name key in the object. Friendly names can be the same or annoying to use as a key name.
@removeme5206 Жыл бұрын
does anyone know how to do this now ? .. I guess after 2 months it isn't proper anymore .. the pasted text from the playground in node.js form gives errors when pasted in home assistant's node-red. "ReferenceError: require is not defined (line 1, col 38)" is what the debug spits out, so the first line in the code doesn't work anymore and of course its stopping at that point and not giving any response.
@technithusiast Жыл бұрын
Hi. Sorry to hear you’re having trouble. What are you trying to copy? I may be able to help u.
@removeme5206 Жыл бұрын
@@technithusiast ive made 4 replies and they arent showing on youtube WTF
@montaque22 Жыл бұрын
@@removeme5206 I’ve been on the lookout for your replies but I haven’t seen them. YT could have flagged them so I’ll check to see if YT is holding it elsewhere.
@rikukyllonen9207 Жыл бұрын
Same error here, no solution yet
@waynenocton Жыл бұрын
Is it just me or is volume a bit low on this one? Intro seemed good.
@kraddoomsters Жыл бұрын
it's you :D
@technithusiast Жыл бұрын
Thanks 🙏🏾
@waynenocton Жыл бұрын
Really strange, when hooked to my Bluetooth it goes quiet after the intro but with phone speaker it’s fine.
@ketohable Жыл бұрын
TypeError: Configuration is not a constructor
@technithusiast Жыл бұрын
No worries I’ll be updating the files soon. I suspect that the API has updated for OpenAI which is why it’s not working for folks
@goochie6856 Жыл бұрын
Same, when the new format is inserted for some reason there is a syntax error. @@technithusiast
@YuraMamaev Жыл бұрын
@@technithusiast Thank you for helping us. I am experiencing the same issue.
@sureshtaurus5108 Жыл бұрын
I hope there will be an update on this soon. Your videos are really great!
@gangown Жыл бұрын
Because chatGPT has updated there API, you have to change the javascript a bit. I changed it to the following to get it to work: const openai = new OpenAI({ apiKey: "YOUR KEY SHOULD BE HERE", }); await openai.completions.create({ model: "gpt-3.5-turbo-instruct", prompt: msg.prompt, temperature: 0.7, max_tokens: 1200, top_p: 1, frequency_penalty: 0, presence_penalty: 0, }).then(answer => { msg.answer = answer; node.send(msg); node.done(); }); return; Also make sure to set the "Import As" in the setup tab to "OpenAI". The correct casing is important.
@erikuustalu8610 Жыл бұрын
ReferenceError: cannot access openai before intalization
@tutacat8 ай бұрын
This is outdated slightly. There is now an OpenAI integration for Home Assistant.
@vovas.1061 Жыл бұрын
hi great job love that really want to test but even if I follow everything and try to correct everything I have an node red error when I deploy the function node my code is here import OpenAI from "openai"; const openai = new OpenAI({ apiKey: "my api in here ", }); await openai.completions.create({ model: "gpt-3.5-turbo-instruct", prompt: msg.prompt, temperature: 0.7, max_tokens: 1200, top_p: 1, frequency_penalty: 0, presence_penalty: 0, }).then(answer => { msg.answer = answer; node.send(msg); node.done(); }); return but I have this error in debugger 02/12/2023, 02:58:43node: Open AI function : (error) "SyntaxError: 'import' and 'export' may only appear at the top level (2:0)" I try many variety of the code this last 3 days but still have the same error I run my ha on a Mac for now in a vm called UTM may be node red have issues or I do something wrong idk but if someone can help please I try many things but stuck here... I'm not a coder so I learn a little bit here and there but still can't find the issue even ask gpt and google bard but he try to give me some variety of this code but the error still the same help me please
@vovas.1061 Жыл бұрын
so i find it out and it's works for the fonction you need to adapt your code like this at least for me that worked const openai = new OpenAI({ apiKey: "your api key here ", }); await openai.completions.create({ model: "gpt-3.5-turbo-instruct", prompt: msg.prompt, temperature: 1, max_tokens: 1200, top_p: 1, frequency_penalty: 0, presence_penalty: 0, }).then(answer => { msg.answer = answer; node.send(msg); node.done(); }); return;5b
@technithusiast Жыл бұрын
Hi!! Im really glad you got it working 🎉 The code i gave won't work for everyone since everyone's system is a little different. I am working on something that will make it easier for everyone to use GPT in node red with less problems like how you encountered 👍🏾
@vovas.1061 Жыл бұрын
@@technithusiast it’s amazing !
@vovas.1061 Жыл бұрын
Hope you going to do some others tutos cause I learned so much this week I love you content ( juste a little thing if I can, the home assistant control the house really well but when I ask generic questions he is not able to answer like gpt do so if we can have one day 3 ways to use it like ask informations about the house, control the house and ask questions like it’s tchat gpt and he can answer us how can I cook pancakes it will be awesome but really it’s already amazing and that helps me so mush to learn code and everything else wow 😵💫 hope you newer lose your enthusiasm for you’re work cause it’s mind blowing ( sorry for my bad English ) !
@technithusiast Жыл бұрын
I understand your English just fine😁. I’m glad you’re enjoying the content! I’ll look over your suggestions and see if I can incorporate them into future videos.
@Yoggi211 Жыл бұрын
Thank you for these guides. Truly awesome! I am having issues with Node-red crashing as soon as i send a telegram message, have you had any issues like these? [error] Error: Request failed with status code 429 at createError (/config/node-red/node_modules/axios/lib/core/createError.js:16:15) at settle (/config/node-red/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/config/node-red/node_modules/axios/lib/adapters/http.js:322:11) at IncomingMessage.emit (node:events:525:35) at endReadableNT (node:internal/streams/readable:1359:12) at processTicksAndRejections (node:internal/process/task_queues:82:21)
@Yoggi211 Жыл бұрын
Just to be clear, Node crashes with the above error as soon as it hits the OpenAI function node
@finipini Жыл бұрын
Yes, that,s exactly what happens to me, node red goes down when i inject a msg.prompt into the function node. I have node red has and addon in home assistant.
@finipini Жыл бұрын
429 is the same error i have, for chatgpt thats and error of "to many requests"
@technithusiast Жыл бұрын
Hmm I never received that particular error but I have crashed the node red before when I create in unexpected exception or create an infinite loop or a process that eats resources too fast. Based on your error you may need a try catch block around your OPENAI call 🤔 just a guess…
@Yoggi211 Жыл бұрын
@Ricardo Pina Figured it out. I had no free OpenAI credits left and for some reason that made Node-RED crash. Moved to a paid plan and it started working. @Technithusiast Really looking forward to more AI Masterclasses. Especially if and when you go through your more advanced OpenAI-powered flow :-)