pub struct ProviderPoolBuilder { /* private fields */ }Expand description
Builds a ProviderPool.
Implementations§
Source§impl ProviderPoolBuilder
impl ProviderPoolBuilder
Sourcepub fn provider(self, provider: Arc<dyn ModelProvider>) -> Self
pub fn provider(self, provider: Arc<dyn ModelProvider>) -> Self
Adds a provider, taking its routing profile from
ModelProvider::profile.
Sourcepub fn provider_tagged<I, T>(
self,
provider: Arc<dyn ModelProvider>,
tags: I,
) -> Self
pub fn provider_tagged<I, T>( self, provider: Arc<dyn ModelProvider>, tags: I, ) -> Self
Registers a provider with extra tags on its profile, which is how a deployment names
its tiers (small, large) for RoutingPolicy::with_required_tag.
Sourcepub fn provider_with_profile(
self,
provider: Arc<dyn ModelProvider>,
profile: ModelProfile,
) -> Self
pub fn provider_with_profile( self, provider: Arc<dyn ModelProvider>, profile: ModelProfile, ) -> Self
Adds a provider with an explicit routing profile, for a deployment that knows a price or a region the adapter does not.
The profile’s declared capabilities are the ones routing trusts, so a deployment may narrow them; widening them past what the adapter reports is how a silent downgrade gets built by hand.
Sourcepub fn clock<C: Clock + 'static>(self, clock: Arc<C>) -> Self
pub fn clock<C: Clock + 'static>(self, clock: Arc<C>) -> Self
Injects a clock, so health windows can be driven deterministically.
Sourcepub fn health_policy(self, policy: HealthPolicy) -> Self
pub fn health_policy(self, policy: HealthPolicy) -> Self
Sets the health policy.
Sourcepub fn build(self) -> Result<ProviderPool, PoolError>
pub fn build(self) -> Result<ProviderPool, PoolError>
Builds the pool.
§Errors
Returns PoolError::DuplicateProfile when two entries claim the same
provider-model pair, because health and routing key on that pair and a
duplicate would make both ambiguous.