WordPress\AiClient\Providers\OpenAiCompatibleImplementation

AbstractOpenAiCompatibleTextGenerationModel::prepareToolsParamprotectedWP 0.1.0

Prepares the tools parameter for the API request.

Method of the class: AbstractOpenAiCompatibleTextGenerationModel{}

No Hooks.

Returns

list. mixed>> The prepared tools parameter.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepareToolsParam( $functionDeclarations ): array;
$functionDeclarations(list) (required)
The function declarations.

Changelog

Since 0.1.0 Introduced.

AbstractOpenAiCompatibleTextGenerationModel::prepareToolsParam() code WP 7.0

protected function prepareToolsParam(array $functionDeclarations): array
{
    $tools = [];
    foreach ($functionDeclarations as $functionDeclaration) {
        $tools[] = ['type' => 'function', 'function' => $functionDeclaration->toArray()];
    }
    return $tools;
}