OpenAI is rolling out is new GPTs feature for specialized chatbots that can interact with an api. There are also new custom chatbot features for users of their api. I’m inclined to play with integrating this with Home Assistant as much as I can on my own, but a formal, official integration may be even better.
I made some updates here to incorporate the new API code and it seems to be working.
I am able to pass prompts as a json and receive Dall-e-3 quality images. Here is the automation
action
- alias: Ask OpenAI to generate an image
service: openai_conversation.generate_image
response_variable: generated_image
data:
config_entry: <config_entry_id>
size: "1024" # Must be one of 1024x1024, 1792x1024, or 1024x1792 for dall-e-3 models.
prompt: |-
{
"size": "1024x1024",
"prompts": [
"a detailed description of a whimsical night scene with a cozy bedroom, a bed with plush blankets, a classic alarm clock and a decorative banner reading \"It's Time for Bed\". "
],
}
- alias: Send out a manual event to update the image entity #the image entity doesnt work for me
event: new_bed_time_image
event_data:
url: "{{ generated_image.url }}"
- alias: download _file #https://www.home-assistant.io/integrations/downloader/
service: downloader.download_file
data:
url: "{{ generated_image.url }} "
subdir: images/bed_time_images
filename: bed_time_image_{{ now().strftime('%Y_%m_%d_%H_%M') }}.png
The main hiccup is that the config_entry fails to load after a restart, so you have to create a new one and reinsert your api-key. I also needed to manually install openai==1.1.1.
and distro
using addons-development. Without this there were some package conflicts pip couldn’t resolve.
This works for me for now as the main thing I wanted was Dalle-3 images, however I’m hopeful the core integration would more fully utilize the new openai api features.