- md5
- 5cb973e79f51d666e098113cb5b9097f
- sha1
- 50dbb8e49e429f94fda312b500761c39e3f149fe
- sha256
- 1ebd7596b2ecc98c4755298d09b599e06dcfc0246faaef9486c8b328e46648da
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
<?php
declare (strict_types=1);
namespace WordPress\AiClient\Events;
use WordPress\AiClient\Messages\DTO\MessagePart;
use WordPress\AiClient\Providers\Models\Contracts\ModelInterface;
use WordPress\AiClient\Providers\Models\Enums\CapabilityEnum;
/**
* Event dispatched before inputs are sent to an embedding generation model.
*
* @since 1.4.0
*/
class BeforeGenerateEmbeddingEvent
{
/**
* @var list<MessagePart> The inputs to be sent to the model.
*/
private array $inputs;
/**
* @var ModelInterface The model that will generate embeddings.
*/
private ModelInterface $model;
/**
* @var CapabilityEnum The capability being used for generation.
*/
private CapabilityEnum $capability;
/**
* Constructor.
*
* @since 1.4.0
*
* @param list<MessagePart> $inputs The inputs to be sent to the model.
* @param ModelInterface $model The model that will generate embeddings.
* @param CapabilityEnum $capability The capability being used for generation.
*/
public function __construct(array $inputs, ModelInterface $model, CapabilityEnum $capability)
{
$this->inputs = $inputs;
$this->model = $model;
$this->capability = $capability;
}
/**
* Gets the inputs to be sent to the model.
*
* @since 1.4.0
*
* @return list<MessagePart> The inputs.
*/
public function getInputs(): array
{
return $this->inputs;
}
/**
* Gets the model that will generate embeddings.
*
* @since 1.4.0
*
* @return ModelInterface The model.
*/
public function getModel(): ModelInterface
{
return $this->model;
}
/**
* Gets the capability being used for generation.
*
* @since 1.4.0
*
* @return CapabilityEnum The capability.
*/
public function getCapability(): CapabilityEnum
{
return $this->capability;
}
/**
* Performs a deep clone of the event.
*
* @since 1.4.0
*/
public function __clone()
{
$clonedInputs = [];
foreach ($this->inputs as $input) {
$clonedInputs[] = clone $input;
}
$this->inputs = $clonedInputs;
}
}
The same content is in 5 releases, WordPress 7.2-beta1 to 7.2-beta5. See them all, or every version of this file.