Package-level declarations

Types

Link copied to clipboard

An abstract builder type for list requests. Many objects stored by the OpenAI API are stored in lists. This abstract request stores the data that each request has in common.

Link copied to clipboard
class AzureOpenAI @ApiStatus.Internal constructor(apiKey: String, organization: String? = null, client: OkHttpClient = OkHttpClient(), baseUrl: String = "https://api.openai.com", apiVersion: String = "2023-03-15-preview", modelName: String = "") : OpenAIImpl

The Azure OpenAI API client.

Link copied to clipboard

FinishReason wraps the possible reasons that a generation model may stop generating tokens. For most PROPER use cases (see best practices), the finish reason will be STOP. When working with streams, finish reason will be null since it has not completed the message yet.

Link copied to clipboard

Represents the order for a list, sorted by time created. In general, since you probably want the most recent objects from the OpenAI API, you should use DESCENDING (which is the default value for all requests).

Link copied to clipboard
object Models

Holds all the available models for the OpenAI API. Most users are probably interested in Models.Chat.

Link copied to clipboard
interface OpenAI

The main interface for the OpenAI API. This interface contains methods for all the API endpoints. To instantiate an instance of this interface, use builder.

Link copied to clipboard
open class OpenAIImpl @ApiStatus.Internal constructor(apiKey: String, organization: String? = null, client: OkHttpClient = OkHttpClient(), baseUrl: String = "https://api.openai.com") : OpenAI
Link copied to clipboard
open class RequestHelper(apiKey: String, organization: String? = null, client: OkHttpClient = OkHttpClient(), baseUrl: String = "https://api.openai.com")

Functions

Link copied to clipboard
@Contract(pure = true)
fun azureOpenAI(init: OpenAI.AzureBuilder.() -> Unit): OpenAI

Builds an OpenAI instance using the Azure implementation.

Link copied to clipboard
@Contract(pure = true)
fun openAI(init: OpenAI.Builder.() -> Unit): OpenAI

Builds an OpenAI instance using the default implementation.