Class OpenAiRateLimit
java.lang.Object
org.springframework.ai.openai.metadata.OpenAiRateLimit
- All Implemented Interfaces:
RateLimit
RateLimit
implementation for OpenAI.- Since:
- 0.7.0
- Author:
- John Blum
- See Also:
-
Constructor Summary
-
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
.toString()
-
Constructor Details
-
OpenAiRateLimit
-
-
Method Details
-
getRequestsLimit
Description copied from interface:RateLimit
Returns the maximum number of requests that are permitted before exhausting the rate limit.- Specified by:
getRequestsLimit
in interfaceRateLimit
- Returns:
- an
Long
with the maximum number of requests that are permitted before exhausting the rate limit. - See Also:
-
getTokensLimit
Description copied from interface:RateLimit
Returns the maximum number of tokens that are permitted before exhausting the rate limit.- Specified by:
getTokensLimit
in interfaceRateLimit
- Returns:
- an
Long
with the maximum number of tokens that are permitted before exhausting the rate limit. - See Also:
-
getRequestsRemaining
Description copied from interface:RateLimit
Returns the remaining number of requests that are permitted before exhausting therate limit
.- Specified by:
getRequestsRemaining
in interfaceRateLimit
- Returns:
- an
Long
with the remaining number of requests that are permitted before exhausting therate limit
. - See Also:
-
getTokensRemaining
Description copied from interface:RateLimit
Returns the remaining number of tokens that are permitted before exhausting therate limit
.- Specified by:
getTokensRemaining
in interfaceRateLimit
- Returns:
- an
Long
with the remaining number of tokens that are permitted before exhausting therate limit
. - See Also:
-
getRequestsReset
Description copied from interface:RateLimit
Returns thetime
until the rate limit (based on requests) resets to itsinitial state
.- Specified by:
getRequestsReset
in interfaceRateLimit
- Returns:
- a
Duration
representing the time until the rate limit (based on requests) resets to itsinitial state
. - See Also:
-
getTokensReset
Description copied from interface:RateLimit
Returns thetime
until the rate limit (based on tokens) resets to itsinitial state
.- Specified by:
getTokensReset
in interfaceRateLimit
- Returns:
- a
Duration
with the time until the rate limit (based on tokens) resets to itsinitial state
. - See Also:
-
toString
-