Skip to main content

BeforeModelDecision

Enum BeforeModelDecision 

Source
pub enum BeforeModelDecision {
    Continue,
    Modify(Request),
    ShortCircuit(Assistant),
    Abort(String),
}
Expand description

ModelHooks::before_model decision.

Self::Modify is where a composition layer normalises history for the provider it is about to call. Core applies visibility and the tool-exchange grammar and stops there: it never rewrites a Segment because a different provider produced it, because deciding that one vendor’s thinking segment is unusable by another requires knowing both vendors’ rules — a compat matrix core does not and must not learn. A registration that changes model mid-session reads BeforeModelScope::request, rewrites the segments its next provider cannot accept, and re-freezes through RequestPlan::try_into_request, which is the only way to construct a Request and therefore cannot be bypassed.

Variants§

§

Continue

Continue with the current request.

§

Modify(Request)

Replace the request after runtime validation.

§

ShortCircuit(Assistant)

Supply assistant output without invoking the model.

AfterModelScope::generated is false, its AfterModelScope::finish_reason is empty because no provider supplied a label, and its completion classification is CompletionReason::Unknown.

Tool-call identities and names must be nonempty. Model-visible identities may not repeat either within this record or anywhere in the frozen request history. The runtime rejects an invalid value as a typed, registration-attributed hook failure before anything is committed.

§

Abort(String)

Deliberately abort model invocation.

Trait Implementations§

Source§

impl Debug for BeforeModelDecision

Source§

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

Formats the value using the given formatter. 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> 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 = !

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.