Class OpenAiChatOptions

java.lang.Object
org.springframework.ai.openai.OpenAiChatOptions
All Implemented Interfaces:
org.springframework.ai.chat.prompt.ChatOptions, org.springframework.ai.model.ModelOptions, org.springframework.ai.model.tool.ToolCallingChatOptions

public class OpenAiChatOptions extends Object implements org.springframework.ai.model.tool.ToolCallingChatOptions
Options for the OpenAI Chat API.
Since:
0.8.0
Author:
Christian Tzolov, Mariusz Bernacki, Thomas Vitale, Ilayaperumal Gopinathan, lambochen
  • Constructor Details

    • OpenAiChatOptions

      public OpenAiChatOptions()
  • Method Details

    • builder

      public static OpenAiChatOptions.Builder builder()
    • fromOptions

      public static OpenAiChatOptions fromOptions(OpenAiChatOptions fromOptions)
    • getStreamUsage

      public Boolean getStreamUsage()
    • setStreamUsage

      public void setStreamUsage(Boolean enableStreamUsage)
    • getModel

      public String getModel()
      Specified by:
      getModel in interface org.springframework.ai.chat.prompt.ChatOptions
    • setModel

      public void setModel(String model)
    • getFrequencyPenalty

      public Double getFrequencyPenalty()
      Specified by:
      getFrequencyPenalty in interface org.springframework.ai.chat.prompt.ChatOptions
    • setFrequencyPenalty

      public void setFrequencyPenalty(Double frequencyPenalty)
    • getLogitBias

      public Map<String,Integer> getLogitBias()
    • setLogitBias

      public void setLogitBias(Map<String,Integer> logitBias)
    • getLogprobs

      public Boolean getLogprobs()
    • setLogprobs

      public void setLogprobs(Boolean logprobs)
    • getTopLogprobs

      public Integer getTopLogprobs()
    • setTopLogprobs

      public void setTopLogprobs(Integer topLogprobs)
    • getMaxTokens

      public Integer getMaxTokens()
      Specified by:
      getMaxTokens in interface org.springframework.ai.chat.prompt.ChatOptions
    • setMaxTokens

      public void setMaxTokens(Integer maxTokens)
    • getMaxCompletionTokens

      public Integer getMaxCompletionTokens()
    • setMaxCompletionTokens

      public void setMaxCompletionTokens(Integer maxCompletionTokens)
    • getN

      public Integer getN()
    • setN

      public void setN(Integer n)
    • getOutputModalities

      public List<String> getOutputModalities()
    • setOutputModalities

      public void setOutputModalities(List<String> modalities)
    • getOutputAudio

    • setOutputAudio

      public void setOutputAudio(OpenAiApi.ChatCompletionRequest.AudioParameters audio)
    • getPresencePenalty

      public Double getPresencePenalty()
      Specified by:
      getPresencePenalty in interface org.springframework.ai.chat.prompt.ChatOptions
    • setPresencePenalty

      public void setPresencePenalty(Double presencePenalty)
    • getResponseFormat

      public ResponseFormat getResponseFormat()
    • setResponseFormat

      public void setResponseFormat(ResponseFormat responseFormat)
    • getStreamOptions

    • setStreamOptions

      public void setStreamOptions(OpenAiApi.ChatCompletionRequest.StreamOptions streamOptions)
    • getSeed

      public Integer getSeed()
    • setSeed

      public void setSeed(Integer seed)
    • getStopSequences

      public List<String> getStopSequences()
      Specified by:
      getStopSequences in interface org.springframework.ai.chat.prompt.ChatOptions
    • setStopSequences

      public void setStopSequences(List<String> stopSequences)
    • getStop

      public List<String> getStop()
    • setStop

      public void setStop(List<String> stop)
    • getTemperature

      public Double getTemperature()
      Specified by:
      getTemperature in interface org.springframework.ai.chat.prompt.ChatOptions
    • setTemperature

      public void setTemperature(Double temperature)
    • getTopP

      public Double getTopP()
      Specified by:
      getTopP in interface org.springframework.ai.chat.prompt.ChatOptions
    • setTopP

      public void setTopP(Double topP)
    • getTools

      public List<OpenAiApi.FunctionTool> getTools()
    • setTools

      public void setTools(List<OpenAiApi.FunctionTool> tools)
    • getToolChoice

      public Object getToolChoice()
    • setToolChoice

      public void setToolChoice(Object toolChoice)
    • getUser

      public String getUser()
    • setUser

      public void setUser(String user)
    • getParallelToolCalls

      public Boolean getParallelToolCalls()
    • setParallelToolCalls

      public void setParallelToolCalls(Boolean parallelToolCalls)
    • getToolCallbacks

      public List<org.springframework.ai.tool.ToolCallback> getToolCallbacks()
      Specified by:
      getToolCallbacks in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • setToolCallbacks

      public void setToolCallbacks(List<org.springframework.ai.tool.ToolCallback> toolCallbacks)
      Specified by:
      setToolCallbacks in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • getToolNames

      public Set<String> getToolNames()
      Specified by:
      getToolNames in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • setToolNames

      public void setToolNames(Set<String> toolNames)
      Specified by:
      setToolNames in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • getInternalToolExecutionEnabled

      @Nullable public Boolean getInternalToolExecutionEnabled()
      Specified by:
      getInternalToolExecutionEnabled in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • setInternalToolExecutionEnabled

      public void setInternalToolExecutionEnabled(@Nullable Boolean internalToolExecutionEnabled)
      Specified by:
      setInternalToolExecutionEnabled in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • getHttpHeaders

      public Map<String,String> getHttpHeaders()
    • setHttpHeaders

      public void setHttpHeaders(Map<String,String> httpHeaders)
    • getTopK

      public Integer getTopK()
      Specified by:
      getTopK in interface org.springframework.ai.chat.prompt.ChatOptions
    • getToolContext

      public Map<String,Object> getToolContext()
      Specified by:
      getToolContext in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • setToolContext

      public void setToolContext(Map<String,Object> toolContext)
      Specified by:
      setToolContext in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • getStore

      public Boolean getStore()
    • setStore

      public void setStore(Boolean store)
    • getMetadata

      public Map<String,String> getMetadata()
    • setMetadata

      public void setMetadata(Map<String,String> metadata)
    • getReasoningEffort

      public String getReasoningEffort()
    • setReasoningEffort

      public void setReasoningEffort(String reasoningEffort)
    • getWebSearchOptions

    • setWebSearchOptions

      public void setWebSearchOptions(OpenAiApi.ChatCompletionRequest.WebSearchOptions webSearchOptions)
    • getVerbosity

      public String getVerbosity()
    • setVerbosity

      public void setVerbosity(String verbosity)
    • copy

      public OpenAiChatOptions copy()
      Specified by:
      copy in interface org.springframework.ai.chat.prompt.ChatOptions
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object