Package org.springframework.ai.openai
Class OpenAiChatOptions.AbstractBuilder<B extends OpenAiChatOptions.AbstractBuilder<B>>
java.lang.Object
org.springframework.ai.chat.prompt.DefaultChatOptionsBuilder<B>
org.springframework.ai.model.tool.DefaultToolCallingChatOptions.Builder<B>
org.springframework.ai.openai.OpenAiChatOptions.AbstractBuilder<B>
- All Implemented Interfaces:
Cloneable,org.springframework.ai.chat.prompt.ChatOptions.Builder<B>,org.springframework.ai.model.tool.StructuredOutputChatOptions.Builder<B>,org.springframework.ai.model.tool.ToolCallingChatOptions.Builder<B>
- Direct Known Subclasses:
OpenAiChatOptions.Builder
- Enclosing class:
- OpenAiChatOptions
protected abstract static class OpenAiChatOptions.AbstractBuilder<B extends OpenAiChatOptions.AbstractBuilder<B>>
extends org.springframework.ai.model.tool.DefaultToolCallingChatOptions.Builder<B>
implements org.springframework.ai.model.tool.StructuredOutputChatOptions.Builder<B>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected @Nullable Stringprotected @Nullable Stringprotected @Nullable com.openai.credential.Credentialprotected @Nullable Booleanprotected @Nullable Booleanprotected @Nullable Booleanprotected @Nullable Integerprotected @Nullable Integerprotected @Nullable Stringprotected @Nullable com.openai.azure.AzureOpenAIServiceVersionprotected @Nullable Integerprotected @Nullable Stringprotected @Nullable OpenAiChatOptions.AudioParametersprotected @Nullable Booleanprotected @Nullable Stringprotected @Nullable Proxyprotected @Nullable Stringprotected @Nullable OpenAiChatModel.ResponseFormatprotected @Nullable Integerprotected @Nullable Stringprotected @Nullable Booleanprotected @Nullable OpenAiChatOptions.StreamOptionsprotected @Nullable Booleanprotected @Nullable Durationprotected @Nullable Objectprotected @Nullable Integerprotected @Nullable Stringprotected @Nullable StringFields inherited from class org.springframework.ai.model.tool.DefaultToolCallingChatOptions.Builder
toolCallbacks, toolContextFields inherited from class org.springframework.ai.chat.prompt.DefaultChatOptionsBuilder
frequencyPenalty, maxTokens, model, presencePenalty, stopSequences, temperature, topK, topP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapiKey(@Nullable org.springframework.ai.model.ApiKey apiKey) Sets the API key using anApiKeyinstance.azureOpenAIServiceVersion(@Nullable com.openai.azure.AzureOpenAIServiceVersion azureOpenAIServiceVersion) build()clone()combineWith(org.springframework.ai.chat.prompt.ChatOptions.Builder<?> other) credential(@Nullable com.openai.credential.Credential credential) customHeaders(@Nullable Map<String, String> customHeaders) deploymentName(@Nullable String deploymentName) gitHubModels(@Nullable Boolean gitHubModels) maxCompletionTokens(@Nullable Integer maxCompletionTokens) maxRetries(@Nullable Integer maxRetries) microsoftFoundry(@Nullable Boolean microsoftFoundry) microsoftFoundryServiceVersion(@Nullable com.openai.azure.AzureOpenAIServiceVersion microsoftFoundryServiceVersion) organizationId(@Nullable String organizationId) outputAudio(@Nullable OpenAiChatOptions.AudioParameters audio) outputModalities(@Nullable List<String> outputModalities) outputSchema(@Nullable String outputSchema) parallelToolCalls(@Nullable Boolean parallelToolCalls) promptCacheKey(@Nullable String promptCacheKey) reasoningEffort(@Nullable String reasoningEffort) responseFormat(@Nullable OpenAiChatModel.ResponseFormat responseFormat) serviceTier(@Nullable String serviceTier) streamOptions(@Nullable OpenAiChatOptions.StreamOptions streamOptions) streamUsage(boolean streamUsage) Whether to enable OpenAI Tool/Function calling strict mode.toolChoice(@Nullable Object toolChoice) topLogprobs(@Nullable Integer topLogprobs) Methods inherited from class org.springframework.ai.model.tool.DefaultToolCallingChatOptions.Builder
toolCallbacks, toolCallbacks, toolContext, toolContextMethods inherited from class org.springframework.ai.chat.prompt.DefaultChatOptionsBuilder
frequencyPenalty, model, presencePenalty, self, stopSequences, temperature, topK, topPMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.model.tool.ToolCallingChatOptions.Builder
frequencyPenalty, model, presencePenalty, stopSequences, temperature, topK, topP
-
Field Details
-
baseUrl
-
apiKey
-
credential
protected @Nullable com.openai.credential.Credential credential -
microsoftDeploymentName
-
microsoftFoundryServiceVersion
protected @Nullable com.openai.azure.AzureOpenAIServiceVersion microsoftFoundryServiceVersion -
organizationId
-
isMicrosoftFoundry
-
isGitHubModels
-
timeout
-
maxRetries
-
proxy
-
customHeaders
-
logitBias
-
logprobs
-
topLogprobs
-
maxCompletionTokens
-
n
-
outputModalities
-
outputAudio
-
responseFormat
-
streamOptions
-
seed
-
toolChoice
-
user
-
parallelToolCalls
-
store
-
strict
-
metadata
-
reasoningEffort
-
verbosity
-
serviceTier
-
promptCacheKey
-
extraBody
-
-
Constructor Details
-
AbstractBuilder
protected AbstractBuilder()
-
-
Method Details
-
clone
- Specified by:
clonein interfaceorg.springframework.ai.chat.prompt.ChatOptions.Builder<B extends OpenAiChatOptions.AbstractBuilder<B>>- Overrides:
clonein classorg.springframework.ai.model.tool.DefaultToolCallingChatOptions.Builder<B extends OpenAiChatOptions.AbstractBuilder<B>>
-
maxTokens
- Specified by:
maxTokensin interfaceorg.springframework.ai.chat.prompt.ChatOptions.Builder<B extends OpenAiChatOptions.AbstractBuilder<B>>- Specified by:
maxTokensin interfaceorg.springframework.ai.model.tool.ToolCallingChatOptions.Builder<B extends OpenAiChatOptions.AbstractBuilder<B>>- Overrides:
maxTokensin classorg.springframework.ai.model.tool.DefaultToolCallingChatOptions.Builder<B extends OpenAiChatOptions.AbstractBuilder<B>>
-
baseUrl
-
apiKey
-
apiKey
Sets the API key using anApiKeyinstance. Pass aNoopApiKeyto disable authentication (noAuthorizationheader will be sent), which is the same behavior as setting an empty string viaapiKey(String).- Parameters:
apiKey- the API key instance; ifnull, the key is cleared
-
credential
-
deploymentName
-
microsoftFoundryServiceVersion
public B microsoftFoundryServiceVersion(@Nullable com.openai.azure.AzureOpenAIServiceVersion microsoftFoundryServiceVersion) -
azureOpenAIServiceVersion
public B azureOpenAIServiceVersion(@Nullable com.openai.azure.AzureOpenAIServiceVersion azureOpenAIServiceVersion) -
organizationId
-
microsoftFoundry
-
azure
-
gitHubModels
-
timeout
-
maxRetries
-
proxy
-
customHeaders
-
logitBias
-
logprobs
-
topLogprobs
-
maxCompletionTokens
-
n
-
outputModalities
-
outputAudio
-
responseFormat
-
streamOptions
-
streamUsage
-
seed
-
stop
-
toolChoice
-
user
-
parallelToolCalls
-
store
-
strict
Whether to enable OpenAI Tool/Function calling strict mode.Not to be confused with
OpenAiChatModel.ResponseFormat.Builder.strict(Boolean), which applies to JSON schema response format rather than tool/function calling.- Parameters:
strict- the strict flag- Returns:
- this builder
-
metadata
-
reasoningEffort
-
verbosity
-
serviceTier
-
promptCacheKey
-
extraBody
-
outputSchema
- Specified by:
outputSchemain interfaceorg.springframework.ai.model.tool.StructuredOutputChatOptions.Builder<B extends OpenAiChatOptions.AbstractBuilder<B>>
-
combineWith
- Specified by:
combineWithin interfaceorg.springframework.ai.chat.prompt.ChatOptions.Builder<B extends OpenAiChatOptions.AbstractBuilder<B>>- Overrides:
combineWithin classorg.springframework.ai.model.tool.DefaultToolCallingChatOptions.Builder<B extends OpenAiChatOptions.AbstractBuilder<B>>
-
build
- Specified by:
buildin interfaceorg.springframework.ai.chat.prompt.ChatOptions.Builder<B extends OpenAiChatOptions.AbstractBuilder<B>>- Specified by:
buildin interfaceorg.springframework.ai.model.tool.ToolCallingChatOptions.Builder<B extends OpenAiChatOptions.AbstractBuilder<B>>- Overrides:
buildin classorg.springframework.ai.model.tool.DefaultToolCallingChatOptions.Builder<B extends OpenAiChatOptions.AbstractBuilder<B>>
-