class Chat implements AgentInput

Methods

__construct(array $messages)

Create a chat input.

message()

Get the newest user message, if the input contains one.

Decisions|null
decisions()

Get the tool approval decisions from the newest assistant message, if the input contains any.

array
history()

Get every turn before the one this input resolves to.

string|null
messageId()

Get the ID of the assistant message the response continues, if any.

protocol()

Get the stream protocol for the chat.

array
precedingMessages()

Get the raw messages preceding the turn this input resolves to.

static array|null
latestOfRole(array $messages, string $role)

Get the newest of the given messages when it matches the given role.

Details

at line 20
__construct(array $messages)

Create a chat input.

Parameters

array $messages

at line 27
UserMessage|null message()

Get the newest user message, if the input contains one.

Return Value

UserMessage|null

at line 39
Decisions|null decisions()

Get the tool approval decisions from the newest assistant message, if the input contains any.

Return Value

Decisions|null

at line 53
array history()

Get every turn before the one this input resolves to.

Return Value

array

at line 61
string|null messageId()

Get the ID of the assistant message the response continues, if any.

Return Value

string|null

at line 71
VercelDataProtocol protocol()

Get the stream protocol for the chat.

Return Value

VercelDataProtocol

at line 81
protected array precedingMessages()

Get the raw messages preceding the turn this input resolves to.

Return Value

array

at line 94
static protected array|null latestOfRole(array $messages, string $role)

Get the newest of the given messages when it matches the given role.

Parameters

array $messages
string $role

Return Value

array|null