PromptBuilder::usingModel( WordPressAiClientProvidersModelsContractsModelInterface $model ): self

Sets the model to use for generation.

Description

The model’s configuration will be merged with the builder’s configuration, with the builder’s configuration taking precedence for any overlapping settings.

Parameters

$modelWordPressAiClientProvidersModelsContractsModelInterfacerequired
The model to use.

Return

self

Source

public function usingModel(ModelInterface $model): self
{
    $this->model = $model;
    // Merge model's config with builder's config, with builder's config taking precedence
    $modelConfigArray = $model->getConfig()->toArray();
    $builderConfigArray = $this->modelConfig->toArray();
    $mergedConfigArray = array_merge($modelConfigArray, $builderConfigArray);
    $this->modelConfig = ModelConfig::fromArray($mergedConfigArray);
    return $this;
}

Changelog

VersionDescription
0.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.