Skip to main content

PinnedClient

Struct PinnedClient 

Source
pub struct PinnedClient { /* private fields */ }
Expand description

InferenceClient middleware enforcing a ModelPin.

Implementations§

Source§

impl PinnedClient

Source

pub fn new( inner: Arc<dyn InferenceClient>, resolver: Arc<dyn ModelResolver>, ) -> Self

Source

pub fn pin_model(self, pin: ModelPin) -> Self

Pin the model (see crate::Agent wiring as pin_model).

Source

pub fn strict(self, strict: bool) -> Self

Require a pin to be set, else refuse to run.

Source

pub fn refuse_on_drift(self, refuse: bool) -> Self

Make drift a hard refusal in addition to an emitted event.

Source

pub fn with_telemetry( self, telemetry: Telemetry, run_id: impl Into<String>, ) -> Self

Source

pub fn pin(&self) -> Option<&ModelPin>

The pin this client carries, if any (for stamping into records).

Source

pub fn revalidate(&self) -> Option<DriftKind>

Re-validate the pin against a freshly resolved version (heartbeat). Returns the drift kind if the provider has drifted.

Trait Implementations§

Source§

impl InferenceClient for PinnedClient

Source§

fn provider(&self) -> Provider

Source§

fn run<'life0, 'async_trait>( &'life0 self, batch: ExecuteBatch, ) -> Pin<Box<dyn Future<Output = Result<TurnResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.