| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 3 declare (strict_types=1); 4 namespace WordPress\AiClient\Events; 5 6 use WordPress\AiClient\Messages\DTO\MessagePart; 7 use WordPress\AiClient\Providers\Models\Contracts\ModelInterface; 8 use WordPress\AiClient\Providers\Models\Enums\CapabilityEnum; 9 /** 10 * Event dispatched before inputs are sent to an embedding generation model. 11 * 12 * @since 1.4.0 13 */ 14 class BeforeGenerateEmbeddingEvent 15 { 16 /** 17 * @var list<MessagePart> The inputs to be sent to the model. 18 */ 19 private array $inputs; 20 /** 21 * @var ModelInterface The model that will generate embeddings. 22 */ 23 private ModelInterface $model; 24 /** 25 * @var CapabilityEnum The capability being used for generation. 26 */ 27 private CapabilityEnum $capability; 28 /** 29 * Constructor. 30 * 31 * @since 1.4.0 32 * 33 * @param list<MessagePart> $inputs The inputs to be sent to the model. 34 * @param ModelInterface $model The model that will generate embeddings. 35 * @param CapabilityEnum $capability The capability being used for generation. 36 */ 37 public function __construct(array $inputs, ModelInterface $model, CapabilityEnum $capability) 38 { 39 $this->inputs = $inputs; 40 $this->model = $model; 41 $this->capability = $capability; 42 } 43 /** 44 * Gets the inputs to be sent to the model. 45 * 46 * @since 1.4.0 47 * 48 * @return list<MessagePart> The inputs. 49 */ 50 public function getInputs(): array 51 { 52 return $this->inputs; 53 } 54 /** 55 * Gets the model that will generate embeddings. 56 * 57 * @since 1.4.0 58 * 59 * @return ModelInterface The model. 60 */ 61 public function getModel(): ModelInterface 62 { 63 return $this->model; 64 } 65 /** 66 * Gets the capability being used for generation. 67 * 68 * @since 1.4.0 69 * 70 * @return CapabilityEnum The capability. 71 */ 72 public function getCapability(): CapabilityEnum 73 { 74 return $this->capability; 75 } 76 /** 77 * Performs a deep clone of the event. 78 * 79 * @since 1.4.0 80 */ 81 public function __clone() 82 { 83 $clonedInputs = []; 84 foreach ($this->inputs as $input) { 85 $clonedInputs[] = clone $input; 86 } 87 $this->inputs = $clonedInputs; 88 } 89 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Wed Oct 14 08:20:33 2026 | Cross-referenced by PHPXref |