pub struct ProviderBandit {
pub arms: HashMap<String, ProviderArm>,
}Expand description
Per-provider arms, keyed by task type (e.g., “bugfix”, “feature”, “refactor”).
Fields§
§arms: HashMap<String, ProviderArm>Implementations§
Source§impl ProviderBandit
impl ProviderBandit
pub fn new() -> Self
Sourcepub fn select_provider(
&mut self,
task_type: &str,
available_providers: &[String],
) -> Option<String>
pub fn select_provider( &mut self, task_type: &str, available_providers: &[String], ) -> Option<String>
Select the best provider for a given task type using Thompson Sampling. Returns the provider_id with the highest sampled value.
Sourcepub fn update(&mut self, task_type: &str, provider_id: &str, was_useful: bool)
pub fn update(&mut self, task_type: &str, provider_id: &str, was_useful: bool)
Update the bandit after observing the outcome of a provider query.
Sourcepub fn estimated_probability(&self, task_type: &str, provider_id: &str) -> f64
pub fn estimated_probability(&self, task_type: &str, provider_id: &str) -> f64
Get the estimated success probability for a provider on a task type.
Sourcepub fn format_report(&self) -> String
pub fn format_report(&self) -> String
Format a summary of all arms for debugging/logging.
Trait Implementations§
Source§impl Clone for ProviderBandit
impl Clone for ProviderBandit
Source§fn clone(&self) -> ProviderBandit
fn clone(&self) -> ProviderBandit
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 ProviderBandit
impl Debug for ProviderBandit
Source§impl Default for ProviderBandit
impl Default for ProviderBandit
Source§impl<'de> Deserialize<'de> for ProviderBandit
impl<'de> Deserialize<'de> for ProviderBandit
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ProviderBandit
impl RefUnwindSafe for ProviderBandit
impl Send for ProviderBandit
impl Sync for ProviderBandit
impl Unpin for ProviderBandit
impl UnsafeUnpin for ProviderBandit
impl UnwindSafe for ProviderBandit
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more