wppaste
WordPress

OptionEnum

Since
0.1.0
Source
wp-includes/php-ai-client/src/Providers/Models/Enums/OptionEnum.php:65
Enum for model options.

Description

This enum dynamically includes all options from ModelConfig KEY_* constants in addition to the explicitly defined constants below.

Explicitly defined option (not in ModelConfig):

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.

Methods · 1

Source code

class OptionEnum extends AbstractEnum{    /**     * Input modalities option.     *     * This constant is not in ModelConfig as it's derived from message content,     * not configured directly.     */    public const INPUT_MODALITIES = 'input_modalities';    /**     * Determines the class enumerations by reflecting on class constants.     *     * Overrides the parent method to dynamically add constants from ModelConfig     * that are prefixed with KEY_. These are transformed to remove the KEY_ prefix     * and converted to snake_case values.     *     * @since 0.1.0     *     * @param class-string $className The fully qualified class name.     * @return array<string, string> The enum constants.     */    protected static function determineClassEnumerations(string $className): array    {        // Start with the constants defined in this class using parent method        $constants = parent::determineClassEnumerations($className);        // Use reflection to get all constants from ModelConfig        $modelConfigReflection = new ReflectionClass(ModelConfig::class);        $modelConfigConstants = $modelConfigReflection->getConstants();        // Add ModelConfig constants that start with KEY_        foreach ($modelConfigConstants as $constantName => $constantValue) {            if (str_starts_with($constantName, 'KEY_')) {                // Remove KEY_ prefix to get the enum constant name                $enumConstantName = substr($constantName, 4);                // The value is the snake_case version stored in ModelConfig                // ModelConfig already stores these as snake_case strings                if (is_string($constantValue)) {                    $constants[$enumConstantName] = $constantValue;                }            }        }        return $constants;    }}

Changelog

Introduced in 0.1.0. Unchanged from 7.0.4 through 7.1.0.

  1. 7.0.4
  2. 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/Models/Enums/OptionEnum.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.