Record Class DecisionModelProvider.OpenAi

Object
Record
akka.javasdk.decision.DecisionModelProvider.OpenAi
Record Components:
apiKey - the API key, sent as a bearer token. A call without an API key fails.
modelName - the model name, for example gpt-6-luna
baseUrl - the base URL of the API, including the version path, for example https://api.openai.com/v1
connectionTimeout - fail the request when connecting takes longer than this
responseTimeout - fail the request when the answer takes longer than this. The timeout applies to each attempt.
maxRetries - if the request fails with a rate limit, a server error, a timeout or a connection failure, retry this many times
additionalModelRequestHeaders - HTTP headers added to each request
All Implemented Interfaces:
DecisionModelProvider
Enclosing interface:
DecisionModelProvider

public static record DecisionModelProvider.OpenAi(String apiKey, String modelName, String baseUrl, Duration connectionTimeout, Duration responseTimeout, int maxRetries, List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders) extends Record implements DecisionModelProvider
A model of the OpenAI Decisions API. The request goes to /decisions under the base URL.
  • Constructor Details

    • OpenAi

      public OpenAi(String apiKey, String modelName, String baseUrl, Duration connectionTimeout, Duration responseTimeout, int maxRetries, List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders)
      Creates an instance of a OpenAi record class.
      Parameters:
      apiKey - the value for the apiKey record component
      modelName - the value for the modelName record component
      baseUrl - the value for the baseUrl record component
      connectionTimeout - the value for the connectionTimeout record component
      responseTimeout - the value for the responseTimeout record component
      maxRetries - the value for the maxRetries record component
      additionalModelRequestHeaders - the value for the additionalModelRequestHeaders record component
  • Method Details

    • fromConfig

      public static DecisionModelProvider.OpenAi fromConfig(com.typesafe.config.Config config)
      Read the provider from a configuration section such as openai.
    • withApiKey

      public DecisionModelProvider.OpenAi withApiKey(String apiKey)
    • withModelName

      public DecisionModelProvider.OpenAi withModelName(String modelName)
    • withBaseUrl

      public DecisionModelProvider.OpenAi withBaseUrl(String baseUrl)
    • withConnectionTimeout

      public DecisionModelProvider.OpenAi withConnectionTimeout(Duration connectionTimeout)
    • withResponseTimeout

      public DecisionModelProvider.OpenAi withResponseTimeout(Duration responseTimeout)
    • withMaxRetries

      public DecisionModelProvider.OpenAi withMaxRetries(int maxRetries)
    • withAdditionalModelRequestHeaders

      public DecisionModelProvider.OpenAi withAdditionalModelRequestHeaders(List<akka.http.javadsl.model.HttpHeader> headers)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • apiKey

      public String apiKey()
      Returns the value of the apiKey record component.
      Returns:
      the value of the apiKey record component
    • modelName

      public String modelName()
      Returns the value of the modelName record component.
      Returns:
      the value of the modelName record component
    • baseUrl

      public String baseUrl()
      Returns the value of the baseUrl record component.
      Returns:
      the value of the baseUrl record component
    • connectionTimeout

      public Duration connectionTimeout()
      Returns the value of the connectionTimeout record component.
      Returns:
      the value of the connectionTimeout record component
    • responseTimeout

      public Duration responseTimeout()
      Returns the value of the responseTimeout record component.
      Returns:
      the value of the responseTimeout record component
    • maxRetries

      public int maxRetries()
      Returns the value of the maxRetries record component.
      Returns:
      the value of the maxRetries record component
    • additionalModelRequestHeaders

      public List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders()
      Returns the value of the additionalModelRequestHeaders record component.
      Returns:
      the value of the additionalModelRequestHeaders record component