OpenAIImpl

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

Inheritors

Constructors

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

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
@ApiStatus.Experimental
@Contract(pure = true)
open fun assistants(): AssistantHandler

Returns the handler for the assistants endpoint. This method is purely syntactic sugar for Java users.

Link copied to clipboard
open override fun createChatCompletion(request: ChatRequest): ChatResponse

Calls the chat completions API endpoint. This method is blocking.

Link copied to clipboard

Calls the completions API endpoint. This method is blocking.

Link copied to clipboard

Calls the embeddings API endpoint to generate the vector representation of text. The returned vector can be used in Machine Learning models. This method is blocking.

Link copied to clipboard
@Contract(pure = true)
open fun files(): FileHandler

Returns the handler for the files endpoint. This method is purely syntactic sugar for Java users.

Link copied to clipboard

Calls the chat completions API endpoint and streams each token 1 at a time for a faster response.

Link copied to clipboard

Extension function to stream a chat completion using kotlin coroutines.

Link copied to clipboard

Calls the completions API endpoint and streams each token 1 at a time for a faster response time.

Link copied to clipboard

Extension function to stream a completion using kotlin coroutines.

Link copied to clipboard
@ApiStatus.Experimental
@Contract(pure = true)
open fun threads(): ThreadHandler

Returns the handler for the threads endpoint. This method is purely syntactic sugar for Java users.

Properties

Link copied to clipboard
open override val assistants: AssistantHandler

Returns the handler for the assistants endpoint. This handler can be used to create, retrieve, and delete assistants.

Link copied to clipboard
open override val files: FileHandler

Returns the handler for the files endpoint. This handler can be used to create, retrieve, and delete files.

Link copied to clipboard
open override val threads: ThreadHandler

Returns the handler for the threads endpoint. This handler can be used to create, retrieve, and delete threads.