pub struct RateLimitInfo {
pub retry_after_secs: Option<u64>,
pub requests_remaining: Option<u32>,
pub tokens_remaining: Option<u32>,
pub requests_reset: Option<String>,
pub tokens_reset: Option<String>,
pub limit_type: Option<RateLimitType>,
}Expand description
Rate limit information extracted from provider response headers
Fields§
§retry_after_secs: Option<u64>Retry-After header value (seconds to wait)
requests_remaining: Option<u32>Requests remaining before limit
tokens_remaining: Option<u32>Tokens remaining before limit
requests_reset: Option<String>Time until request limit resets
tokens_reset: Option<String>Time until token limit resets
limit_type: Option<RateLimitType>Provider-specific limit type that was hit
Implementations§
Source§impl RateLimitInfo
impl RateLimitInfo
Sourcepub fn recommended_wait(
&self,
config: &LlmRetryConfig,
attempt: u32,
) -> Duration
pub fn recommended_wait( &self, config: &LlmRetryConfig, attempt: u32, ) -> Duration
Get the recommended wait duration, preferring retry-after if available. Caps retry-after at MAX_RETRY_AFTER_SECS (60s) like official SDKs.
Sourcepub fn from_anthropic_headers(headers: &HeaderMap) -> RateLimitInfo
pub fn from_anthropic_headers(headers: &HeaderMap) -> RateLimitInfo
Parse rate limit info from Anthropic response headers
Sourcepub fn from_openai_headers(headers: &HeaderMap) -> RateLimitInfo
pub fn from_openai_headers(headers: &HeaderMap) -> RateLimitInfo
Parse rate limit info from OpenAI-compatible response headers.
Trait Implementations§
Source§impl Clone for RateLimitInfo
impl Clone for RateLimitInfo
Source§fn clone(&self) -> RateLimitInfo
fn clone(&self) -> RateLimitInfo
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RateLimitInfo
impl Debug for RateLimitInfo
Source§impl Default for RateLimitInfo
impl Default for RateLimitInfo
Source§fn default() -> RateLimitInfo
fn default() -> RateLimitInfo
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RateLimitInfo
impl RefUnwindSafe for RateLimitInfo
impl Send for RateLimitInfo
impl Sync for RateLimitInfo
impl Unpin for RateLimitInfo
impl UnsafeUnpin for RateLimitInfo
impl UnwindSafe for RateLimitInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request