Skip to content

Add missing PromptBuilder convenience wrappers to control media output#218

Merged
felixarntz merged 1 commit intotrunkfrom
missing-prompt-builder-convenience-methods
Mar 10, 2026
Merged

Add missing PromptBuilder convenience wrappers to control media output#218
felixarntz merged 1 commit intotrunkfrom
missing-prompt-builder-convenience-methods

Conversation

@felixarntz
Copy link
Member

The PromptBuilder was missing methods to control 3 ModelConfig properties:

  • outputMediaOrientation
  • outputMediaAspectRatio
  • outputSpeechVoice

Additionally, this PR fixes an odd but somewhat important bug with the usingStopSequences method not working at all (it needs to set the top-level key, not a key in customOptions).

@felixarntz felixarntz added this to the 1.3.0 milestone Mar 8, 2026
@felixarntz felixarntz requested a review from JasonTheAdams March 8, 2026 19:23
@felixarntz felixarntz added the [Type] Bug An existing feature does not function as intended label Mar 8, 2026
@github-actions
Copy link

github-actions bot commented Mar 8, 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: felixarntz <flixos90@git.wordpress.org>
Co-authored-by: gziolo <gziolo@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

codecov bot commented Mar 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.48%. Comparing base (30a1506) to head (1134643).
⚠️ Report is 7 commits behind head on trunk.

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk     #218      +/-   ##
============================================
+ Coverage     87.45%   87.48%   +0.02%     
- Complexity     1194     1197       +3     
============================================
  Files            60       60              
  Lines          3858     3867       +9     
============================================
+ Hits           3374     3383       +9     
  Misses          484      484              
Flag Coverage Δ
unit 87.48% <100.00%> (+0.02%) ⬆️

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.

@felixarntz
Copy link
Member Author

@JasonTheAdams One other thing to consider here is that we also don't support setting custom options via PromptBuilder convenience methods - they can only be set by using the slightly more complex usingModelConfig method.

Maybe that's still a reasonable path forward, because using those is more advanced and assumes extra responsibility on the caller - they will need to know whether the API supports a specific custom option or not - but I wanted to bring it up so we can consider whether or not to add a convenience method for them.

If we want to include that in the PromptBuilder, it could be a simple PromptBuilder::usingCustomOption(string $option, $value).

Copy link
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 review looks good. All checks pass locally (tests, PHPCS clean, PHPStan clean). The stop sequences bug fix is important and the new convenience methods follow established patterns consistently. The changes are straighforwad and covered properly with tests.

Re: custom options convenience method — agree it's worth considering as a follow-up, but shouldn't block this PR.

@felixarntz felixarntz merged commit 69b07f0 into trunk Mar 10, 2026
11 checks passed
@felixarntz felixarntz deleted the missing-prompt-builder-convenience-methods branch March 10, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants