Interface RateLimit
- All Known Implementing Classes:
EmptyRateLimit
,OpenAiRateLimit
public interface RateLimit
Abstract Data Type (ADT) encapsulating metadata from an AI provider's API rate limits
granted to the API key in use and the API key's current balance.
- Since:
- 0.7.0
- Author:
- John Blum
-
Method Summary
Modifier and TypeMethodDescriptionReturns the maximum number of requests that are permitted before exhausting the rate limit.Returns the remaining number of requests that are permitted before exhausting therate limit
.Returns thetime
until the rate limit (based on requests) resets to itsinitial state
.Returns the maximum number of tokens that are permitted before exhausting the rate limit.Returns the remaining number of tokens that are permitted before exhausting therate limit
.Returns thetime
until the rate limit (based on tokens) resets to itsinitial state
.
-
Method Details
-
getRequestsLimit
Long getRequestsLimit()Returns the maximum number of requests that are permitted before exhausting the rate limit.- Returns:
- an
Long
with the maximum number of requests that are permitted before exhausting the rate limit. - See Also:
-
getRequestsRemaining
Long getRequestsRemaining()Returns the remaining number of requests that are permitted before exhausting therate limit
.- Returns:
- an
Long
with the remaining number of requests that are permitted before exhausting therate limit
. - See Also:
-
getRequestsReset
Duration getRequestsReset()Returns thetime
until the rate limit (based on requests) resets to itsinitial state
.- Returns:
- a
Duration
representing the time until the rate limit (based on requests) resets to itsinitial state
. - See Also:
-
getTokensLimit
Long getTokensLimit()Returns the maximum number of tokens that are permitted before exhausting the rate limit.- Returns:
- an
Long
with the maximum number of tokens that are permitted before exhausting the rate limit. - See Also:
-
getTokensRemaining
Long getTokensRemaining()Returns the remaining number of tokens that are permitted before exhausting therate limit
.- Returns:
- an
Long
with the remaining number of tokens that are permitted before exhausting therate limit
. - See Also:
-
getTokensReset
Duration getTokensReset()Returns thetime
until the rate limit (based on tokens) resets to itsinitial state
.- Returns:
- a
Duration
with the time until the rate limit (based on tokens) resets to itsinitial state
. - See Also:
-