Skip to main content

PriorConfig

Struct PriorConfig 

Source
pub struct PriorConfig {
    pub provider: String,
    pub model: String,
    pub api_key_env: String,
    pub base_url: String,
    pub timeout_ms: u64,
    pub strength: f64,
    pub rungs: Vec<String>,
}
Expand description

Verified predictive routing config: a pre-generation decision-model prior (TypeSafe’s Jev today — provider is a discriminator on purpose, so a future second provider is an additive match arm, not a breaking rename) that answers, per query, “which is the least capable ladder rung that fully and correctly handles this?” The answer’s probabilities become a P(pass | rung) prior fed into the existing start-rung expected-cost argmin (crate::prior::cumulative_pass).

This is a PRIOR, not a verifier: the enforce gate still runs on every served attempt exactly as before. A confident prior can only change where the ladder starts, never whether a failing output is served. None (default) = off = byte-identical to today.

Fields§

§provider: String

Decision-model provider. Only "typesafe" is built in today; validated by Config::parse.

§model: String

Model name passed to the provider’s API.

§api_key_env: String

Env var naming the API key. Read once at startup; never logged, never put on the trace.

§base_url: String

Provider API base URL.

§timeout_ms: u64

Hard timeout for the prior call. A timeout or any other error fails open (no prior for this request, decision_prior absent, start rung falls back to the prior-free choice) — this is a cost hint, never a serving dependency.

§strength: f64

Beta pseudo-count weight: how many observations the prior is worth relative to the bandit’s own learned counts at a context. Higher = the prior dominates longer before real data overrides it. Must be finite and > 0; validated by Config::parse.

§rungs: Vec<String>

Ladder rung names, in the same order as the route’s ladder, used as the choice question’s criteria labels (r0, r1, … map to rungs[0], rungs[1], …). Must be non-empty and match the length of every enforce route’s ladder; validated by Config::parse.

Trait Implementations§

Source§

impl Clone for PriorConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PriorConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PriorConfig

Source§

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.