Represents a message in a chat. Can assume different roles, like user or assistant.

Static methods

staticAssistant(content:EitherType<String, Array<EitherType<LanguageModelTextPart, LanguageModelToolCallPart>>>, ?name:String):LanguageModelChatMessage

Utility to create a new assistant message.

Parameters:

content

The content of the message.

name

The optional name of a user for the message.

staticUser(content:EitherType<String, Array<EitherType<LanguageModelTextPart, LanguageModelToolResultPart>>>, ?name:String):LanguageModelChatMessage

Utility to create a new user message.

Parameters:

content

The content of the message.

name

The optional name of a user for the message.

Constructor

new(role:LanguageModelChatMessageRole, content:EitherType<String, Array<EitherType<LanguageModelTextPart, EitherType<LanguageModelToolResultPart, LanguageModelToolCallPart>>>>, ?name:String)

Create a new user message.

Parameters:

role

The role of the message.

content

The content of the message.

name

The optional name of a user for the message.

Variables

content:Array<EitherType<LanguageModelTextPart, EitherType<LanguageModelToolResultPart, LanguageModelToolCallPart>>>

A string or heterogeneous array of things that a message can contain as content. Some parts may be message-type specific for some models.

name:Null<String>

The optional name of a user for this message.

role:LanguageModelChatMessageRole

The role of this message.