The author used GPT-3 to control their Hue Lights with simple instructions such as ‘make the lights blue’, ‘make one light pink and one like orange’ or ‘make them fancy’.
They wrote the project in Python using the phue library to talk to their Hue lights. They integrated this with GPT-3 by asking it to give responses in the JSON format. They used the OpenAI Python API to talk to their models, and a header was defined to tell GPT-3 to give responses in the JSON format, to populate the values in the response to match the request, and to specify what they actually wanted to happen to the lights.
Every time a user enters a message, the message is added to the end of the header and given to GPT-3. The response is parsed into a JSON and used to modify the lights. The author experimented with changing the header around and including the last few messages entered by the user, with mixed results.
















