Package-level declarations

Types

Link copied to clipboard
interface Assistants

Build assistants that can call models and use tools to perform tasks.

Link copied to clipboard
interface Audio

Learn how to turn audio into text.

Link copied to clipboard
interface Batch

Create large batches of API requests for asynchronous processing. The Batch API returns completions within 24 hours for a 50% discount.

Link copied to clipboard
interface Chat

Given a chat conversation, the model will return a chat completion response.

Link copied to clipboard
interface Completions

Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.

Link copied to clipboard
interface Edits

Given a prompt and an instruction, the model will return an edited version of the prompt.

Link copied to clipboard
interface Embeddings

Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.

Link copied to clipboard
interface Files

Files are used to upload documents that can be used across features like Answers, Searches, and Classifications

Link copied to clipboard
interface FineTunes

Manage fine-tuning jobs to tailor a model to your specific training data.

Link copied to clipboard
interface FineTuning

Manage fine-tuning jobs to tailor a model to your specific training data.

Link copied to clipboard
interface Images

Given a prompt and/or an input image, the model will generate a new image.

Link copied to clipboard
class LoggingConfig(val logLevel: LogLevel = LogLevel.Headers, val logger: Logger = Logger.Simple, val sanitize: Boolean = true)

Defines the configuration parameters for logging.

Link copied to clipboard
interface Messages

Create messages within threads

Link copied to clipboard
interface Models

List and describe the various models available in the API. You can refer to the Models documentation to understand what models are available and the differences between them.

Link copied to clipboard
interface Moderations

Given an input text, outputs if the model classifies it as violating OpenAI's content policy.

Link copied to clipboard
class OpenAIConfig(val token: String, val logging: LoggingConfig = LoggingConfig(), val timeout: Timeout = Timeout(socket = 30.seconds), val organization: String? = null, val headers: Map<String, String> = emptyMap(), val host: OpenAIHost = OpenAIHost.OpenAI, val proxy: ProxyConfig? = null, val retry: RetryStrategy = RetryStrategy(), val engine: HttpClientEngine? = null, val httpClientConfig: HttpClientConfig<*>.() -> Unit = {})

OpenAI client configuration.

Link copied to clipboard
class OpenAIHost(val baseUrl: String, val queryParams: Map<String, String> = emptyMap())

A class to configure the OpenAI host. It provides a mechanism to customize the base URL and additional query parameters used in OpenAI API requests.

Link copied to clipboard
sealed interface ProxyConfig

Proxy configuration.

Link copied to clipboard
class RetryStrategy(val maxRetries: Int = 3, val base: Double = 2.0, val maxDelay: Duration = 60.seconds)

Specifies the retry strategy

Link copied to clipboard
interface Runs

Represents an execution run on a thread.

Link copied to clipboard
interface Threads

Create threads that assistants can interact with.

Link copied to clipboard
interface VectorStores

Vector stores are used to store files for use by the file_search tool.

Functions

Link copied to clipboard
fun OpenAI(config: OpenAIConfig): OpenAI
fun OpenAI(token: String, logging: LoggingConfig = LoggingConfig(), timeout: Timeout = Timeout(socket = 30.seconds), organization: String? = null, headers: Map<String, String> = emptyMap(), host: OpenAIHost = OpenAIHost.OpenAI, proxy: ProxyConfig? = null, retry: RetryStrategy = RetryStrategy(), httpClientConfig: HttpClientConfig<*>.() -> Unit = {}): OpenAI

Creates an instance of OpenAI.