CompletionResponseChunk

data class CompletionResponseChunk(val id: String, val created: Long, val model: String, val choices: List<CompletionChoiceChunk>)

The CompletionResponse contains all the data returned by the OpenAI Completions API. For most use cases, CompletionResponse.get (passing 0 to the index argument) is all you need.

Constructors

Link copied to clipboard
constructor(id: String, created: Long, model: String, choices: List<CompletionChoiceChunk>)

Create Completion response (for internal usage)

Functions

Link copied to clipboard
operator fun get(index: Int): CompletionChoiceChunk

Shorthand for accessing the generated messages (shorthand for CompletionResponseChunk.choices).

Link copied to clipboard

Returns the Instant time that the OpenAI Completion API sent this response. The time is measured as a unix timestamp (measured in seconds since 00:00:00 UTC on January 1, 1970).

Link copied to clipboard
fun getZonedTime(timezone: ZoneId = TimeZone.getDefault().toZoneId()): ZonedDateTime

Returns the time-zoned instant that the OpenAI Completion API sent this response. By default, this method uses the system's timezone.

Properties

Link copied to clipboard

The generated completion(s).

Link copied to clipboard

The Unix timestamp (measured in seconds since 00:00:00 UTC on Junuary 1, 1970) when the API response was created.

Link copied to clipboard
val id: String

The unique id for your request.

Link copied to clipboard

The model used to generate the completion.