Share via


ChatCompletionsOptions Class

  • java.lang.Object
    • com.azure.ai.openai.models.ChatCompletionsOptions

Implements

public final class ChatCompletionsOptions
implements JsonSerializable<ChatCompletionsOptions>

The configuration information for a chat completions request. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.

Constructor Summary

Constructor Description
ChatCompletionsOptions(List<ChatRequestMessage> messages)

Creates an instance of ChatCompletionsOptions class.

Method Summary

Modifier and Type Method and Description
static ChatCompletionsOptions fromJson(JsonReader jsonReader)

Reads an instance of ChatCompletionsOptions from the JsonReader.

AudioOutputParameters getAudio()

Get the audio property: Parameters for audio output.

List<AzureChatExtensionConfiguration> getDataSources()

Get the dataSources property: The configuration entries for Azure OpenAI chat extensions that use them.

AzureChatEnhancementConfiguration getEnhancements()

Get the enhancements property: If provided, the configuration options for available Azure OpenAI chat enhancements.

Double getFrequencyPenalty()

Get the frequencyPenalty property: A value that influences the probability of generated tokens appearing based on their cumulative frequency in generated text.

FunctionCallConfig getFunctionCall()

Get the functionCall property: Controls how the model responds to function calls.

List<FunctionDefinition> getFunctions()

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

Map<String,Integer> getLogitBias()

Get the logitBias property: A map between GPT token IDs and bias scores that influences the probability of specific tokens appearing in a completions response.

Integer getMaxCompletionTokens()

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

Integer getMaxTokens()

Get the maxTokens property: The maximum number of tokens allowed for the generated answer.

List<ChatRequestMessage> getMessages()

Get the messages property: The collection of context messages associated with this chat completions request.

Map<String,String> getMetadata()

Get the metadata property: Developer-defined tags and values used for filtering completions in the stored completions dashboard.

List<ChatCompletionModality> getModalities()

Get the modalities property: Output types that you would like the model to generate for this request.

String getModel()

Get the model property: The model name to provide as part of this completions request.

Integer getN()

Get the n property: The number of chat completions choices that should be generated for a chat completions response.

PredictionContent getPrediction()

Get the prediction property: Configuration for a Predicted Output, which can greatly improve response times when large parts of the model response are known ahead of time.

Double getPresencePenalty()

Get the presencePenalty property: A value that influences the probability of generated tokens appearing based on their existing presence in generated text.

ReasoningEffortValue getReasoningEffort()

