PromptBuilder::withHistory( WordPressAiClientMessagesDTOMessage $messages ): self

In this article

Adds conversation history messages.

Description

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

Parameters

$messagesWordPressAiClientMessagesDTOMessagerequired
The messages to add to history.

Return

self

Source

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;
}

Changelog

VersionDescription
0.1.0Introduced.

User Contributed Notes

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