Package-level declarations

Types

Link copied to clipboard

Assistant message builder.

Link copied to clipboard
@Serializable
data class ChatChoice(val index: Int, val message: ChatMessage, val finishReason: FinishReason? = null, val logprobs: Logprobs? = null)

A completion generated by OpenAI.

Link copied to clipboard
@Serializable
data class ChatChunk(val index: Int, val delta: ChatDelta, val finishReason: FinishReason?)

A completion generated by OpenAI.

Link copied to clipboard
@Serializable
data class ChatCompletion(val id: String, val created: Long, val model: ModelId, val choices: List<ChatChoice>, val usage: Usage? = null, val systemFingerprint: String? = null)

An object containing a response from the chat completion api.

Link copied to clipboard
@Serializable
data class ChatCompletionChunk(val id: String, val created: Int, val model: ModelId, val choices: List<ChatChunk>, val usage: Usage? = null, val systemFingerprint: String? = null)

An object containing a response from the chat stream completion api.

Link copied to clipboard
@Serializable
data class ChatCompletionFunction(val name: String, val description: String? = null, val parameters: Parameters)
Link copied to clipboard
Link copied to clipboard
@Serializable
class ChatCompletionRequest(val model: ModelId, val messages: List<ChatMessage>, val temperature: Double? = null, val topP: Double? = null, val n: Int? = null, val stop: List<String>? = null, val maxTokens: Int? = null, val presencePenalty: Double? = null, val frequencyPenalty: Double? = null, val logitBias: Map<String, Int>? = null, val user: String? = null, val functions: List<ChatCompletionFunction>? = null, val functionCall: FunctionMode? = null, val responseFormat: ChatResponseFormat? = null, val tools: List<Tool>? = null, val toolChoice: ToolChoice? = null, val seed: Int? = null, val logprobs: Boolean? = null, val topLogprobs: Int? = null)

Creates a completion for the chat message.

Link copied to clipboard

Creates a completion for the chat message.

Link copied to clipboard
@Serializable
data class ChatDelta(val role: ChatRole? = null, val content: String? = null, val functionCall: FunctionCall? = null, val toolCalls: List<ToolCallChunk>? = null, val toolCallId: ToolId? = null)

Generated chat message.

Link copied to clipboard
@Serializable
data class ChatMessage(val role: ChatRole, val messageContent: Content? = null, val name: String? = null, val functionCall: FunctionCall? = null, val toolCalls: List<ToolCall>? = null, val toolCallId: ToolId? = null)

The messages to generate chat completions for.

Link copied to clipboard

Builder of ChatMessageBuilder instances.

Link copied to clipboard

Creates a list of ChatMessage.

Link copied to clipboard
@Serializable
data class ChatResponseFormat(val type: String)

An object specifying the format that the model must output.

Link copied to clipboard
typealias ChatRole = Role

The role of the author of a message.

Link copied to clipboard
@Serializable(with = ContentSerializer::class)
interface Content

The contents of the chat message.

Link copied to clipboard
@Serializable
interface ContentPart

Represents a chat message part.

Link copied to clipboard
Link copied to clipboard
@Serializable
data class FunctionCall(val nameOrNull: String? = null, val argumentsOrNull: String? = null)

Represents a function invocation with its name and serialized arguments as generated by the model.

Link copied to clipboard
@Serializable(with = FunctionModeSerializer::class)
interface FunctionMode

This interface determines how the model handles function calls.

Link copied to clipboard
Link copied to clipboard
@Serializable
data class FunctionTool(val name: String, val parameters: Parameters? = null, val description: String? = null)

A description of what the function does, used by the model to choose when and how to call the function.

Link copied to clipboard

Tool call builder.

Link copied to clipboard
@Serializable
data class FunctionToolChoice(val name: String)

Represents the function to call by the model.

Link copied to clipboard
@Serializable
data class ImagePart(val imageUrl: ImagePart.ImageURL) : ContentPart

Image content part.

Link copied to clipboard
@Serializable
value class ListContent(val content: List<ContentPart>) : Content

The chat message content as a list of content parts.

Link copied to clipboard
@Serializable
data class Logprobs(val content: List<LogprobsContent>? = null)

An object containing log probability information for the choice.

Link copied to clipboard
@Serializable
data class LogprobsContent(val token: String, val logprob: Double, val bytes: List<Int>? = null, val topLogprobs: List<TopLogprob>)

An object containing logprobs for a single token

Link copied to clipboard

Represents parameters that a function accepts, described as a JSON Schema object.

Link copied to clipboard

System message builder.

Link copied to clipboard
@Serializable
value class TextContent(val content: String) : Content

The chat message content as text.

Link copied to clipboard
@Serializable
data class TextPart(val text: String) : ContentPart

Text content part.

Link copied to clipboard
@Serializable
data class Tool(val type: ToolType, val function: FunctionTool)

A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for.

Link copied to clipboard

Creates a list of Tool.

Link copied to clipboard
@Serializable
interface ToolCall

Details of the tool call.

Link copied to clipboard
@Serializable
data class ToolCallChunk(val index: Int, val type: String? = null, val id: ToolId? = null, val function: FunctionCall? = null)

Details of the tool call chunk.

Link copied to clipboard

List of tool calls builder.

Link copied to clipboard
@Serializable(with = ToolChoiceSerializer::class)
interface ToolChoice

Controls which (if any) function is called by the model.

Link copied to clipboard
@Serializable
value class ToolId(val id: String)

The ID of the tool call.

Link copied to clipboard

Tool message builder.

Link copied to clipboard
@Serializable
value class ToolType(val value: String)

The type of the tool.

Link copied to clipboard
@Serializable
data class TopLogprob(val token: String, val logprob: Double, val bytes: List<Int>? = null)

An object containing a token and their log probability.

Link copied to clipboard

User message builder.

Functions

Link copied to clipboard

Assistant chat message.

Link copied to clipboard

The function to generate chat completion function instances.

Link copied to clipboard

The messages to generate chat completions for.

Link copied to clipboard

The messages to generate chat completions for.

Link copied to clipboard

Tool: function call.

Link copied to clipboard

System chat message.

Link copied to clipboard

Tool chat message.

Link copied to clipboard

User chat message.