Sets the event dispatcher for prompt lifecycle events.
Description
The event dispatcher will be used to dispatch BeforeGenerateResultEvent and AfterGenerateResultEvent during prompt generation.
Parameters
$dispatcherWordPressAiClientDependenciesPsrEventDispatcherEventDispatcherInterface|nullrequired- The event dispatcher, or null to disable.
Source
public static function setEventDispatcher(?EventDispatcherInterface $dispatcher): void
{
self::$eventDispatcher = $dispatcher;
}
Changelog
| Version | Description |
|---|---|
| 0.4.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.