WordPress\AiClient\Results\DTO

GenerativeAiResult::toArraypublicWP 0.1.0

{@inheritDoc}

Method of the class: GenerativeAiResult{}

No Hooks.

Returns

GenerativeAiResultArrayShape.

Usage

$GenerativeAiResult = new GenerativeAiResult();
$GenerativeAiResult->toArray(): array;

Changelog

Since 0.1.0 Introduced.

GenerativeAiResult::toArray() code WP 7.0

public function toArray(): array
{
    return [self::KEY_ID => $this->id, self::KEY_CANDIDATES => array_map(fn(\WordPress\AiClient\Results\DTO\Candidate $candidate) => $candidate->toArray(), $this->candidates), self::KEY_TOKEN_USAGE => $this->tokenUsage->toArray(), self::KEY_PROVIDER_METADATA => $this->providerMetadata->toArray(), self::KEY_MODEL_METADATA => $this->modelMetadata->toArray(), self::KEY_ADDITIONAL_DATA => $this->additionalData];
}