OpenAIMessage

Represents a message in the OpenAI chat completion API.

Each message type has specific roles and capabilities:

Inheritors

Types

Link copied to clipboard
@SerialName(value = "assistant")
class Assistant(val content: Content? = null, val audio: OpenAIAudio? = null, val name: String? = null, val refusal: String? = null, val toolCalls: List<OpenAIToolCall>? = null, val annotations: List<OpenAIWebUrlCitation>? = null) : OpenAIMessage

Messages sent by the model in response to user messages.

Link copied to clipboard
@SerialName(value = "developer")
class Developer(val content: Content, val name: String? = null) : OpenAIMessage

Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, developer messages replace the previous system messages.

Link copied to clipboard
@SerialName(value = "system")
class System(val content: Content, val name: String? = null) : OpenAIMessage

Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, use developer messages for this purpose instead.

Link copied to clipboard
@SerialName(value = "tool")
class Tool(val content: Content, val toolCallId: String) : OpenAIMessage
Link copied to clipboard
@SerialName(value = "user")
class User(val content: Content, val name: String? = null) : OpenAIMessage

Messages sent by an end user, containing prompts or additional context information.

Properties

Link copied to clipboard
abstract val content: Content?

The content of the message.