Package org.springframework.ai.openai
Class OpenAiChatOptions
java.lang.Object
org.springframework.ai.openai.OpenAiChatOptions
- All Implemented Interfaces:
ChatOptions,FunctionCallingOptions,ModelOptions,ToolCallingChatOptions
Options for the OpenAI Chat API.
- Since:
- 0.8.0
- Author:
- Christian Tzolov, Mariusz Bernacki, Thomas Vitale, Ilayaperumal Gopinathan
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.springframework.ai.model.tool.ToolCallingChatOptions
DEFAULT_TOOL_EXECUTION_ENABLED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OpenAiChatOptions.Builderbuilder()A builder to create a newToolCallingChatOptionsinstance.copy()Returns a copy of thisChatOptions.booleanstatic OpenAiChatOptionsfromOptions(OpenAiChatOptions fromOptions) Returns the frequency penalty to use for the chat.Deprecated.Deprecated.Returns the maximum number of tokens to use for the chat.getModel()Returns the model to use for the chat.getN()Returns the presence penalty to use for the chat.Deprecated.getSeed()getStop()Returns the stop sequences to use for the chat.getStore()Returns the temperature to use for the chat.ToolCallbacks to be registered with the ChatModel.Names of the tools to register with the ChatModel.getTools()getTopK()Returns the top K to use for the chat.getTopP()Returns the top P to use for the chat.getUser()inthashCode()Whether theChatModelis responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.voidsetFrequencyPenalty(Double frequencyPenalty) voidsetFunctionCallbacks(List<FunctionCallback> functionCallbacks) Deprecated.voidsetFunctions(Set<String> functionNames) Deprecated.voidsetHttpHeaders(Map<String, String> httpHeaders) voidsetInternalToolExecutionEnabled(Boolean internalToolExecutionEnabled) Set whether theChatModelis responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.voidsetLogitBias(Map<String, Integer> logitBias) voidsetLogprobs(Boolean logprobs) voidsetMaxCompletionTokens(Integer maxCompletionTokens) voidsetMaxTokens(Integer maxTokens) voidsetMetadata(Map<String, String> metadata) voidvoidvoidvoidsetOutputModalities(List<String> modalities) voidsetParallelToolCalls(Boolean parallelToolCalls) voidsetPresencePenalty(Double presencePenalty) voidsetProxyToolCalls(Boolean proxyToolCalls) Deprecated.voidsetReasoningEffort(String reasoningEffort) voidsetResponseFormat(ResponseFormat responseFormat) voidvoidvoidsetStopSequences(List<String> stopSequences) voidvoidsetStreamOptions(OpenAiApi.ChatCompletionRequest.StreamOptions streamOptions) voidsetStreamUsage(Boolean enableStreamUsage) voidsetTemperature(Double temperature) voidsetToolCallbacks(List<FunctionCallback> toolCallbacks) Set the ToolCallbacks to be registered with the ChatModel.voidsetToolChoice(Object toolChoice) voidsetToolContext(Map<String, Object> toolContext) voidsetToolNames(Set<String> toolNames) Set the names of the tools to register with the ChatModel.voidsetTools(List<OpenAiApi.FunctionTool> tools) voidsetTopLogprobs(Integer topLogprobs) voidvoidtoString()
-
Constructor Details
-
OpenAiChatOptions
public OpenAiChatOptions()
-
-
Method Details
-
builder
Description copied from interface:ToolCallingChatOptionsA builder to create a newToolCallingChatOptionsinstance.- Returns:
- Returns
DefaultFunctionCallingOptionsBuilderto create a new instance ofFunctionCallingOptions.
-
fromOptions
-
getStreamUsage
-
setStreamUsage
-
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
-
setModel
-
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
-
setFrequencyPenalty
-
getLogitBias
-
setLogitBias
-
getLogprobs
-
setLogprobs
-
getTopLogprobs
-
setTopLogprobs
-
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
-
setMaxTokens
-
getMaxCompletionTokens
-
setMaxCompletionTokens
-
getN
-
setN
-
getOutputModalities
-
setOutputModalities
-
getOutputAudio
-
setOutputAudio
-
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
-
setPresencePenalty
-
getResponseFormat
-
setResponseFormat
-
getStreamOptions
-
setStreamOptions
-
getSeed
-
setSeed
-
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
-
setStopSequences
-
getStop
-
setStop
-
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
-
setTemperature
-
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
-
setTopP
-
getTools
-
setTools
-
getToolChoice
-
setToolChoice
-
getProxyToolCalls
Deprecated.- Specified by:
getProxyToolCallsin interfaceFunctionCallingOptions
-
setProxyToolCalls
Deprecated.- Specified by:
setProxyToolCallsin interfaceFunctionCallingOptions
-
getUser
-
setUser
-
getParallelToolCalls
-
setParallelToolCalls
-
getToolCallbacks
Description copied from interface:ToolCallingChatOptionsToolCallbacks to be registered with the ChatModel.- Specified by:
getToolCallbacksin interfaceToolCallingChatOptions
-
setToolCallbacks
Description copied from interface:ToolCallingChatOptionsSet the ToolCallbacks to be registered with the ChatModel.- Specified by:
setToolCallbacksin interfaceToolCallingChatOptions
-
getToolNames
Description copied from interface:ToolCallingChatOptionsNames of the tools to register with the ChatModel.- Specified by:
getToolNamesin interfaceToolCallingChatOptions
-
setToolNames
Description copied from interface:ToolCallingChatOptionsSet the names of the tools to register with the ChatModel.- Specified by:
setToolNamesin interfaceToolCallingChatOptions
-
isInternalToolExecutionEnabled
Description copied from interface:ToolCallingChatOptionsWhether theChatModelis responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.- Specified by:
isInternalToolExecutionEnabledin interfaceToolCallingChatOptions
-
setInternalToolExecutionEnabled
Description copied from interface:ToolCallingChatOptionsSet whether theChatModelis responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.- Specified by:
setInternalToolExecutionEnabledin interfaceToolCallingChatOptions
-
getFunctionCallbacks
Deprecated.Description copied from interface:FunctionCallingOptionsFunction Callbacks to be registered with the ChatModel. For Prompt Options the functionCallbacks are automatically enabled for the duration of the prompt execution. For Default Options the FunctionCallbacks are registered but disabled by default. You have to use "functions" property to list the function names from the ChatModel registry to be used in the chat completion requests.- Specified by:
getFunctionCallbacksin interfaceFunctionCallingOptions- Returns:
- Return the Function Callbacks to be registered with the ChatModel.
-
setFunctionCallbacks
Deprecated.Description copied from interface:FunctionCallingOptionsSet the Function Callbacks to be registered with the ChatModel.- Specified by:
setFunctionCallbacksin interfaceFunctionCallingOptions- Parameters:
functionCallbacks- the Function Callbacks to be registered with the ChatModel.
-
getFunctions
Deprecated.- Specified by:
getFunctionsin interfaceFunctionCallingOptions- Returns:
Setof function names from the ChatModel registry to be used in the next chat completion requests.
-
setFunctions
Deprecated.Description copied from interface:FunctionCallingOptionsSet the list of function names from the ChatModel registry to be used in the next chat completion requests.- Specified by:
setFunctionsin interfaceFunctionCallingOptions- Parameters:
functionNames- the list of function names from the ChatModel registry to be used in the next chat completion requests.
-
getHttpHeaders
-
setHttpHeaders
-
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
-
getToolContext
- Specified by:
getToolContextin interfaceFunctionCallingOptions
-
setToolContext
- Specified by:
setToolContextin interfaceFunctionCallingOptions
-
getStore
-
setStore
-
getMetadata
-
setMetadata
-
getReasoningEffort
-
setReasoningEffort
-
copy
Description copied from interface:ChatOptionsReturns a copy of thisChatOptions.- Specified by:
copyin interfaceChatOptions- Returns:
- a copy of this
ChatOptions
-
hashCode
public int hashCode() -
equals
-
toString
-