commonMain.com.xebia.functional.openai.generated.model.CreateChatCompletionRequest.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xef-openai-client-jvm Show documentation
Show all versions of xef-openai-client-jvm Show documentation
Building applications with LLMs through composability in Kotlin
/**
*
* Please note:
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* Do not edit this file manually.
*
*/
@file:Suppress(
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport"
)
package com.xebia.functional.openai.generated.model
import com.xebia.functional.openai.generated.model.ChatCompletionFunctions
import com.xebia.functional.openai.generated.model.ChatCompletionRequestMessage
import com.xebia.functional.openai.generated.model.ChatCompletionStreamOptions
import com.xebia.functional.openai.generated.model.ChatCompletionTool
import com.xebia.functional.openai.generated.model.ChatCompletionToolChoiceOption
import com.xebia.functional.openai.generated.model.CreateChatCompletionRequestFunctionCall
import com.xebia.functional.openai.generated.model.CreateChatCompletionRequestModel
import com.xebia.functional.openai.generated.model.CreateChatCompletionRequestResponseFormat
import com.xebia.functional.openai.generated.model.CreateChatCompletionRequestStop
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerialName
import kotlinx.serialization.Contextual
import kotlin.js.JsName
import kotlinx.serialization.json.*
/**
*
*
* @param messages A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models).
* @param model
* @param frequencyPenalty 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. [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details)
* @param logitBias Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.
* @param logprobs 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`.
* @param topLogprobs 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.
* @param maxTokens The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.
* @param n How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs.
* @param presencePenalty 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. [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details)
* @param responseFormat
* @param seed This feature is in Beta. If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.
* @param serviceTier Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service: - If set to 'auto', the system will utilize scale tier credits until they are exhausted. - If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - When not set, the default behavior is 'auto'. When this parameter is set, the response body will include the `service_tier` utilized.
* @param stop
* @param stream If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).
* @param streamOptions
* @param temperature 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. We generally recommend altering this or `top_p` but not both.
* @param topP 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. We generally recommend altering this or `temperature` but not both.
* @param tools A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
* @param toolChoice
* @param parallelToolCalls Whether to enable [parallel function calling](/docs/guides/function-calling/parallel-function-calling) during tool use.
* @param user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
* @param functionCall
* @param functions Deprecated in favor of `tools`. A list of functions the model may generate JSON inputs for.
*/
@Serializable
data class CreateChatCompletionRequest (
/* A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models). */
@SerialName(value = "messages") val messages: kotlin.collections.List,
@SerialName(value = "model") val model: CreateChatCompletionRequestModel,
/* 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. [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) */
@SerialName(value = "frequency_penalty") val frequencyPenalty: kotlin.Double? = (0).toDouble(),
/* Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. */
@SerialName(value = "logit_bias") val logitBias: kotlin.collections.Map? = null,
/* 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`. */
@SerialName(value = "logprobs") val logprobs: kotlin.Boolean? = false,
/* 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. */
@SerialName(value = "top_logprobs") val topLogprobs: kotlin.Int? = null,
/* The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. */
@SerialName(value = "max_tokens") val maxTokens: kotlin.Int? = null,
/* How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. */
@SerialName(value = "n") val n: kotlin.Int? = 1,
/* 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. [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) */
@SerialName(value = "presence_penalty") val presencePenalty: kotlin.Double? = (0).toDouble(),
@SerialName(value = "response_format") val responseFormat: CreateChatCompletionRequestResponseFormat? = null,
/* This feature is in Beta. If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. */
@SerialName(value = "seed") val seed: kotlin.Int? = null,
/* Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service: - If set to 'auto', the system will utilize scale tier credits until they are exhausted. - If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - When not set, the default behavior is 'auto'. When this parameter is set, the response body will include the `service_tier` utilized. */
@SerialName(value = "service_tier") val serviceTier: CreateChatCompletionRequest.ServiceTier? = null,
@SerialName(value = "stop") val stop: CreateChatCompletionRequestStop? = null,
/* If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). */
@SerialName(value = "stream") val stream: kotlin.Boolean? = false,
@SerialName(value = "stream_options") val streamOptions: ChatCompletionStreamOptions? = null,
/* 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. We generally recommend altering this or `top_p` but not both. */
@SerialName(value = "temperature") val temperature: kotlin.Double? = (1).toDouble(),
/* 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. We generally recommend altering this or `temperature` but not both. */
@SerialName(value = "top_p") val topP: kotlin.Double? = (1).toDouble(),
/* A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. */
@SerialName(value = "tools") val tools: kotlin.collections.List? = null,
@SerialName(value = "tool_choice") val toolChoice: ChatCompletionToolChoiceOption? = null,
/* Whether to enable [parallel function calling](/docs/guides/function-calling/parallel-function-calling) during tool use. */
@SerialName(value = "parallel_tool_calls") val parallelToolCalls: kotlin.Boolean? = true,
/* A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). */
@SerialName(value = "user") val user: kotlin.String? = null,
@Deprecated(message = "This property is deprecated.")
@SerialName(value = "function_call") val functionCall: CreateChatCompletionRequestFunctionCall? = null,
/* Deprecated in favor of `tools`. A list of functions the model may generate JSON inputs for. */
@Deprecated(message = "This property is deprecated.")
@SerialName(value = "functions") val functions: kotlin.collections.List? = null
) {
/**
* Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service: - If set to 'auto', the system will utilize scale tier credits until they are exhausted. - If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - When not set, the default behavior is 'auto'. When this parameter is set, the response body will include the `service_tier` utilized.
*
* Values: auto,default
*/
@Serializable
enum class ServiceTier(val value: kotlin.String) {
@SerialName(value = "auto") auto("auto"),
@SerialName(value = "default") default("default");
}
}