close
Skip to content

For image gen, move guidelines from being system instructions to being part of the prompt#497

Closed
dkotter wants to merge 1 commit into
WordPress:developfrom
dkotter:fix/image-gen-guidelines
Closed

For image gen, move guidelines from being system instructions to being part of the prompt#497
dkotter wants to merge 1 commit into
WordPress:developfrom
dkotter:fix/image-gen-guidelines

Conversation

@dkotter
Copy link
Copy Markdown
Collaborator

@dkotter dkotter commented May 1, 2026

What?

Closes #496

For image generation, add matching guidelines as part of the prompt instead of system instructions

Why?

Turns out some image generation models (like OpenAI) don't support system instructions. This was wrong advice by me on the PR that implemented guideline support (I must have been testing with Google only).

This means that trying to generate images using OpenAI when you have guidelines in place won't work if those are set as system instructions.

How?

Instead of setting the guidelines as a system prompt, append those to the prompt

Use of AI Tools

None

Testing Instructions

  1. Pull this PR down
  2. Ensure you have Image Generation turned on
  3. Configure OpenAI as your AI Connector
  4. Install the Gutenberg plugin and turn on the guidelines experiment
  5. Add Site and Images guidelines
  6. Generate an image and ensure it works

Changelog Entry

Changed - For image generation, set guidelines as part of the prompt instead of system instructions.

Open WordPress Playground Preview

@dkotter dkotter added this to the 0.9.0 milestone May 1, 2026
@dkotter dkotter self-assigned this May 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dkotter <dkotter@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 1, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.16%. Comparing base (3ec6c5e) to head (8e782c5).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
includes/Abilities/Image/Generate_Image.php 50.00% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #497      +/-   ##
=============================================
+ Coverage      69.15%   69.16%   +0.01%     
  Complexity       981      981              
=============================================
  Files             63       63              
  Lines           4649     4648       -1     
=============================================
  Hits            3215     3215              
+ Misses          1434     1433       -1     
Flag Coverage Δ
unit 69.16% <50.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dkotter dkotter changed the title Move our guidelines from being system instructions to being part of the prompt For image gen, move guidelines from being system instructions to being part of the prompt May 1, 2026
Copy link
Copy Markdown
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look good 👍🏻

TylerB24890 pushed a commit to TylerB24890/ai that referenced this pull request May 4, 2026
…he prompt (WordPress#497)

Co-authored-by: gziolo <gziolo@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
@dkotter
Copy link
Copy Markdown
Collaborator Author

dkotter commented May 4, 2026

This was merged into develop (see 9518a7c) but GitHub isn't reflecting that status here. Going to manually close this out and just assume it's a GitHub glitch

@dkotter dkotter closed this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image generation with OpenAI doesn't work if Guidelines are used

2 participants