[wp-trac] [WordPress Trac] #65168: AI Client: Unable to reliably select model for providers (model preference ignored / inconsistent API)
WordPress Trac
noreply at wordpress.org
Wed May 6 18:16:01 UTC 2026
#65168: AI Client: Unable to reliably select model for providers (model preference
ignored / inconsistent API)
--------------------------+---------------------
Reporter: jabir20 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 7.0
Component: AI | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+---------------------
Changes (by dkotter):
* keywords: ai-client needs-patch =>
Comment:
Yeah, to Jason's point, there currently isn't a `model` method on the
`PromptBuilder` class, which is why you get a fatal error when trying to
use that. The correct method to use is `using_model`. Example:
{{{#!php
<?php
use WordPress\AiClient\AiClient;
$prompt_builder = wp_ai_client_prompt( 'Hello' )
->using_model( AiClient::defaultRegistry()->getProviderModel(
'openai', 'gpt-4.1-nano' )
->generate_text();
}}}
In regards to `using_model_preference`, I've not seen that issue myself,
the AI Client will always respect the model preferences you set there
assuming that model is available and meets the requirements.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/65168#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list