java.lang.Object
java.lang.Record
com.agentforge4j.llm.api.LlmRetryPolicy
public record LlmRetryPolicy(int maxAttempts, long baseBackoffMs, long maxBackoffMs, long maxElapsedMs)
extends Record
Immutable retry settings for a retrying LLM client: attempt cap, decorrelated jitter bounds, and
optional total elapsed budget.
-
Constructor Summary
ConstructorsConstructorDescriptionLlmRetryPolicy(int maxAttempts, long baseBackoffMs, long maxBackoffMs, long maxElapsedMs) Creates a retry policy with the given parameters, validating that they are within expected bounds. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the value of thebaseBackoffMsrecord component.static LlmRetryPolicydefaults()Default retry policy: 3 attempts, 200ms base backoff, 10s max backoff, 30s total elapsed budget.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxAttemptsrecord component.longReturns the value of themaxBackoffMsrecord component.longReturns the value of themaxElapsedMsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
LlmRetryPolicy
public LlmRetryPolicy(int maxAttempts, long baseBackoffMs, long maxBackoffMs, long maxElapsedMs) Creates a retry policy with the given parameters, validating that they are within expected bounds.- Parameters:
maxAttempts- Max retry attempts (must be >= 1)baseBackoffMs- Base backoff in ms for decorrelated jitter (must be >= 0)maxBackoffMs- Max backoff in ms for decorrelated jitter (must be >= baseBackoffMs)maxElapsedMs- Optional total elapsed budget in ms for all attempts (must be >= 0)
-
-
Method Details
-
defaults
Default retry policy: 3 attempts, 200ms base backoff, 10s max backoff, 30s total elapsed budget. -
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. -
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. -
equals
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 '=='. -
maxAttempts
public int maxAttempts()Returns the value of themaxAttemptsrecord component.- Returns:
- the value of the
maxAttemptsrecord component
-
baseBackoffMs
public long baseBackoffMs()Returns the value of thebaseBackoffMsrecord component.- Returns:
- the value of the
baseBackoffMsrecord component
-
maxBackoffMs
public long maxBackoffMs()Returns the value of themaxBackoffMsrecord component.- Returns:
- the value of the
maxBackoffMsrecord component
-
maxElapsedMs
public long maxElapsedMs()Returns the value of themaxElapsedMsrecord component.- Returns:
- the value of the
maxElapsedMsrecord component
-