ChatRequestBody

sttp.openai.requests.completions.chat.ChatRequestBody

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

case class Audio(voice: Voice, format: Format)

Value parameters

format

Specifies the output audio format. Must be one of wav, mp3, flac, opus, or pcm16.

voice

The voice the model uses to respond. Supported voices are ash, ballad, coral, sage, and verse (also supported but not recommended are alloy, echo, and shimmer; these voices are less expressive).

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Audio

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Audio.type
case class ChatBody(messages: Seq[Message], model: ChatCompletionModel, frequencyPenalty: Option[Double], logitBias: Option[Map[String, Float]], maxTokens: Option[Int], n: Option[Int], presencePenalty: Option[Double], responseFormat: Option[ResponseFormat], seed: Option[Int], stop: Option[Stop], temperature: Option[Double], topP: Option[Double], tools: Option[Seq[Tool]], toolChoice: Option[ToolChoice], user: Option[String], store: Option[Boolean], reasoningEffort: Option[ReasoningEffort], metadata: Option[Map[String, String]], logprobs: Option[Boolean], topLogprobs: Option[Int], maxCompletionTokens: Option[Int], modalities: Option[Seq[String]], serviceTier: Option[String], parallelToolCalls: Option[Boolean], streamOptions: Option[StreamOptions], prediction: Option[Prediction], audio: Option[Audio])

Value parameters

audio

Parameters for audio output. Required when audio output is requested with modalities: ["audio"].

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.

logitBias

Modify the likelihood of specified tokens appearing in the completion.

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.

maxCompletionTokens

An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.

maxTokens

The maximum number of tokens to generate in the chat completion.

messages

A list of messages describing the conversation so far.

metadata

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

modalities

Output types that you would like the model to generate for this request. Most models are capable of generating text, which is the default: ["text"]. The gpt-4o-audio-preview model can also be used to generate audio. To request that this model generate both text and audio responses, you can use: ["text", "audio"].

model

ID of the model to use.

n

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

parallelToolCalls

Whether to enable parallel function calling during tool use.

prediction

Configuration for a Predicted Output, which can greatly improve response times when large parts of the model response are known ahead of time. This is most common when you are regenerating a file with only minor changes to most of the content.

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.

reasoningEffort

Constrains effort on reasoning for reasoning models. Currently supported values are low, medium, and high. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.

responseFormat

An object specifying the format that the model must output. Setting to {"type": "json_object"} enables JSON mode, which guarantees the message the model generates is valid JSON.

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.

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', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted.
  • If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarantee.
  • If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarantee.
  • When not set, the default behavior is 'auto'.
stop

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

store

Whether or not to store the output of this chat completion request for use in our model distillation or evals products.

streamOptions

Options for streaming response. Only set this when you set stream: true.

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.

toolChoice

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

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.

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.

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.

user

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

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ChatBody

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
ChatBody.type
sealed abstract class ChatCompletionModel(val value: String)

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object GPT35Turbo
object GPT4
object GPT40314
object GPT432k
object GPT432k0314
object GPT4Turbo
object GPT4o
object GPT4oMini
Show all

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
object Content

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Content.type
sealed trait Content

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
case class ContentPart(`type`: String, text: String)

An array of content parts with a defined type. Supported options differ based on the model being used to generate the response. Can contain text inputs.

An array of content parts with a defined type. Supported options differ based on the model being used to generate the response. Can contain text inputs.

Value parameters

`type`

The type of the content part.

text

The text content.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ContentPart

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed abstract class Format(val value: String)

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class CustomFormat
object Flac
object Mp3
object Opus
object Pcm16
object Wav
Show all
object Format

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Format.type
case class MultipartContent(value: Seq[ContentPart]) extends Content

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Content
class Object
trait Matchable
class Any
Show all
case class Prediction(`type`: String, content: Content)

Value parameters

`type`

The type of the predicted content you want to provide. This type is currently always content.

content

The content that should be matched when generating a model response. If generated tokens would match this content, the entire model response can be returned much more quickly.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Prediction

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Prediction.type
sealed abstract class ReasoningEffort(val value: String)

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object High
object Low
object Medium

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait ResponseFormat

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object JsonObject
class JsonSchema
object Text
case class SingleContent(value: String) extends Content

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Content
class Object
trait Matchable
class Any
Show all
case class StreamOptions(includeUsage: Option[Boolean])

Value parameters

includeUsage

If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field, but with a null value.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object StreamOptions

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class UpdateChatCompletionRequestBody(metadata: Map[String, String])

Value parameters

metadata

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed abstract class Voice(val value: String)

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Alloy
object Ash
object Ballad
object Coral
class CustomVoice
object Echo
object Sage
object Shimmer
object Verse
Show all
object Voice

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Voice.type