Message

Message

Message payload sent to OpenAI API. A message consists of a role, content, and timestamp.

Constructor

new Message(role, content, timestampopt)

Initializes a new Message instance.
Source:
Parameters:
Name Type Attributes Default Description
role string Message role such as `user`, `assistant`, or `developer`.
content string Message content.
timestamp number <optional>
Date.now() Unix timestamp in milliseconds.

Methods

getContent() → {string}

Retrieve the content of the message.
Source:
Returns:
Type:
string
Message content.

getRole() → {string}

Retrieve the role of the message.
Source:
Returns:
Type:
string
Message role.

getTimestamp() → {number}

Retrieve the timestamp of the message.
Source:
Returns:
Type:
number
Unix timestamp in milliseconds.