Content

Represents the content of a message in the OpenAI chat completion API. Can be either a simple text message or a complex content consisting of multiple parts.

This sealed interface has two implementations:

  • Text - For simple text content

  • Parts - For complex content containing multiple parts (text, images, audio, files)

Inheritors

Types

Link copied to clipboard

An array of content parts with a defined type. Supported options differ based on the model being used to generate the response. Can contain text, image or audio inputs.

Link copied to clipboard
value class Text(val value: String) : Content

The contents of the message.

Functions

Link copied to clipboard
abstract fun text(): String

The simple text content of the message.