AbstractApiBasedModel
- Since
- 0.1.0
- Source
wp-includes/php-ai-client/src/Providers/ApiBasedImplementation/AbstractApiBasedModel.php:23
Base class for an API-based model for a provider.
Description
While this class contains no abstract methods, it is still abstract to ensure that each model class can actually perform generative AI tasks by implementing the corresponding interfaces.
Compatibility
- WordPress
- since 0.1.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in 2 of the 5 tracked releases, added in 0.1.0.
Properties · 4
$metadataWordPress\AiClient\Providers\Models\DTO\ModelMetadataprivate$providerMetadataWordPress\AiClient\Providers\DTO\ProviderMetadataprivate$configWordPress\AiClient\Providers\Models\DTO\ModelConfigprivate$requestOptionsWordPress\AiClient\Providers\Http\DTO\RequestOptions|nullprivate
Methods · 7
- __construct()Constructor.
- metadata(){@inheritDoc}
- providerMetadata(){@inheritDoc}
- setConfig(){@inheritDoc}
- getConfig(){@inheritDoc}
- setRequestOptions(){@inheritDoc}
- getRequestOptions(){@inheritDoc}
Source code
abstract class AbstractApiBasedModel implements ApiBasedModelInterface, WithHttpTransporterInterface, WithRequestAuthenticationInterface{ use WithHttpTransporterTrait; use WithRequestAuthenticationTrait; /** * @var ModelMetadata The metadata for the model. */ private ModelMetadata $metadata; /** * @var ProviderMetadata The metadata for the model's provider. */ private ProviderMetadata $providerMetadata; /** * @var ModelConfig The configuration for the model. */ private ModelConfig $config; /** * @var RequestOptions|null The request options for HTTP transport. */ private ?RequestOptions $requestOptions = null; /** * Constructor. * * @since 0.1.0 * * @param ModelMetadata $metadata The metadata for the model. * @param ProviderMetadata $providerMetadata The metadata for the model's provider. */ public function __construct(ModelMetadata $metadata, ProviderMetadata $providerMetadata) { $this->metadata = $metadata; $this->providerMetadata = $providerMetadata; $this->config = ModelConfig::fromArray([]); } /** * {@inheritDoc} * * @since 0.1.0 */ final public function metadata(): ModelMetadata { return $this->metadata; } /** * {@inheritDoc} * * @since 0.1.0 */ final public function providerMetadata(): ProviderMetadata { return $this->providerMetadata; } /** * {@inheritDoc} * * @since 0.1.0 */ final public function setConfig(ModelConfig $config): void { $this->config = $config; } /** * {@inheritDoc} * * @since 0.1.0 */ final public function getConfig(): ModelConfig { return $this->config; } /** * {@inheritDoc} * * @since 0.3.0 */ final public function setRequestOptions(RequestOptions $requestOptions): void { $this->requestOptions = $requestOptions; } /**Changelog
Introduced in 0.1.0. Unchanged from 7.0.4 through 7.1.0.
Signature, return type and hooks compared across 2 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/php-ai-client/src/Providers/ApiBasedImplementation/AbstractApiBasedModel.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.