WordPress\AiClient\Builders

PromptBuilder::withHistory │ public │ WP 0.1.0

Adds conversation history messages.

Historical messages are prepended to the beginning of the message list, before the current message being built.

Method of the class: PromptBuilder{}

No Hooks.

Returns

self.

Usage

$PromptBuilder = new PromptBuilder();
$PromptBuilder->withHistory( Message ...$messages ): self;
Message ...$messages(required)
.

Changelog

Since 0.1.0 Introduced.

PromptBuilder::withHistory() code WP 7.1.2

public function withHistory(Message ...$messages): self
{
    // Prepend the history messages to the beginning of the messages array
    $this->messages = array_merge($messages, $this->messages);
    return $this;
}