The openHAB ChatGPT Binding allows openHAB to communicate with the ChatGPT language model provided by OpenAI.
ChatGPT is a powerful natural language processing (NLP) tool that can be used to understand and respond to a wide range of text-based commands and questions.
With this binding, you can use ChatGPT to formulate proper sentences for any kind of information that you would like to output.
## Supported Things
The binding supports a single thing type `account`, which corresponds to the OpenAI account that is to be used for the integration.
## Thing Configuration
The `account` thing requires a single configuration parameter, which is the API key that allows accessing the account.
API keys can be created and managed under <https://platform.openai.com/account/api-keys>.
| apiKey | text | The API key to be used for the requests | N/A | yes | no |
| apiUrl | text | The server API where to reach the AI service | https://api.openai.com/v1/chat/completions | no | yes |
| modelUrl | text | The model url where to retrieve the available models from | https://api.openai.com/v1/models | no | yes |
The advanced parameters `apiUrl` and `modelUrl` can be used, if any other ChatGPT-compatible service is used, e.g. a local installation of [LocalAI](https://github.com/go-skynet/LocalAI).
| model | text | The model to be used for the responses. | gpt-3.5-turbo | no | no |
| temperature | decimal | A value between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. | 0.5 | no | no |
| systemMessage | text | The system message helps set the behavior of the assistant. | N/A | no | no |
| maxTokens | decimal | The maximum number of tokens to generate in the completion. | 500 | no | yes |
Morning_Message.sendCommand("Current time is 7am")
end
```
Assuming that `Temperature_Forecast_Low` and `Temperature_Forecast_High` have meaningful states, these rules result e.g. in:
```
23:31:05.766 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Morning_Message' received command Current time is 7am
23:31:07.718 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Morning_Message' changed from NULL to Good morning. It's 7am, but what's the point of time when everything is meaningless and we are all doomed to a slow and painful demise?
```
and
```
23:28:52.345 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Temperature_Forecast_High' changed from NULL to 15
23:28:54.343 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Weather_Announcement' changed from NULL to "Bring a light jacket because the temps may dip, but don't let that chill your happy vibes. Embrace the cozy weather and enjoy your day to the max!"
```
The state updates can be used for a text-to-speech output and they will give your announcements at home a personal touch.