Description
In #359 we added support for the new Guidelines experiment in Gutenberg. This allows you set various guidelines (site, copy, image, block) that others can then use as reference. In our case, we take those guidelines and attach them to our system instructions for various features.
In testing something else, ran into an issue where image generation would return the error Image generation failed. Please ensure you have a connected provider that supports image generation. In tracking down what was going on, found out that OpenAI doesn't support system instructions for their image models and so if you have either site or image guidelines set, those get added as system instructions and then the AI Client can't find any models that support image generation, leading to the mentioned error.
It seems some of the Google models also don't support instructions (any of the imagen ones) but the gemini models do. Likely other image models from other providers will also have various degrees of support.
I think there's a few options we can look to take here:
- Remove the use of guidelines entirely from image generation
- Instead of setting these as system instructions, add them as part of the prompt. This preserves the guidelines and should work for any image generation model. This probably makes more sense anyway when dealing with image generation (which was my mistake as I recommended this approach to match what we do elsewhere)
- Keep these as system instructions for models that support it and remove when the model doesn't. This is tricky to do as we don't know the model until the AI Client tries to make the request
Step-by-step reproduction instructions
- Install Gutenberg and enable the Guidelines experiment
- Add a Site guideline and Images guideline
- Setup OpenAI as your AI Connector
- Turn on image generation
- Try and generate an image. You should see an error
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except the AI plugin.
Please confirm which theme type you used for testing.
Description
In #359 we added support for the new Guidelines experiment in Gutenberg. This allows you set various guidelines (site, copy, image, block) that others can then use as reference. In our case, we take those guidelines and attach them to our system instructions for various features.
In testing something else, ran into an issue where image generation would return the error
Image generation failed. Please ensure you have a connected provider that supports image generation. In tracking down what was going on, found out that OpenAI doesn't support system instructions for their image models and so if you have either site or image guidelines set, those get added as system instructions and then the AI Client can't find any models that support image generation, leading to the mentioned error.It seems some of the Google models also don't support instructions (any of the imagen ones) but the gemini models do. Likely other image models from other providers will also have various degrees of support.
I think there's a few options we can look to take here:
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except the AI plugin.
Please confirm which theme type you used for testing.