AiClient::setEventDispatcher( WordPressAiClientDependenciesPsrEventDispatcherEventDispatcherInterface|null $dispatcher ): void

In this article

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.

Return

void

Source

public static function setEventDispatcher(?EventDispatcherInterface $dispatcher): void
{
    self::$eventDispatcher = $dispatcher;
}

Changelog

VersionDescription
0.4.0Introduced.

User Contributed Notes

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