Viewing a single comment thread. View all comments

nightofgrim t1_jdewhmx wrote

I'm at work so I don't have the prompt handy, but I instructed chat GPT to output commands in the following format:

[deviceName:state]

So chatGPT might reply with:

> I turned on your bedroom light [bedroom light:on] and turned up the temperature [thermostat:72]

All you have to do is parse the messages for [:] and trigger the thing.

EDIT:

I told it to place all commands at the end, but it insists on inlining them. Easy enough to deal with.

7

---AI--- t1_jdey54g wrote

GPT is really good at outputting json. Just tell it you want the output in json, and give an example.

So far in my testing, it's got a success rate of 100%, although I'm sure it may fail occasionally.

9

nightofgrim t1_jdf00h9 wrote

If it fails, reply that it screwed up and needs to fix it. I bet that would work.

5

iJfbQd t1_jdf9cqi wrote

I've just been parsing the json output using a json5 parser (ie in Python, import json5 as json). In my experience, this catches all of the occasional json output syntax errors (like putting a comma after the terminal element).

2