Package-level declarations

Types

Link copied to clipboard
data class CompletionChoice(val text: String, val index: Int, val logprobs: List<Float>?, val finishReason: FinishReason)

The OpenAI API returns a list of CompletionChoice. Each choice has a generated message (CompletionChoice.text) and a finish reason (CompletionChoice.finishReason). For most use cases, you only need the generated text.

Link copied to clipboard
data class CompletionChoiceChunk(val text: String, val index: Int, val logprobs: List<Float>?, val finishReason: FinishReason?)

The OpenAI API returns a list of CompletionChoice. Each choice has a generated message (CompletionChoice.text) and a finish reason (CompletionChoice.finishReason). For most use cases, you only need the generated text.

Link copied to clipboard
data class CompletionRequest @JvmOverloads constructor(var model: String, var prompt: Any? = null, var suffix: String? = null, var maxTokens: Int? = null, var temperature: Number? = null, var topP: Number? = null, var n: Int? = null, var stream: Boolean? = null, var logprobs: Int? = null, var echo: Boolean? = null, var stop: Any? = null, var presencePenalty: Number? = null, var frequencyPenalty: Number? = null, var bestOf: Int? = null, var logitBias: Map<String, Int>? = null, var user: String? = null)

Holds the configurable options that can be sent to the OpenAI Completions API. For most use cases, you only need to set model and prompt. For more detailed descriptions for each option, refer to the Completions Wiki.

Link copied to clipboard
data class CompletionResponse(val id: String, val created: Long, val model: String, val choices: List<CompletionChoice>, val usage: CompletionUsage)

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.

Link copied to clipboard
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.

Link copied to clipboard
data class CompletionUsage(val promptTokens: Int, val completionTokens: Int, val totalTokens: Int)

Holds how many tokens that were used by your API request. Use these tokens to calculate how much money you have spent on each request.

Functions

Link copied to clipboard