| [ 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 use WordPress\AiClient\Results\DTO\EmbeddingResult; 10 /** 11 * Event dispatched after embeddings have been generated. 12 * 13 * @since 1.4.0 14 */ 15 class AfterGenerateEmbeddingEvent 16 { 17 /** 18 * @var list<MessagePart> The inputs that were sent to the model. 19 */ 20 private array $inputs; 21 /** 22 * @var ModelInterface The model that generated embeddings. 23 */ 24 private ModelInterface $model; 25 /** 26 * @var CapabilityEnum The capability that was used for generation. 27 */ 28 private CapabilityEnum $capability; 29 /** 30 * @var EmbeddingResult The result from the model. 31 */ 32 private EmbeddingResult $result; 33 /** 34 * Constructor. 35 * 36 * @since 1.4.0 37 * 38 * @param list<MessagePart> $inputs The inputs that were sent to the model. 39 * @param ModelInterface $model The model that generated embeddings. 40 * @param CapabilityEnum $capability The capability that was used for generation. 41 * @param EmbeddingResult $result The result from the model. 42 */ 43 public function __construct(array $inputs, ModelInterface $model, CapabilityEnum $capability, EmbeddingResult $result) 44 { 45 $this->inputs = $inputs; 46 $this->model = $model; 47 $this->capability = $capability; 48 $this->result = $result; 49 } 50 /** 51 * Gets the inputs that were sent to the model. 52 * 53 * @since 1.4.0 54 * 55 * @return list<MessagePart> The inputs. 56 */ 57 public function getInputs(): array 58 { 59 return $this->inputs; 60 } 61 /** 62 * Gets the model that generated embeddings. 63 * 64 * @since 1.4.0 65 * 66 * @return ModelInterface The model. 67 */ 68 public function getModel(): ModelInterface 69 { 70 return $this->model; 71 } 72 /** 73 * Gets the capability that was used for generation. 74 * 75 * @since 1.4.0 76 * 77 * @return CapabilityEnum The capability. 78 */ 79 public function getCapability(): CapabilityEnum 80 { 81 return $this->capability; 82 } 83 /** 84 * Gets the result from the model. 85 * 86 * @since 1.4.0 87 * 88 * @return EmbeddingResult The result. 89 */ 90 public function getResult(): EmbeddingResult 91 { 92 return $this->result; 93 } 94 /** 95 * Performs a deep clone of the event. 96 * 97 * @since 1.4.0 98 */ 99 public function __clone() 100 { 101 $clonedInputs = []; 102 foreach ($this->inputs as $input) { 103 $clonedInputs[] = clone $input; 104 } 105 $this->inputs = $clonedInputs; 106 $this->result = clone $this->result; 107 } 108 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Wed Oct 14 08:20:33 2026 | Cross-referenced by PHPXref |