Package-level declarations

Types

Link copied to clipboard
data class AudioInputObject(val data: String, val format: String)

Represents an audio input object.

Link copied to clipboard
data class CallableFunction(val name: String, val arguments: String)

Represents a function that can be called by the AI model.

Link copied to clipboard
data class ChatCompletionRequest(val messages: List<Message>, val model: String, val store: Boolean = false, val reasoningEffort: String = "medium", val metadata: Metadata? = null, val maxCompletionTokens: Int? = null, val frequencyPenalty: Double? = 0.0, val presencePenalty: Double? = 0.0, val responseFormat: ResponseFormat? = null, val temperature: Double = 1.0, val topP: Double? = 1.0, val n: Int? = 1, val stop: List<String>? = null, val logitBias: Map<String, Int>? = null, val user: String? = null, val seed: Int? = null, val stream: Boolean = false, val streamOptions: ChatCompletionStreamOptions? = null, val tools: List<Tool>? = null, val toolChoice: ToolChoice? = null)

Represents a request for generating a chat-based completions in an OpenAI-like environment. See Create chat completions.

Link copied to clipboard

Builder class for creating ChatCompletionRequest instances.

Link copied to clipboard
data class ChatResponse(val id: String, val objectType: String = "chat.completions", val created: Long, val model: String, val serviceTier: String? = null, val systemFingerprint: String? = null, val usage: Usage, val choices: List<Choice>)

Represents a response to a chat completion request.

Link copied to clipboard
data class Choice(val index: Int, val delta: Delta? = null, val message: Message? = null, val logprobs: String? = null, val finishReason: String? = null)

Represents a choice in a completion response.

Link copied to clipboard
data class Chunk(val id: String, val objectType: String = "chat.completion.chunk", val created: Long, val model: String, val serviceTier: String? = null, val systemFingerprint: String, val usage: Usage? = null, val choices: List<Choice>)

Represents a chunk of a streaming response.

Link copied to clipboard
data class CompletionTokensDetails(val reasoningTokens: Int, val acceptedPredictionTokens: Int, val rejectedPredictionTokens: Int)

Represents details about completion tokens.

Link copied to clipboard

Represents a content part in a message.

Link copied to clipboard
data class Delta(val role: ChatCompletionRole? = null, val content: String? = null)

Represents a delta in a streaming response.

Link copied to clipboard
data class FunctionObject(val name: String, val description: String? = null, val parameters: JsonElement? = null, val strict: Boolean? = false)

Represents a function that can be called by the model.

Link copied to clipboard
data class ImageUrlObject(val url: String, val detail: String? = null)

Represents an image URL object.

Link copied to clipboard
data class Message(val role: ChatCompletionRole, val content: MessageContent, val refusal: String? = null, val toolCalls: List<ToolCall>? = null, val name: String? = null, val toolCallId: String? = null)

Represents a message in a chat conversation.

Link copied to clipboard

Represents the content of a message, which can be either a simple string or an array of content parts.

Link copied to clipboard

Custom serializer for MessageContent that handles both string and array formats.

Link copied to clipboard
data class Metadata(val tags: Map<String, String>? = null)

Represents metadata for a request.

Link copied to clipboard
Link copied to clipboard
data class TokenDetails(val cachedTokens: Int? = null)

Represents details about tokens.

Link copied to clipboard
data class Tool(val type: String = "function", val function: FunctionObject)

Represents a tool that can be used by the model.

Link copied to clipboard
data class ToolCall(val id: String, val type: String = "function", val function: CallableFunction)

Represents a tool call made by the model.

Link copied to clipboard

Represents a sealed class that defines choices for tools used in a process or operation.

Link copied to clipboard
data class ToolChoiceFunction(val name: String)

Represents a function that the model should call.

Link copied to clipboard

Custom serializer for ToolChoice that handles both string and object formats.

Link copied to clipboard
data class Usage(val promptTokens: Int, val completionTokens: Int, val totalTokens: Int, val completionTokensDetails: CompletionTokensDetails, val promptTokensDetails: TokenDetails? = null)

Represents usage statistics for a completion.