Class OpenAiResponsesChatOptions
- All Implemented Interfaces:
ChatOptions,ModelOptions,StructuredOutputChatOptions,ToolCallingChatOptions
OpenAiResponsesChatModel.
Deliberately absent: previousResponseId, conversationId,
background and any other knob for a deferred feature. Adding options later is
additive; removing them is not. In particular there is no way to ask OpenAI to remember
the conversation - this model always sends the whole prompt.
store is absent for the same reason, even though the API accepts it: the model
always sends store: false, because a stored response keeps its reasoning at
OpenAI instead of returning it, and replaying that reasoning is what makes stateless
mode correct. See ResponsesRequestBuilder.
Portable ChatOptions the Responses API has no equivalent for - stop sequences,
frequency and presence penalties, topK - return null and are warned
about once per option.
- Since:
- 2.1.0
- Author:
- Dimitar Proynov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic classPublic builder exposed to users, so they do not have to name the generic parameter. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionbuilder()A builder to create a newToolCallingChatOptionsinstance.boolean@Nullable String@Nullable String@Nullable com.openai.credential.Credential@Nullable StringAlias forgetMicrosoftDeploymentName().Extra request body properties, for OpenAI-compatible providers and for API fields that are not modelled here.@Nullable DoubleReturns the frequency penalty to use for the chat.@Nullable List<HostedTool>Tools OpenAI runs server-side within the request.Extra fields to include in the response, e.g.@Nullable IntegerMaximum number of tokens the model may generate,max_output_tokenson the wire.int@Nullable IntegerReturns the maximum number of tokens to use for the chat.@Nullable Integer@Nullable String@Nullable com.openai.azure.AzureOpenAIServiceVersiongetModel()Returns the model to use for the chat.@Nullable String@Nullable String@Nullable Boolean@Nullable DoubleReturns the presence penalty to use for the chat.@Nullable String@Nullable ProxygetProxy()@Nullable StringHow hard the model should think:none,minimal,low,medium,high, ...@Nullable StringWhether and how to summarize the model's reasoning:auto,conciseordetailed.@Nullable OpenAiChatModel.ResponseFormat@Nullable String@Nullable StringReturns the stop sequences to use for the chat.@Nullable BooleanWhether tool schemas are sent as strict.@Nullable DoubleReturns the temperature to use for the chat.@Nullable DurationReturn the request timeout, ornullto inherit the timeout configured on the OpenAI client.@Nullable List<ToolCallback>ToolCallbacks to be registered with the ChatModel.@Nullable Objectauto,none,required, a function name as{"type":"function","name":"..."}, or a hosted tool type as{"type":"web_search"}.Get the configured tool context.@Nullable IntegergetTopK()Returns the top K to use for the chat.@Nullable DoublegetTopP()Returns the top P to use for the chat.@Nullable Stringautoto let OpenAI drop middle-of-conversation items when the context window overflows, ordisabledto fail instead.@Nullable StringHow verbose the answer should be:low,mediumorhigh.inthashCode()booleanmutate()Returns a newToolCallingChatOptions.Builderinitialized with the values of thisToolCallingChatOptions.
-
Field Details
-
DEFAULT_CHAT_MODEL
-
-
Constructor Details
-
OpenAiResponsesChatOptions
-
-
Method Details
-
builder
Description copied from interface:ToolCallingChatOptionsA builder to create a newToolCallingChatOptionsinstance.- Returns:
- Returns a new
ChatOptions.Builder.
-
getBaseUrl
-
getApiKey
-
getCredential
public @Nullable com.openai.credential.Credential getCredential() -
getModel
Description copied from interface:ChatOptionsReturns the model to use for the chat.- Specified by:
getModelin interfaceChatOptions- Returns:
- the model to use for the chat
-
getMicrosoftDeploymentName
-
getDeploymentName
Alias forgetMicrosoftDeploymentName(). -
getMicrosoftFoundryServiceVersion
public @Nullable com.openai.azure.AzureOpenAIServiceVersion getMicrosoftFoundryServiceVersion() -
getOrganizationId
-
isMicrosoftFoundry
public boolean isMicrosoftFoundry() -
getTimeout
Return the request timeout, ornullto inherit the timeout configured on the OpenAI client. -
getMaxRetries
public int getMaxRetries() -
getProxy
-
getCustomHeaders
-
getMaxOutputTokens
Maximum number of tokens the model may generate,max_output_tokenson the wire. Same value asgetMaxTokens(). -
getMaxTokens
Description copied from interface:ChatOptionsReturns the maximum number of tokens to use for the chat.- Specified by:
getMaxTokensin interfaceChatOptions- Returns:
- the maximum number of tokens to use for the chat
-
getTemperature
Description copied from interface:ChatOptionsReturns the temperature to use for the chat.- Specified by:
getTemperaturein interfaceChatOptions- Returns:
- the temperature to use for the chat
-
getTopP
Description copied from interface:ChatOptionsReturns the top P to use for the chat.- Specified by:
getTopPin interfaceChatOptions- Returns:
- the top P to use for the chat
-
getReasoningEffort
How hard the model should think:none,minimal,low,medium,high, ... Kept as aStringbecause the accepted values move faster than releases. -
getReasoningSummary
Whether and how to summarize the model's reasoning:auto,conciseordetailed. Summaries surface underOpenAiResponsesMetadata.REASONING_CONTENT; raw reasoning text is never returned by OpenAI. -
getVerbosity
How verbose the answer should be:low,mediumorhigh. -
getResponseFormat
-
getStrict
Whether tool schemas are sent as strict.When unset, this model sends
strict=falseexplicitly: the Responses API otherwise attempts strict mode, and Spring AI's generated schemas are frequently not strict-compatible, which would make the same tool behave differently across the two OpenAI models. -
getToolChoice
auto,none,required, a function name as{"type":"function","name":"..."}, or a hosted tool type as{"type":"web_search"}. -
getParallelToolCalls
-
getMaxToolCalls
-
getHostedTools
Tools OpenAI runs server-side within the request. -
getInclude
Extra fields to include in the response, e.g.web_search_call.results.reasoning.encrypted_contentis always added by the model, because stateless reasoning is impossible without it. -
getTruncation
autoto let OpenAI drop middle-of-conversation items when the context window overflows, ordisabledto fail instead. -
getServiceTier
-
getPromptCacheKey
-
getSafetyIdentifier
-
getMetadata
-
getExtraBody
Extra request body properties, for OpenAI-compatible providers and for API fields that are not modelled here. -
getToolCallbacks
Description copied from interface:ToolCallingChatOptionsToolCallbacks to be registered with the ChatModel.- Specified by:
getToolCallbacksin interfaceToolCallingChatOptions
-
getToolContext
Description copied from interface:ToolCallingChatOptionsGet the configured tool context.- Specified by:
getToolContextin interfaceToolCallingChatOptions- Returns:
- the tool context map.
-
getOutputSchema
- Specified by:
getOutputSchemain interfaceStructuredOutputChatOptions
-
getTopK
Description copied from interface:ChatOptionsReturns the top K to use for the chat.- Specified by:
getTopKin interfaceChatOptions- Returns:
- the top K to use for the chat
-
getStopSequences
Description copied from interface:ChatOptionsReturns the stop sequences to use for the chat.- Specified by:
getStopSequencesin interfaceChatOptions- Returns:
- the stop sequences to use for the chat
-
getFrequencyPenalty
Description copied from interface:ChatOptionsReturns the frequency penalty to use for the chat.- Specified by:
getFrequencyPenaltyin interfaceChatOptions- Returns:
- the frequency penalty to use for the chat
-
getPresencePenalty
Description copied from interface:ChatOptionsReturns the presence penalty to use for the chat.- Specified by:
getPresencePenaltyin interfaceChatOptions- Returns:
- the presence penalty to use for the chat
-
mutate
Description copied from interface:ToolCallingChatOptionsReturns a newToolCallingChatOptions.Builderinitialized with the values of thisToolCallingChatOptions. Narrows the return type ofChatOptions.mutate()so generic tool calling code can chain methods without casting.- Specified by:
mutatein interfaceChatOptions- Specified by:
mutatein interfaceStructuredOutputChatOptions- Specified by:
mutatein interfaceToolCallingChatOptions
-
equals
-
hashCode
public int hashCode()
-