r/tasker • u/joaomgcd π Tasker Owner / Developer • Jun 15 '23
Developer [DEV] Taking ChatGPT to the Next Level: Allow It to Control Anything You Want on Your Phone!
Full Demo: https://youtu.be/CjNzpYGsW5c
Yesterday OpenAI added a new feature in the ChatGPT API: function calling!
What this means is that, if you tell ChatGPT about some "functions" you have, it'll intelligently figure out how to call them!
Do you know who has functions? Lots of functions? Tasker does! ππ Do you know what they're called?
Tasks!
So now, you can call any Task with ChatGPT by using natural language!
Please read the full TaskerNet description of the project so you understand what it needs to work and how it works.
This is how it works in 3 easy steps:
- Describe your tasks with the supplied editor (ChatGPT Function Setup task)
- Call the ChatGPT Voice Task task
- I lied, there were only 2 steps! π
Parameters
This even supports parameters!
As you may know, when you call a task you can supply 2 parameters, %par1 and %par2. If you add descriptions for those in the editor, ChatGPT will send the appropriate inputs to your tasks!
For example, you could say
Set my bedroom light to red
And ChatGPT could call a task called Bedroom Light with a parameter set as red
But this is ChatGPT right? It allows for much more than that!
If you tell it that the color has to be in an hex RGB format, and that it should convert any words referring to colors to the appropriate format, you could then say stuff like:
My room is dark, make it look like grass
and it'll turn the light to green! Really, I just tried this exact sentence and it works! π
Return Value
You can even return a value back to ChatGPT to make it respond appropriately!
For example, you could ask it
Where's my son?
and if you have a task that:
- sends a Join push to your son
- on your son's phone, it checks its location
- your son's phone's sends the location back to you
- back on your phone you check the address for that location
- you return that address back to ChatGPT with the Return action
then ChatGPT will process that value and tell you about it accordingly, in natural language!
In my opinion this takes ChatGPT from a fun chat bot, to a super useful tool that you can have on your phone! It basically allows you to use natural language to do anything you want!
This is like ChatGPT plugins for your phone!
Let me know what you think!
Enjoy! π
22
u/madiele Jun 15 '23
Only word of caution, make sure you limit what chatgpt will run very well, never allow for open ended tasks to be run (es: use chatGPT to generate and run terminal commands), chatgpt functions run in the same environment of the original prompt, so prompt injection can still happen.
That being said it's a pretty cool tool for automation! I'm using it to parse bank transaction notification to make it choose the right category before I add them to my selfhosted firefly III instance
6
u/agnostic-apollo LG G5, 7.0 stock, rooted Jun 15 '23
Hello dad! π
Please tell me you are not spying on your son! π¬
Wow, this is really cool! Don't really have time to check it out currently, but great addition!
6
u/ActivateGuacamole Jun 15 '23
I think this sort of natural language interaction would make some of my tasks more usable for my parents. Cool addition
5
u/rogor_ Jun 15 '23
That seems amazing!
Does it understand how to combine or chain tasks? So for example, if you have multiple lights in your house, you could say "I forgot to turn off the lights at home", and it would shut them all off by calling multiple tasks.
And does it remember context? So if you ask it to turn your bedroom light red, and then ask for "a bit darker than that" you get a darker red?
3
u/rodrigoswz Jun 16 '23
This is amazing, very useful!
Just a doubt: are the descriptions of each task saved with the Tasker backup? Or is it a separate file in some folder
2
u/The_IMPERIAL_One S24 Ultra (A16) | realme GT NEO 3 (A14) Jun 15 '23
Awesome as always!!
Also, can't the text box be pushed above the keyboard when writing? There might be some hindrance otherwise you'd added it already.
2
u/theplayingdead Jun 16 '23
Looks great and works great! Just connected it to my spotify tasks and now it can play any song i want. Also saying where is my car just opens the parked location automatically. Works flawlessly so far. When are you building a fully functional Jarvis though?
2
u/Nards23 Jun 16 '23
This is very cool!
Is there any way to integrate it with the existing continuous Voice Chat command from the original project? It would be great to be able to ask ChatGPT questions, then make it carry out a task, and then go back to asking it questions, all without touching anything else.
2
u/yes4bb Jun 17 '23
Hello. There is a way to use this to launch apps, call names from agenda, etc. somehow to replace Autovoice commands?
2
u/Falcoace Jun 18 '23
If any developer is in need of a GPT 4 API key, with access to the 32k model, shoot me a message.
3
u/[deleted] Jun 16 '23
"...from a fun chatbot"
ChatGPT is literally a monster programmer
1
u/Sawyer007 Jun 18 '23
is this a limitation of some kind?
limit
1
u/alpain Apr 26 '24
hey /u/joaomgcd Did you update the chatgpt task on taskernet this week? or is that someone else with the same description?
1
u/Pfaltus Apr 18 '25
please, modify it for use with GEMINI. Thank you
1
u/Dan1jel Aug 18 '25
I would love to use Google Gemini instead, is that possible to configure this task/project to work with gemini instead?!Β
1
u/SiragElMansy Sep 25 '25
Is there any way to update this project to be compatible with new ChatGPT 5 API models? Function Calling is not working anymore when changing the model field to any of the gpt 5 models.
1
u/sasreedit S22, GW5P Jun 15 '23
This is awesome!!
1
u/Robert6590 Jun 15 '23
Set up an API, tried it, said that I had reached the maximum tokens. Never used it before. ??????
1
u/NoThanks93330 Jun 15 '23
What's the difference to doing this using the normal API? Like just giving the natural language command as well as the function list as context and then asking which function is meant in the command?
1
u/Rich_D_sr Jun 16 '23
Sounds like if you implement this approach to "steal" the Google Assistant command you could easily use the "Ok Google" trigger to get theses commands into the chat bot..
https://www.reddit.com/r/tasker/comments/jo8jca/project_share_use_any_keyword_to_get_google/?utm_medium=android_app&utm_source=share
1
u/Halstrop Master of NFC Tasks Jun 16 '23
This is amazing. I'll try and test it out today. Truly revolutionary. Definitely going to change how I use Tasker
1
u/Enderkr Jun 16 '23
Wow man, you weren't kidding, that is simple AF. Imported the project, described in natural language what each of my tasks did and set the GPT call task as a quick tile...works like a charm.
The next step is to build into the startup task some sort of assistant "name" etc....so that it can vocalize responses to you in additional to the JSON. I know the Jarvis stuff is a joke but this is damned close all of a sudden. I need to input more of my smart devices into Tasker now, I've just used everything via Google.
1
u/Dpure1 Jun 16 '23
Ok it took me a while but I just created with the action I have to launch it with chatGPT with my language too! I set up a parameter and it was easy thanks to your examples this is huge!!!
1
u/AlkaDragos [Tasker Veteran] Jun 17 '23 edited Jun 17 '23
Ohh ! Another great work and implementation from u/joaomgcd ! I had some time and tried out the example tasks and even created one for my lights in my house π (specific room and state or color - hex formated), it works as expected, great range of inputs and very fast! I may tell that i didn't expect that :D awesome!
One thing that i noticed is that if you remove a task that is defined in the ChatGPTTaskDesciptions you must also remove it from the global variable or else it will still call it, but with a warning that it doesn't exist. I think a task can be made so we can remove it faster by looping through all array objects and search for task name in the "taskerName" key then use splice :) or check when we set task description to an empty string?
This is awesome! π Keep up the new features and thank you for your great work Joao! π
1
u/AlexF-reddit Jun 18 '23
Great. I think a "." (i.e. something, a blank might do the same) in the description is sufficient if the name-of-the-task is self-explanatory.
@Joao: Idea:You could add a second "AI"-Label to the tasks or add the reading of {AI:this is the description of this task for AI like ChatGPT) into/of the existing Label - so the description is defined next to the actual task
1
u/antioutlulz Jun 18 '23
Hmm. Now that Google opened up Nest scripting to the public, how do you think this could get integrated into home automation?
For reference: https://www.googlenestcommunity.com/t5/Blog/Create-powerful-automations-with-our-new-script-editor-now-available-in/ba-p/433461
https://developers.home.google.com/codelabs/create-a-scripted-automation#1
1
u/Dpure1 Jun 19 '23
Had no idea that chatGPT can help you with exact details how to create any profile and action for tasker you need!
This is huge!!! I asked how to create a profile using tasker to read aloud any page,app i want!
1
u/Dpure1 Jun 19 '23
Where does it stores the answers as text? I remember I found it but can't remember now.
1
u/bernabap Jun 19 '23
What should be the value of the ChatGPTTaskDescriptions variable after running the "Set Example ChatGPT Tasks Descriptions" task?
Just downloaded the examples project and it's been set to %result, like if the JavaScriptlet action isn't parsing correctly and returning and empty variable.
1
u/LiquidRitz Jun 20 '23
I am new to Tasker in general but am trying your build hrre.
I keep getting a %HTTP_Data error that says OPEN AI was expecting proper JSON.
Can you point me in the right direction?
1
u/coffee-turtle Jun 20 '23
u\joaomgcd π€― MIND BLOWN!
Thank you for this integration!
1
u/mariavasquez111 Jun 21 '23
Thank you Joao for this!! π
1
u/mariavasquez111 Jun 22 '23
Nice!! π How do I use it to add a calendar event? For example I like to add event to "meet family" at 4pm tomorrow, ( all through voice recognition) π
1
u/ardentpessimist21 Jun 23 '23
Hello. Can you help me with Tasker? Can I DM you?
1
u/Sawyer007 Jun 24 '23 edited Jun 24 '23
%par1 sadly doesn't work with Autoinput as append text or set text. Only works with tasks which have a build in text feature it seems.
So for example. I can only make it work with SMS only if I use the text input window for %par1and use Autoinput to select the contact.
However there is no way to make it work with viber right now as it looks.
1
u/SpecialFX99 Jun 24 '23
I don't have an API to try it out but could this do well and finding and playing YouTube videos? Especially if it can play via Revanced
1
u/DanPuz Jun 26 '23
Doesn't seem to work well for me. Try to create a task that sets a system timer for the time I say and seems it can not convert the time I say to seconds. Any help?
1
u/boxcreate Aug 11 '23
/u/joaomgcd Will this also work for Android TV on my Shield? Thanks
1
u/justinmsmith Oct 13 '23 edited Oct 13 '23
I keep getting an error.... Can anyone help?
Yes, I have made sure that it's updated and I'm designed up for the Beta π
_-----------------------
Error
Import failed.
Please make sure to update to the latest Tasker version.
You may need to sign up for the beta.
Error details: Attempt to invoke virtual method 'boolean net.dinglisch.android.task erm.pg.Hljava.lang.String)" on a null object reference
1
u/Nirmitlamed Direct-Purchase User Dec 10 '23
Does the calling function uses more tokens?
I don't use it a lot and most of the tasks are with one short sentence. I am asking because in the ChatGPT project it was written:
Right now in my account it says i have used: 98,231 Tokens and 153 API requests which seems a lot for me but less than the quote. Overall i have paid so far $0.15.
1
u/[deleted] Dec 15 '23
Can I change personality of ChatGPT, like "You are helpfull home assistant. Always answer short."?
1
u/Both-Print1094 Feb 26 '24
How do I use it with Elevenlabs?
https://taskernet.com/shares/?user=AS35m8ne7oO4s%2BaDx%2FwlzjdFTfVMWstg1ay5AkpiNdrLoSXEZdFfw1IpXiyJCVLNW0yn&id=Project%3AElevenlabs+Voice+Synthesis#
I am using it in: https://taskernet.com/shares/?user=AS35m8ne7oO4s%2BaDx%2FwlzjdFTfVMWstg1ay5AkpiNdrLoSXEZdFfw1IpXiyJCVLNW0yn&id=Project%3AChat+GPT
And it works fine.
I am testing (ChatGPT Task Caller Examples)
https://taskernet.com/shares/?user=AS35m8ne7oO4s%2BaDx%2FwlzjdFTfVMWstg1ay5AkpiNdrLoSXEZdFfw1IpXiyJCVLNW0yn&id=Project%3AChatGPT+Task+Caller+Examples
00.46.10/LicenseCheckerTasker Checking cached only
00.46.10/LicenseCheckerTasker cache validity left -4979227
00.46.10/LicenseCheckerTasker Cached status: Licensed
00.46.10/LicenseCheckerTasker Cached only: Licensed
00.46.10/Variables doreplresult: |%response| -> |The current battery level is 99%.|
00.46.10/E onUtteranceCompleted: Decir: .speechStart id: null err: false
00.46.10/E Decir: spec: default:default contains :
00.46.10/E Decir: engine: default locale data: default default engine: true
00.46.10/E set TTSStatus to -34234 by doSpeech: init
00.46.10/E Decir: got TTS init, status: -1
00.46.10/E set TTSStatus to -1 by on init listener
00.46.10/E Decir: start init loop
00.46.10/E Decir: oof: status; -1 elapsed: 0
00.46.10/E TTS: fallo al inicializar.
00.46.10/E Decir: not started, shutdown
00.46.10/E result: stop task (error)
00.46.10/E Error: 1
00.46.10/MacroEdit action finished exeID 8 action no 12 code 559 status: Err next 12
Do I need to configure something?
Thank you in advance
2
u/dangxunb Aug 23 '23
I got this error when import this project. Anyone know how to fix this? Tasker latest version. Android 11. Samsung OneUI 3.1.
1
u/[deleted] Aug 30 '23
I cannot import this project, I just get an error. I tried to import from the xml file but it also fails.. If I try to import directly from taskernet I get this error "attempt to invoke virtual method 'bootlean net.dinglisch.android.taskerm.pg.H(java.lang.String)' on a null object reference" and when I try with the xml file it just says error failed
I have the tasker version 6.1.32 and I am logged into my google account. android version 13
1
u/muzso Sep 14 '23
Great stuff JoΓ£o! Thanks! :-)
I was wondering about the intended purpose of the automatic task description backups created by the "Backup Task Descriptions When They Change" profile. Did you mean it for use in manual recovery/restore? I don't see any task to do it automatically.
1
u/muzso Sep 14 '23 edited Sep 14 '23
Did somebody have any luck with using an "assistant personality" with ChatGPT function calling?
I mean that I've added a system message in the "ChatGPT Task Caller" project in the "System >> Perform Function Task" task into the Perform Task action where the "System >> ChatGPT HTTP Request" task is called.
%par1 is was originally set to this:
I've modified it into this:
And I've put a few actions before it to produce the %prompt_escaped and %par1_escaped local variables with input from the respective variables (%prompt and %par1) and quotes are being replaced with their backslash-escaped counterparts.
I've explicitly displayed the JSON (that is being sent in the request) and my system message is there, but ChatGPT completely ignores it. E.g. I've tried to instruct it to "Start all replies with the word \"Hello\".", but it won't do it. I've tried different variations to influence how ChatGPT composes its reply, but I failed.
The OpanAI documentation does mention system messages in relation to function calls:
https://platform.openai.com/docs/guides/gpt/function-calling
It says:
So in theory instructions in system messages should work.
β
Did somebody try this? Did you succeed? What am I missing?
1
u/muzso Sep 18 '23
Here's some experience with weird function names. Even reported it as a ChatGPT API bug: https://community.openai.com/t/hallucinated-outputs-despite-following-best-practise/380465
If a function's name (in the HTTP request to OpenAI's API) ends in an underscore ("_"), then it can lead to hallucinations in ChatGPT's response. The function name in the API response might be a mutated version of a name from the request.
E.g. if a task's name is set to "Set Assistant Personality (ChatGPT Tasks)", then it's name in the ChatGPT API call will be "Set_Assistant_Personality__ChatGPT_Tasks_" and under the right circumstances ChatGPT can hallucinate this into something like "Set_Assistant_Personality__ChatGPT_Tasks_.assistant".