RetryPolicy

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

Attributes

Companion
trait
Source
RetryPolicy.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def custom(attempts: Int, delayFn: (Int, LLMError) => FiniteDuration, retryableFn: LLMError => Boolean): RetryPolicy

Custom retry policy.

Custom retry policy.

retryableFn defaults to the library's one retry rule, org.llm4s.error.LLMError.isRetryable, so a policy that only customises the delay retries exactly what the other factories' policies retry.

Attributes

Source
RetryPolicy.scala
def exponentialBackoff(maxAttempts: Int, baseDelay: FiniteDuration, maxDelay: FiniteDuration): RetryPolicy

Exponential backoff: 2^n * baseDelay.

Exponential backoff: 2^n * baseDelay.

Example: baseDelay=1s → 1s, 2s, 4s, 8s, ...

Attributes

Source
RetryPolicy.scala
def fixedDelay(maxAttempts: Int, delay: FiniteDuration): RetryPolicy

Fixed delay: always wait the same amount of time.

Fixed delay: always wait the same amount of time.

Example: delay=3s → 3s, 3s, 3s, ...

Attributes

Source
RetryPolicy.scala
def linearBackoff(maxAttempts: Int, baseDelay: FiniteDuration): RetryPolicy

Linear backoff: attemptNumber * baseDelay.

Linear backoff: attemptNumber * baseDelay.

Example: baseDelay=2s → 2s, 4s, 6s, 8s, ...

Attributes

Source
RetryPolicy.scala

No retry: fail immediately on first error.

No retry: fail immediately on first error.

Attributes

Source
RetryPolicy.scala

Concrete fields

How long a backoff policy waits after a org.llm4s.error.RateLimitError whose provider gave no Retry-After: the library's own guess, longer than the first steps of a backoff because a rate-limit window rarely reopens within a second or two. A delay the provider did give (error.retryAfter) is used as it is.

How long a backoff policy waits after a org.llm4s.error.RateLimitError whose provider gave no Retry-After: the library's own guess, longer than the first steps of a backoff because a rate-limit window rarely reopens within a second or two. A delay the provider did give (error.retryAfter) is used as it is.

Attributes

Source
RetryPolicy.scala