Message
Defined in: src/types/messages.ts:32
A message in a conversation between user and assistant. Each message has a role (user or assistant) and an array of content blocks.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Message(data): Message;Defined in: src/types/messages.ts:48
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data | { role: Role; content: ContentBlock[]; } |
data.role | Role |
data.content | ContentBlock[] |
Returns
Section titled “Returns”Message
Properties
Section titled “Properties”readonly type: "message";Defined in: src/types/messages.ts:36
Discriminator for message type.
readonly role: Role;Defined in: src/types/messages.ts:41
The role of the message sender.
content
Section titled “content”readonly content: ContentBlock[];Defined in: src/types/messages.ts:46
Array of content blocks that make up this message.
Methods
Section titled “Methods”fromMessageData()
Section titled “fromMessageData()”static fromMessageData(data): Message;Defined in: src/types/messages.ts:56
Creates a Message instance from MessageData.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data | MessageData |
Returns
Section titled “Returns”Message