Record Class JevConfig

java.lang.Object
java.lang.Record
xyz.tcheeric.jev.JevConfig

public record JevConfig(URI baseUri, String apiToken, String model, Duration requestTimeout, RetryPolicy retryPolicy) extends Record
Everything the client needs that is not a question: where the evaluator lives, which model answers, how long to wait, and how hard to retry.

The bearer token is passed in rather than read here, but the intended source is the environment. It is never logged and never appears in an exception message.

  • Field Details

    • DEFAULT_MODEL

      public static final String DEFAULT_MODEL
      A pinned, versioned model. The moving aliases jev-latest and jev-preview are refused, because an upstream release would silently change answers a consumer has already calibrated thresholds against. The API's own docs give the same advice to anyone who has tuned confidence thresholds.
      See Also:
    • DEFAULT_BASE_URI

      public static final URI DEFAULT_BASE_URI
    • DEFAULT_REQUEST_TIMEOUT

      public static final Duration DEFAULT_REQUEST_TIMEOUT
  • Constructor Details

    • JevConfig

      public JevConfig(URI baseUri, String apiToken, String model, Duration requestTimeout, RetryPolicy retryPolicy)
      Creates an instance of a JevConfig record class.
      Parameters:
      baseUri - the value for the baseUri record component
      apiToken - the value for the apiToken record component
      model - the value for the model record component
      requestTimeout - the value for the requestTimeout record component
      retryPolicy - the value for the retryPolicy record component
  • Method Details

    • of

      public static JevConfig of(URI baseUri, String apiToken)
    • of

      public static JevConfig of(String apiToken)
      The public evaluator at DEFAULT_BASE_URI.
    • withModel

      public JevConfig withModel(String model)
    • withRequestTimeout

      public JevConfig withRequestTimeout(Duration requestTimeout)
    • withRetryPolicy

      public JevConfig withRetryPolicy(RetryPolicy retryPolicy)
    • toString

      public String toString()
      Keeps the token out of logs and crash dumps. A record's generated toString would print it.
      Specified by:
      toString in class Record
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • baseUri

      public URI baseUri()
      Returns the value of the baseUri record component.
      Returns:
      the value of the baseUri record component
    • apiToken

      public String apiToken()
      Returns the value of the apiToken record component.
      Returns:
      the value of the apiToken record component
    • model

      public String model()
      Returns the value of the model record component.
      Returns:
      the value of the model record component
    • requestTimeout

      public Duration requestTimeout()
      Returns the value of the requestTimeout record component.
      Returns:
      the value of the requestTimeout record component
    • retryPolicy

      public RetryPolicy retryPolicy()
      Returns the value of the retryPolicy record component.
      Returns:
      the value of the retryPolicy record component