Get the reasoningEffort property: This option is only valid for o1 models, Constrains effort on reasoning for reasoning models (see https://platform.openai.com/docs/guides/reasoning).

ChatCompletionsResponseFormat getResponseFormat()

Get the responseFormat property: An object specifying the format that the model must output.

Long getSeed()

Get the seed property: If specified, the system will make a best effort to sample deterministically such that repeated requests with the same seed and parameters should return the same result.

ServiceTierOptions getServiceTierOptions()

Get the ServiceTierOptions for this request.

List<String> getStop()

Get the stop property: A collection of textual sequences that will end completions generation.

ChatCompletionStreamOptions getStreamOptions()

Get the streamOptions property: Options for streaming response.

Double getTemperature()

Get the temperature property: The sampling temperature to use that controls the apparent creativity of generated completions.

ChatCompletionsToolSelection getToolChoice()

Get the toolChoice property: If specified, the model will configure which of the provided tools it can use for the chat completions response.

List<ChatCompletionsToolDefinition> getTools()

Get the tools property: The available tool definitions that the chat completions request can use, including caller-defined functions.

Integer getTopLogprobs()

Get the topLogprobs property: An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated log probability.

Double getTopP()

Get the topP property: An alternative to sampling with temperature called nucleus sampling.

String getUser()

Get the user property: An identifier for the caller or end user of the operation.

UserSecurityContext getUserSecurityContext()

Get the userSecurityContext property: The security context identifies and authenticates users and applications in your multi-tenant AI system, helping security teams investigate and mitigate incidents.

Boolean isLogprobs()

Get the logprobs property: Whether to return log probabilities of the output tokens or not.

Boolean isParallelToolCalls()

Get the parallelToolCalls property: Whether to enable parallel function calling during tool use.

Boolean isStore()

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

Boolean isStream()

Get the stream property: A value indicating whether chat completions should be streamed for this request.

ChatCompletionsOptions setAudio(AudioOutputParameters audio)

Set the audio property: Parameters for audio output.

ChatCompletionsOptions setDataSources(List<AzureChatExtensionConfiguration> dataSources)

Set the dataSources property: The configuration entries for Azure OpenAI chat extensions that use them.

ChatCompletionsOptions setEnhancements(AzureChatEnhancementConfiguration enhancements)

Set the enhancements property: If provided, the configuration options for available Azure OpenAI chat enhancements.

ChatCompletionsOptions setFrequencyPenalty(Double frequencyPenalty)

Set the frequencyPenalty property: A value that influences the probability of generated tokens appearing based on their cumulative frequency in generated text.

ChatCompletionsOptions setFunctionCall(FunctionCallConfig functionCallConfig)

Set the functionCall property: Controls how the model responds to function calls.

ChatCompletionsOptions setFunctions(List<FunctionDefinition> functions)

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

ChatCompletionsOptions setLogitBias(Map<String,Integer> logitBias)

Set the logitBias property: A map between GPT token IDs and bias scores that influences the probability of specific tokens appearing in a completions response.

ChatCompletionsOptions setLogprobs(Boolean logprobs)

Set the logprobs property: Whether to return log probabilities of the output tokens or not.

ChatCompletionsOptions setMaxCompletionTokens(Integer maxCompletionTokens)

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

ChatCompletionsOptions setMaxTokens(Integer maxTokens)

Set the maxTokens property: The maximum number of tokens allowed for the generated answer.

ChatCompletionsOptions setMetadata(Map<String,String> metadata)

Set the metadata property: Developer-defined tags and values used for filtering completions in the stored completions dashboard.

ChatCompletionsOptions setModalities(List<ChatCompletionModality> modalities)

Set the modalities property: Output types that you would like the model to generate for this request.

ChatCompletionsOptions setModel(String model)

Set the model property: The model name to provide as part of this completions request.

ChatCompletionsOptions setN(Integer n)

Set the n property: The number of chat completions choices that should be generated for a chat completions response.

ChatCompletionsOptions setParallelToolCalls(Boolean parallelToolCalls)

Set the parallelToolCalls property: Whether to enable parallel function calling during tool use.

ChatCompletionsOptions setPrediction(PredictionContent prediction)

Set the prediction property: Configuration for a Predicted Output, which can greatly improve response times when large parts of the model response are known ahead of time.

ChatCompletionsOptions setPresencePenalty(Double presencePenalty)

Set the presencePenalty property: A value that influences the probability of generated tokens appearing based on their existing presence in generated text.

ChatCompletionsOptions setReasoningEffort(ReasoningEffortValue reasoningEffort)

Set the reasoningEffort property: This option is only valid for o1 models, Constrains effort on reasoning for reasoning models (see https://platform.openai.com/docs/guides/reasoning).

ChatCompletionsOptions setResponseFormat(ChatCompletionsResponseFormat responseFormat)

Set the responseFormat property: An object specifying the format that the model must output.

ChatCompletionsOptions setSeed(Long seed)

Set the seed property: If specified, the system will make a best effort to sample deterministically such that repeated requests with the same seed and parameters should return the same result.

ChatCompletionsOptions setServiceTierOptions(ServiceTierOptions serviceTierOptions)

Set the ServiceTierOptions for this request.

ChatCompletionsOptions setStop(List<String> stop)

Set the stop property: A collection of textual sequences that will end completions generation.

ChatCompletionsOptions setStore(Boolean store)

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

ChatCompletionsOptions setTemperature(Double temperature)

Set the temperature property: The sampling temperature to use that controls the apparent creativity of generated completions.

ChatCompletionsOptions setToolChoice(ChatCompletionsToolSelection toolChoice)

Set the toolChoice property: If specified, the model will configure which of the provided tools it can use for the chat completions response.

ChatCompletionsOptions setTools(List<ChatCompletionsToolDefinition> tools)

Set the tools property: The available tool definitions that the chat completions request can use, including caller-defined functions.

ChatCompletionsOptions setTopLogprobs(Integer topLogprobs)

Set the topLogprobs property: An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated log probability.

ChatCompletionsOptions setTopP(Double topP)

Set the topP property: An alternative to sampling with temperature called nucleus sampling.

ChatCompletionsOptions setUser(String user)

Set the user property: An identifier for the caller or end user of the operation.

ChatCompletionsOptions setUserSecurityContext(UserSecurityContext userSecurityContext)

Set the userSecurityContext property: The security context identifies and authenticates users and applications in your multi-tenant AI system, helping security teams investigate and mitigate incidents.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

ChatCompletionsOptions

public ChatCompletionsOptions(List<ChatRequestMessage> messages)

Creates an instance of ChatCompletionsOptions class.

Parameters:

messages - the messages value to set.

Method Details

fromJson

public static ChatCompletionsOptions fromJson(JsonReader jsonReader)

Reads an instance of ChatCompletionsOptions from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of ChatCompletionsOptions if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

getAudio

public AudioOutputParameters getAudio()

Get the audio property: Parameters for audio output. Required when audio output is requested with `modalities: ["audio"]`.

Returns:

the audio value.

getDataSources

public List<AzureChatExtensionConfiguration> getDataSources()

Get the dataSources property: The configuration entries for Azure OpenAI chat extensions that use them. This additional specification is only compatible with Azure OpenAI.

Returns:

the dataSources value.

getEnhancements

public AzureChatEnhancementConfiguration getEnhancements()

Get the enhancements property: If provided, the configuration options for available Azure OpenAI chat enhancements.

Returns:

the enhancements value.

getFrequencyPenalty

public Double getFrequencyPenalty()

Get the frequencyPenalty property: A value that influences the probability of generated tokens appearing based on their cumulative frequency in generated text. Positive values will make tokens less likely to appear as their frequency increases and decrease the likelihood of the model repeating the same statements verbatim.

Returns:

the frequencyPenalty value.

getFunctionCall

public FunctionCallConfig getFunctionCall()

Get the functionCall property: Controls how the model responds to function calls. "none" means the model does not call a function, and responds to the end-user. "auto" means the model can pick between an end-user or calling a function. Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. "none" is the default when no functions are present. "auto" is the default if functions are present.

Returns:

the functionCall value.

getFunctions

public List<FunctionDefinition> getFunctions()

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

Returns:

the functions value.

getLogitBias

public Map<String,Integer> getLogitBias()

Get the logitBias property: A map between GPT token IDs and bias scores that influences the probability of specific tokens appearing in a completions response. Token IDs are computed via external tokenizer tools, while bias scores reside in the range of -100 to 100 with minimum and maximum values corresponding to a full ban or exclusive selection of a token, respectively. The exact behavior of a given bias score varies by model.

Returns:

the logitBias value.

getMaxCompletionTokens

public Integer getMaxCompletionTokens()

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

Returns:

the maxCompletionTokens value.

getMaxTokens

public Integer getMaxTokens()

Get the maxTokens property: 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). This value is now deprecated in favor of `max_completion_tokens`, and is not compatible with o1 series models.

Returns:

the maxTokens value.

getMessages

public List<ChatRequestMessage> getMessages()

Get the messages property: The collection of context messages associated with this chat completions request. Typical usage begins with a chat message for the System role that provides instructions for the behavior of the assistant, followed by alternating messages between the User and Assistant roles.

Returns:

the messages value.

getMetadata

public Map<String,String> getMetadata()

Get the metadata property: Developer-defined tags and values used for filtering completions in the stored completions dashboard.

Returns:

the metadata value.

getModalities

public List<ChatCompletionModality> getModalities()

Get the modalities property: 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"]`.

Returns:

the modalities value.

getModel

public String getModel()

Get the model property: The model name to provide as part of this completions request. Not applicable to Azure OpenAI, where deployment information should be included in the Azure resource URI that's connected to.

Returns:

the model value.

getN

public Integer getN()

Get the n property: The number of chat completions choices that should be generated for a chat completions response. Because this setting can generate many completions, it may quickly consume your token quota. Use carefully and ensure reasonable settings for max_tokens and stop.

Returns:

the n value.

getPrediction

public PredictionContent getPrediction()

Get the prediction property: 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.

Returns:

the prediction value.

getPresencePenalty

public Double getPresencePenalty()

Get the presencePenalty property: A value that influences the probability of generated tokens appearing based on their existing presence in generated text. Positive values will make tokens less likely to appear when they already exist and increase the model's likelihood to output new topics.

Returns:

the presencePenalty value.

getReasoningEffort

public ReasoningEffortValue getReasoningEffort()

Get the reasoningEffort property: This option is only valid for o1 models, Constrains effort on reasoning for reasoning models (see https://platform.openai.com/docs/guides/reasoning). 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.

Returns:

the reasoningEffort value.

getResponseFormat

public ChatCompletionsResponseFormat getResponseFormat()

Get the responseFormat property: An object specifying the format that the model must output. Used to enable JSON mode.

Returns:

the responseFormat value.

getSeed

public Long getSeed()

Get the seed property: If specified, the 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.".

Returns:

the seed value.

getServiceTierOptions

public ServiceTierOptions getServiceTierOptions()

Get the ServiceTierOptions for this request.

Returns:

getStop

public List<String> getStop()

Get the stop property: A collection of textual sequences that will end completions generation.

Returns:

the stop value.

getStreamOptions

public ChatCompletionStreamOptions getStreamOptions()

Get the streamOptions property: Options for streaming response. Only set this when you set `stream: true`.

Returns:

the streamOptions value.

getTemperature

public Double getTemperature()

Get the temperature property: The sampling temperature to use that controls the apparent creativity of generated completions. Higher values will make output more random while lower values will make results more focused and deterministic. It is not recommended to modify temperature and top_p for the same completions request as the interaction of these two settings is difficult to predict.

Returns:

the temperature value.

getToolChoice

public ChatCompletionsToolSelection getToolChoice()

Get the toolChoice property: If specified, the model will configure which of the provided tools it can use for the chat completions response.

Returns:

the toolChoice value.

getTools

public List<ChatCompletionsToolDefinition> getTools()

Get the tools property: The available tool definitions that the chat completions request can use, including caller-defined functions.

Returns:

the tools value.

getTopLogprobs

public Integer getTopLogprobs()

Get the topLogprobs property: An integer between 0 and 5 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.

Returns:

the topLogprobs value.

getTopP

public Double getTopP()

Get the topP property: An alternative to sampling with temperature called nucleus sampling. This value causes the model to consider the results of tokens with the provided probability mass. As an example, a value of 0.15 will cause only the tokens comprising the top 15% of probability mass to be considered. It is not recommended to modify temperature and top_p for the same completions request as the interaction of these two settings is difficult to predict.

Returns:

the topP value.

getUser

public String getUser()

Get the user property: An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes.

Returns:

the user value.

getUserSecurityContext

public UserSecurityContext getUserSecurityContext()

Get the userSecurityContext property: The security context identifies and authenticates users and applications in your multi-tenant AI system, helping security teams investigate and mitigate incidents.

Returns:

the userSecurityContext value.

isLogprobs

public Boolean isLogprobs()

Get the logprobs property: 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`. This option is currently not available on the `gpt-4-vision-preview` model.

Returns:

the logprobs value.

isParallelToolCalls

public Boolean isParallelToolCalls()

Get the parallelToolCalls property: Whether to enable parallel function calling during tool use.

Returns:

the parallelToolCalls value.

isStore

public Boolean isStore()

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

Returns:

the store value.

isStream

public Boolean isStream()

Get the stream property: A value indicating whether chat completions should be streamed for this request.

Returns:

the stream value.

setAudio

public ChatCompletionsOptions setAudio(AudioOutputParameters audio)

Set the audio property: Parameters for audio output. Required when audio output is requested with `modalities: ["audio"]`.

Parameters:

audio - the audio value to set.

Returns:

the ChatCompletionsOptions object itself.

setDataSources

public ChatCompletionsOptions setDataSources(List<AzureChatExtensionConfiguration> dataSources)

Set the dataSources property: The configuration entries for Azure OpenAI chat extensions that use them. This additional specification is only compatible with Azure OpenAI.

Parameters:

dataSources - the dataSources value to set.

Returns:

the ChatCompletionsOptions object itself.

setEnhancements

public ChatCompletionsOptions setEnhancements(AzureChatEnhancementConfiguration enhancements)

Set the enhancements property: If provided, the configuration options for available Azure OpenAI chat enhancements.

Parameters:

enhancements - the enhancements value to set.

Returns:

the ChatCompletionsOptions object itself.

setFrequencyPenalty

public ChatCompletionsOptions setFrequencyPenalty(Double frequencyPenalty)

Set the frequencyPenalty property: A value that influences the probability of generated tokens appearing based on their cumulative frequency in generated text. Positive values will make tokens less likely to appear as their frequency increases and decrease the likelihood of the model repeating the same statements verbatim.

Parameters:

frequencyPenalty - the frequencyPenalty value to set.

Returns:

the ChatCompletionsOptions object itself.

setFunctionCall

public ChatCompletionsOptions setFunctionCall(FunctionCallConfig functionCallConfig)

Set the functionCall property: Controls how the model responds to function calls. "none" means the model does not call a function, and responds to the end-user. "auto" means the model can pick between an end-user or calling a function. Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. "none" is the default when no functions are present. "auto" is the default if functions are present.

Parameters:

functionCallConfig - the functionCall value to set.

Returns:

the ChatCompletionsOptions object itself.

setFunctions

public ChatCompletionsOptions setFunctions(List<FunctionDefinition> functions)

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

Parameters:

functions - the functions value to set.

Returns:

the ChatCompletionsOptions object itself.

setLogitBias

public ChatCompletionsOptions setLogitBias(Map<String,Integer> logitBias)

Set the logitBias property: A map between GPT token IDs and bias scores that influences the probability of specific tokens appearing in a completions response. Token IDs are computed via external tokenizer tools, while bias scores reside in the range of -100 to 100 with minimum and maximum values corresponding to a full ban or exclusive selection of a token, respectively. The exact behavior of a given bias score varies by model.

Parameters:

logitBias - the logitBias value to set.

Returns:

the ChatCompletionsOptions object itself.

setLogprobs

public ChatCompletionsOptions setLogprobs(Boolean logprobs)

Set the logprobs property: 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`. This option is currently not available on the `gpt-4-vision-preview` model.

Parameters:

logprobs - the logprobs value to set.

Returns:

the ChatCompletionsOptions object itself.

setMaxCompletionTokens

public ChatCompletionsOptions setMaxCompletionTokens(Integer maxCompletionTokens)

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

Parameters:

maxCompletionTokens - the maxCompletionTokens value to set.

Returns:

the ChatCompletionsOptions object itself.

setMaxTokens

public ChatCompletionsOptions setMaxTokens(Integer maxTokens)

Set the maxTokens property: 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). This value is now deprecated in favor of `max_completion_tokens`, and is not compatible with o1 series models.

Parameters:

maxTokens - the maxTokens value to set.

Returns:

the ChatCompletionsOptions object itself.

setMetadata

public ChatCompletionsOptions setMetadata(Map<String,String> metadata)

Set the metadata property: Developer-defined tags and values used for filtering completions in the stored completions dashboard.

Parameters:

metadata - the metadata value to set.

Returns:

the ChatCompletionsOptions object itself.

setModalities

public ChatCompletionsOptions setModalities(List<ChatCompletionModality> modalities)

Set the modalities property: 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"]`.

Parameters:

modalities - the modalities value to set.

Returns:

the ChatCompletionsOptions object itself.

setModel

public ChatCompletionsOptions setModel(String model)

Set the model property: The model name to provide as part of this completions request. Not applicable to Azure OpenAI, where deployment information should be included in the Azure resource URI that's connected to.

Parameters:

model - the model value to set.

Returns:

the ChatCompletionsOptions object itself.

setN

public ChatCompletionsOptions setN(Integer n)

Set the n property: The number of chat completions choices that should be generated for a chat completions response. Because this setting can generate many completions, it may quickly consume your token quota. Use carefully and ensure reasonable settings for max_tokens and stop.

Parameters:

n - the n value to set.

Returns:

the ChatCompletionsOptions object itself.

setParallelToolCalls

public ChatCompletionsOptions setParallelToolCalls(Boolean parallelToolCalls)

Set the parallelToolCalls property: Whether to enable parallel function calling during tool use.

Parameters:

parallelToolCalls - the parallelToolCalls value to set.

Returns:

the ChatCompletionsOptions object itself.

setPrediction

public ChatCompletionsOptions setPrediction(PredictionContent prediction)

Set the prediction property: 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.

Parameters:

prediction - the prediction value to set.

Returns:

the ChatCompletionsOptions object itself.

setPresencePenalty

public ChatCompletionsOptions setPresencePenalty(Double presencePenalty)

Set the presencePenalty property: A value that influences the probability of generated tokens appearing based on their existing presence in generated text. Positive values will make tokens less likely to appear when they already exist and increase the model's likelihood to output new topics.

Parameters:

presencePenalty - the presencePenalty value to set.

Returns:

the ChatCompletionsOptions object itself.

setReasoningEffort

public ChatCompletionsOptions setReasoningEffort(ReasoningEffortValue reasoningEffort)

Set the reasoningEffort property: This option is only valid for o1 models, Constrains effort on reasoning for reasoning models (see https://platform.openai.com/docs/guides/reasoning). 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.

Parameters:

reasoningEffort - the reasoningEffort value to set.

Returns:

the ChatCompletionsOptions object itself.

setResponseFormat

public ChatCompletionsOptions setResponseFormat(ChatCompletionsResponseFormat responseFormat)

Set the responseFormat property: An object specifying the format that the model must output. Used to enable JSON mode.

Parameters:

responseFormat - the responseFormat value to set.

Returns:

the ChatCompletionsOptions object itself.

setSeed

public ChatCompletionsOptions setSeed(Long seed)

Set the seed property: If specified, the 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.".

Parameters:

seed - the seed value to set.

Returns:

the ChatCompletionsOptions object itself.

setServiceTierOptions

public ChatCompletionsOptions setServiceTierOptions(ServiceTierOptions serviceTierOptions)

Set the ServiceTierOptions for this request.

Parameters:

serviceTierOptions - the ServiceTierOptions value to set.

Returns:

the ChatCompletionsOptions object itself.

setStop

public ChatCompletionsOptions setStop(List<String> stop)

Set the stop property: A collection of textual sequences that will end completions generation.

Parameters:

stop - the stop value to set.

Returns:

the ChatCompletionsOptions object itself.

setStore

public ChatCompletionsOptions setStore(Boolean store)

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

Parameters:

store - the store value to set.

Returns:

the ChatCompletionsOptions object itself.

setTemperature

public ChatCompletionsOptions setTemperature(Double temperature)

Set the temperature property: The sampling temperature to use that controls the apparent creativity of generated completions. Higher values will make output more random while lower values will make results more focused and deterministic. It is not recommended to modify temperature and top_p for the same completions request as the interaction of these two settings is difficult to predict.

Parameters:

temperature - the temperature value to set.

Returns:

the ChatCompletionsOptions object itself.

setToolChoice

public ChatCompletionsOptions setToolChoice(ChatCompletionsToolSelection toolChoice)

Set the toolChoice property: If specified, the model will configure which of the provided tools it can use for the chat completions response.

Parameters:

toolChoice - the toolChoice value to set.

Returns:

the ChatCompletionsOptions object itself.

setTools

public ChatCompletionsOptions setTools(List<ChatCompletionsToolDefinition> tools)

Set the tools property: The available tool definitions that the chat completions request can use, including caller-defined functions.

Parameters:

tools - the tools value to set.

Returns:

the ChatCompletionsOptions object itself.

setTopLogprobs

public ChatCompletionsOptions setTopLogprobs(Integer topLogprobs)

Set the topLogprobs property: An integer between 0 and 5 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.

Parameters:

topLogprobs - the topLogprobs value to set.

Returns:

the ChatCompletionsOptions object itself.

setTopP

public ChatCompletionsOptions setTopP(Double topP)

Set the topP property: An alternative to sampling with temperature called nucleus sampling. This value causes the model to consider the results of tokens with the provided probability mass. As an example, a value of 0.15 will cause only the tokens comprising the top 15% of probability mass to be considered. It is not recommended to modify temperature and top_p for the same completions request as the interaction of these two settings is difficult to predict.

Parameters:

topP - the topP value to set.

Returns:

the ChatCompletionsOptions object itself.

setUser

public ChatCompletionsOptions setUser(String user)

Set the user property: An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes.

Parameters:

user - the user value to set.

Returns:

the ChatCompletionsOptions object itself.

setUserSecurityContext

public ChatCompletionsOptions setUserSecurityContext(UserSecurityContext userSecurityContext)

Set the userSecurityContext property: The security context identifies and authenticates users and applications in your multi-tenant AI system, helping security teams investigate and mitigate incidents.

Parameters:

userSecurityContext - the userSecurityContext value to set.

Returns:

the ChatCompletionsOptions object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to