[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/php-ai-client/src/Messages/DTO/ -> Message.php (summary)

(no description)

File Size: 173 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Message:: (9 methods):
  __construct()
  getRole()
  getParts()
  withPart()
  validateParts()
  getJsonSchema()
  toArray()
  fromArray()
  __clone()


Class: Message  - X-Ref

Represents a message in an AI conversation.

Messages are the fundamental unit of communication with AI models,
containing a role and one or more parts with different content types.

__construct(MessageRoleEnum $role, array $parts)   X-Ref
Constructor.

param: MessageRoleEnum $role The role of the message sender.
param: MessagePart[] $parts The parts that make up this message.

getRole()   X-Ref
Gets the role of the message sender.

return: MessageRoleEnum The role.

getParts()   X-Ref
Gets the message parts.

return: MessagePart[] The message parts.

withPart(\WordPress\AiClient\Messages\DTO\MessagePart $part)   X-Ref
Returns a new instance with the given part appended.

return: Message A new instance with the part appended.
param: MessagePart $part The part to append.

validateParts()   X-Ref
Validates that the message parts are appropriate for the message role.

return: void

getJsonSchema()   X-Ref
{@inheritDoc}


toArray()   X-Ref
{@inheritDoc}

return: MessageArrayShape

fromArray(array $array)   X-Ref
{@inheritDoc}

return: self The specific message class based on the role.

__clone()   X-Ref
Performs a deep clone of the message.

This method ensures that message part objects are cloned to prevent
modifications to the cloned message from affecting the original.




Generated : Sat Jun 13 09:38:55 2026 Cross-referenced by PHPXref