ChatCompletionRequestBuilder

Creates a completion for the chat message.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.

Link copied to clipboard

Controls how the model responds to function calls. FunctionMode.None means the model does not call a function, and responds to the end-user. FunctionMode.Auto means the model can pick between an end-user or calling a function. Specifying a particular function via FunctionMode.Named forces the model to call that function. FunctionMode.None is the default when no functions are present. FunctionMode.Auto is the default if functions are present.

Link copied to clipboard

A list of functions the model may generate JSON inputs for.

Link copied to clipboard

A unique identifier representing the Multi LORA reserved instance.

Link copied to clipboard

Modify the likelihood of specified tokens appearing in the completion.

Link copied to clipboard

Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message.

Link copied to clipboard

The maximum number of tokens allowed for the generated answer. By default, the number of tokens the model can return will be (4096 - prompt tokens).

Link copied to clipboard

The messages to generate chat completions for.

Link copied to clipboard

ID of the model to use.

Link copied to clipboard
var n: Int?

How many chat completion choices to generate for each input message.

Link copied to clipboard

Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.

Link copied to clipboard

An object specifying the format that the model must output.

Link copied to clipboard

Up to 4 sequences where the API will stop generating further tokens.

Link copied to clipboard

Options for streaming response. Only used when in streaming mode.

Link copied to clipboard

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

Link copied to clipboard

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

Link copied to clipboard
var tools: List<Tool>?

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

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used.

Link copied to clipboard
var topP: Double?

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

Link copied to clipboard
var user: String?

A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.

Functions

Link copied to clipboard
Link copied to clipboard
fun functions(block: FunctionsBuilder.() -> Unit)

A list of functions the model may generate JSON inputs for.

Link copied to clipboard

The messages to generate chat completions for.

Link copied to clipboard
fun tools(block: ToolBuilder.() -> Unit)

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