[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/php-ai-client/src/Builders/Traits/ -> ModelResolutionTrait.php (summary)

Provides shared model selection methods for builders. Builders that resolve a model from the available providers (e.g. {@see \WordPress\AiClient\Builders\PromptBuilder}) use this trait to expose a consistent fluent API for choosing a model, provider, preferences, and request options. Model selection state and logic live on the {@see ModelResolver} owned by the builder. Model configuration is handled by the composed {@see ModelConfigurationTrait}.

File Size: 92 lines (3 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 4 functions

  usingModel()
  usingModelPreference()
  usingProvider()
  usingRequestOptions()

Functions
Functions that are not part of a class:

usingModel(ModelInterface $model)   X-Ref
Sets the model to use for generation.

The model's configuration will be merged with the builder's configuration,
with the builder's configuration taking precedence for any overlapping settings.

return: self
param: ModelInterface $model The model to use.

usingModelPreference(...$preferredModels)   X-Ref
Sets preferred models to evaluate in order.

return: self
param: string|ModelInterface|ProviderModelTuple ...$preferredModels The preferred models as model IDs,

usingProvider(string $providerIdOrClassName)   X-Ref
Sets the provider to use for generation.

return: self
param: string $providerIdOrClassName The provider ID or class name.

usingRequestOptions(RequestOptions $requestOptions)   X-Ref
Sets the request options for HTTP transport.

return: self
param: RequestOptions $requestOptions The request options.



Generated : Wed Oct 14 08:20:33 2026 Cross-referenced by PHPXref