WordPress\AiClient\Providers\OpenAiCompatibleImplementation
AbstractOpenAiCompatibleTextGenerationModel::prepareResponseFormatParam
Prepares the response format parameter for the API request.
This is only called if the output MIME type is application/json.
Method of the class: AbstractOpenAiCompatibleTextGenerationModel{}
No Hooks.
Returns
Array
Usage
// protected - for code of main (parent) or child class $result = $this->prepareResponseFormatParam( ?array $outputSchema ): array;
- ?array $outputSchema(required)
- .
Changelog
| Since 0.1.0 | Introduced. |
AbstractOpenAiCompatibleTextGenerationModel::prepareResponseFormatParam() AbstractOpenAiCompatibleTextGenerationModel::prepareResponseFormatParam code WP 7.0
protected function prepareResponseFormatParam(?array $outputSchema): array
{
if (is_array($outputSchema)) {
return ['type' => 'json_schema', 'json_schema' => $outputSchema];
}
return ['type' => 'json_object'];
}