pub struct RateLimitedProvider { /* private fields */ }Expand description
An InferenceProvider that paces calls to a steady rate.
Implementations§
Source§impl RateLimitedProvider
impl RateLimitedProvider
Sourcepub fn new(
inner: Arc<dyn InferenceProvider>,
requests_per_second: NonZeroU32,
) -> Self
pub fn new( inner: Arc<dyn InferenceProvider>, requests_per_second: NonZeroU32, ) -> Self
Wrap inner, limiting to requests_per_second (burst up to the same).
Trait Implementations§
Source§impl InferenceProvider for RateLimitedProvider
impl InferenceProvider for RateLimitedProvider
Source§fn infer_batch<'life0, 'async_trait>(
&'life0 self,
request: InferenceRequest,
) -> Pin<Box<dyn Future<Output = Result<InferenceResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn infer_batch<'life0, 'async_trait>(
&'life0 self,
request: InferenceRequest,
) -> Pin<Box<dyn Future<Output = Result<InferenceResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Run one batch of inputs through the model. Read more
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
Stable backend-kind identity for logging and the
laminar.ai_calls
log (e.g. anthropic, openai, local). Constant per implementor.Source§fn intrinsic_labels(&self, model: &str) -> Option<Vec<String>>
fn intrinsic_labels(&self, model: &str) -> Option<Vec<String>>
Classifier labels intrinsic to a model, discovered from its own metadata.
Returns
None for backends that have none (remote providers, embedding
models). A local classifier returns its config.json id2label once the
model is on disk — the seam that lets a lazily downloaded classifier score
without the labels having been known at startup. The default is None.Auto Trait Implementations§
impl !Freeze for RateLimitedProvider
impl !RefUnwindSafe for RateLimitedProvider
impl Send for RateLimitedProvider
impl Sync for RateLimitedProvider
impl Unpin for RateLimitedProvider
impl UnsafeUnpin for RateLimitedProvider
impl !UnwindSafe for RateLimitedProvider
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more