Enum LlmException.ErrorType

java.lang.Object
java.lang.Enum<LlmException.ErrorType>
com.codename1.ai.LlmException.ErrorType
All Implemented Interfaces:
Comparable<LlmException.ErrorType>
Enclosing class:
LlmException

public static enum LlmException.ErrorType extends Enum<LlmException.ErrorType>
Coarse-grained classification of every failure path the client can surface. Stable -- new variants are appended at the end; existing variants do not change semantics.
  • Enum Constant Details

    • AUTH

      public static final LlmException.ErrorType AUTH
      401 / 403 -- API key invalid, revoked, or lacks access to the requested model.
    • RATE_LIMIT

      public static final LlmException.ErrorType RATE_LIMIT
      429 -- rate limit hit. Pair with LlmException.getRetryAfterSeconds() to honour the provider's backoff hint when available.
    • INVALID_REQUEST

      public static final LlmException.ErrorType INVALID_REQUEST
      400 / 422 -- malformed request, unsupported parameter, image too large, etc.
    • CONTEXT_LENGTH

      public static final LlmException.ErrorType CONTEXT_LENGTH
      400 subtype -- the conversation exceeded the model's context window. Drop older turns and retry, or switch to a longer-context model.
    • MODEL_OVERLOADED

      public static final LlmException.ErrorType MODEL_OVERLOADED
      503 / 529 -- the model is temporarily overloaded. Same recovery as RATE_LIMIT but a different signal source.
    • SERVER

      public static final LlmException.ErrorType SERVER
      5xx other than 503 / 529 -- provider had an internal error.
    • NETWORK

      public static final LlmException.ErrorType NETWORK
      DNS, TLS, read-timeout, connection reset -- the request did not reach the provider or did not get a response back.
    • UNKNOWN

      public static final LlmException.ErrorType UNKNOWN
      Any failure that doesn't fit the categories above (e.g. JSON parsing of the response failed). Treat as a generic programming error and log LlmException.getRawBody().
  • Method Details

    • values

      public static LlmException.ErrorType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static LlmException.ErrorType valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null