RetryPolicy

org.llm4s.reliability.RetryPolicy
See theRetryPolicy companion object
sealed trait RetryPolicy

Retry policy for transient failures.

Defines how many times to retry and how long to wait between attempts.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def delayFor(attemptNumber: Int, error: LLMError): Duration

Calculate delay before next retry attempt.

Calculate delay before next retry attempt.

Value parameters

attemptNumber

The attempt number (1-indexed)

error

The error that triggered the retry

Attributes

Returns

Delay duration before next attempt

def maxAttempts: Int

Maximum number of retry attempts

Maximum number of retry attempts

Attributes

Concrete methods

def isRetryable(error: LLMError): Boolean

Check if an error is retryable.

Check if an error is retryable.

Retryable errors:

  • RateLimitError (429)
  • TimeoutError
  • ServiceError with 5xx, 429, or 408 status codes
  • NetworkError

Non-retryable errors:

  • ServiceError with 4xx status (except 408/429) - client errors
  • AuthenticationError
  • ValidationError
  • Other errors

Attributes