ModelConfig
- Since
- 0.1.0
- Source
wp-includes/php-ai-client/src/Providers/Models/DTO/ModelConfig.php:51
Represents configuration for an AI model.
Description
This class allows configuring various parameters for model behavior, including output modalities, system instructions, generation parameters, and tool integrations.
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 · 21
$outputModalitiesWordPress\AiClient\Providers\Models\DTO\list<ModalityEnum>|nullprotected$systemInstructionstring|nullprotected$candidateCountint|nullprotected$maxTokensint|nullprotected$temperaturefloat|nullprotected$topPfloat|nullprotected$topKint|nullprotected$stopSequencesWordPress\AiClient\Providers\Models\DTO\list<string>|nullprotected$presencePenaltyfloat|nullprotected$frequencyPenaltyfloat|nullprotected$logprobsbool|nullprotected$topLogprobsint|nullprotected$functionDeclarationsWordPress\AiClient\Providers\Models\DTO\list<FunctionDeclaration>|nullprotected$webSearchWordPress\AiClient\Tools\DTO\WebSearch|nullprotected$outputFileTypeWordPress\AiClient\Files\Enums\FileTypeEnum|nullprotected$outputMimeTypestring|nullprotected$outputSchemaWordPress\AiClient\Providers\Models\DTO\array<string,protected$outputMediaOrientationWordPress\AiClient\Files\Enums\MediaOrientationEnum|nullprotected$outputMediaAspectRatiostring|nullprotected$outputSpeechVoicestring|nullprotected$customOptionsWordPress\AiClient\Providers\Models\DTO\array<string,protected
Methods · 48
- __clone()Creates a deep clone of this configuration.
- setOutputModalities()Sets the output modalities.
- getOutputModalities()Gets the output modalities.
- setSystemInstruction()Sets the system instruction.
- getSystemInstruction()Gets the system instruction.
- setCandidateCount()Sets the candidate count.
- getCandidateCount()Gets the candidate count.
- setMaxTokens()Sets the maximum tokens.
- getMaxTokens()Gets the maximum tokens.
- setTemperature()Sets the temperature.
- getTemperature()Gets the temperature.
- setTopP()Sets the top-p parameter.
- getTopP()Gets the top-p parameter.
- setTopK()Sets the top-k parameter.
- getTopK()Gets the top-k parameter.
- setStopSequences()Sets the stop sequences.
- getStopSequences()Gets the stop sequences.
- setPresencePenalty()Sets the presence penalty.
- getPresencePenalty()Gets the presence penalty.
- setFrequencyPenalty()Sets the frequency penalty.
- getFrequencyPenalty()Gets the frequency penalty.
- setLogprobs()Sets whether to return log probabilities.
- getLogprobs()Gets whether to return log probabilities.
- setTopLogprobs()Sets the number of top log probabilities to return.
- getTopLogprobs()Gets the number of top log probabilities to return.
- setFunctionDeclarations()Sets the function declarations.
- getFunctionDeclarations()Gets the function declarations.
- setWebSearch()Sets the web search configuration.
- getWebSearch()Gets the web search configuration.
- setOutputFileType()Sets the output file type.
- getOutputFileType()Gets the output file type.
- setOutputMimeType()Sets the output MIME type.
- getOutputMimeType()Gets the output MIME type.
- setOutputSchema()Sets the output schema.
- getOutputSchema()Gets the output schema.
- setOutputMediaOrientation()Sets the output media orientation.
- getOutputMediaOrientation()Gets the output media orientation.
- setOutputMediaAspectRatio()Sets the output media aspect ratio.
- getOutputMediaAspectRatio()Gets the output media aspect ratio.
- validateMediaOrientationAspectRatioCompatibility()Validates that the given media orientation and aspect ratio values do not conflict with each other.
- setOutputSpeechVoice()Sets the output speech voice.
- getOutputSpeechVoice()Gets the output speech voice.
- setCustomOption()Sets a single custom option.
- setCustomOptions()Sets the custom options.
- getCustomOptions()Gets the custom options.
- getJsonSchema(){@inheritDoc}
- toArray(){@inheritDoc}
- fromArray(){@inheritDoc}
Source code
class ModelConfig extends AbstractDataTransferObject{ public const KEY_OUTPUT_MODALITIES = 'outputModalities'; public const KEY_SYSTEM_INSTRUCTION = 'systemInstruction'; public const KEY_CANDIDATE_COUNT = 'candidateCount'; public const KEY_MAX_TOKENS = 'maxTokens'; public const KEY_TEMPERATURE = 'temperature'; public const KEY_TOP_P = 'topP'; public const KEY_TOP_K = 'topK'; public const KEY_STOP_SEQUENCES = 'stopSequences'; public const KEY_PRESENCE_PENALTY = 'presencePenalty'; public const KEY_FREQUENCY_PENALTY = 'frequencyPenalty'; public const KEY_LOGPROBS = 'logprobs'; public const KEY_TOP_LOGPROBS = 'topLogprobs'; public const KEY_FUNCTION_DECLARATIONS = 'functionDeclarations'; public const KEY_WEB_SEARCH = 'webSearch'; public const KEY_OUTPUT_FILE_TYPE = 'outputFileType'; public const KEY_OUTPUT_MIME_TYPE = 'outputMimeType'; public const KEY_OUTPUT_SCHEMA = 'outputSchema'; public const KEY_OUTPUT_MEDIA_ORIENTATION = 'outputMediaOrientation'; public const KEY_OUTPUT_MEDIA_ASPECT_RATIO = 'outputMediaAspectRatio'; public const KEY_OUTPUT_SPEECH_VOICE = 'outputSpeechVoice'; public const KEY_CUSTOM_OPTIONS = 'customOptions'; /* * Note: This key is not an actual model config key, but specified here for convenience. * It is relevant for model discovery, to determine which models support which input modalities. * The actual input modalities are part of the message sent to the model, not the model config. */ public const KEY_INPUT_MODALITIES = 'inputModalities'; /** * @var list<ModalityEnum>|null Output modalities for the model. */ protected ?array $outputModalities = null; /** * @var string|null System instruction for the model. */ protected ?string $systemInstruction = null; /** * @var int|null Number of response candidates to generate. */ protected ?int $candidateCount = null; /** * @var int|null Maximum number of tokens to generate. */ protected ?int $maxTokens = null; /** * @var float|null Temperature for randomness (0.0 to 2.0). */ protected ?float $temperature = null; /** * @var float|null Top-p nucleus sampling parameter. */ protected ?float $topP = null; /** * @var int|null Top-k sampling parameter. */ protected ?int $topK = null; /** * @var list<string>|null Stop sequences. */ protected ?array $stopSequences = null; /** * @var float|null Presence penalty for reducing repetition. */ protected ?float $presencePenalty = null; /** * @var float|null Frequency penalty for reducing repetition. */ protected ?float $frequencyPenalty = null; /** * @var bool|null Whether to return log probabilities. */ protected ?bool $logprobs = null; /** * @var int|null Number of top log probabilities to return. */ protected ?int $topLogprobs = null; /** * @var list<FunctionDeclaration>|null Function declarations available to the model. */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/Models/DTO/ModelConfig.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.