Skip to main content

LoopGuardTripEvent

Struct LoopGuardTripEvent 

Source
pub struct LoopGuardTripEvent {
    recorded_at_secs: u64,
    model_name: String,
    detector: LoopGuardTrip,
    mode: LoopGuardMode,
    signature_hash: Option<String>,
    session_hash: Option<String>,
    repeat_count: Option<u32>,
    threshold: Option<u32>,
}
Expand description

One decision the loop guard took about one request.

Its hashed fields have no setter that takes a hash: the only way in is the text itself, through Self::with_signature and Self::with_session, which keep the hash and drop the text. A row therefore cannot hold a signature or a session id by construction, not by convention.

Fields§

§recorded_at_secs: u64§model_name: String§detector: LoopGuardTrip§mode: LoopGuardMode§signature_hash: Option<String>§session_hash: Option<String>§repeat_count: Option<u32>§threshold: Option<u32>

Implementations§

Source§

impl LoopGuardTripEvent

Source

pub fn new( recorded_at_secs: u64, model_name: &str, detector: LoopGuardTrip, mode: LoopGuardMode, ) -> Self

A decision taken at recorded_at_secs by detector under mode: LoopGuardMode::Note decided to forward the request with a note, LoopGuardMode::Refuse refused it. Never LoopGuardMode::Off, which scans nothing and so decides nothing.

Source

pub fn with_signature(self, signature: &str) -> Self

The repeated tool-call batch’s signature, kept only as its hash.

Source

pub fn with_session(self, session_id: &str) -> Self

The request’s session id, kept only as its hash.

Source

pub const fn with_repeats(self, count: u32, threshold: u32) -> Self

How many times the reply repeated, and the threshold it crossed.

Source

pub const fn recorded_at_secs(&self) -> u64

When the decision was taken, in seconds since the Unix epoch.

Source

pub fn model_name(&self) -> &str

The model the request named, bounded.

Source

pub const fn detector(&self) -> LoopGuardTrip

Which detector tripped.

Source

pub const fn mode(&self) -> LoopGuardMode

The mode the decision was taken under.

Source

pub fn signature_hash(&self) -> Option<&str>

The signature’s hash, for a loop.

Source

pub fn session_hash(&self) -> Option<&str>

The session id’s hash: the client’s x-gglib-session-id, or the one gglib derives from the conversation’s opening when there is none.

Source

pub const fn repeat_count(&self) -> Option<u32>

How many times the reply repeated, for stagnation.

Source

pub const fn threshold(&self) -> Option<u32>

The threshold that count crossed, for stagnation.

Trait Implementations§

Source§

impl Clone for LoopGuardTripEvent

Source§

fn clone(&self) -> LoopGuardTripEvent

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 LoopGuardTripEvent

Source§

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

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

impl PartialEq for LoopGuardTripEvent

Source§

fn eq(&self, other: &LoopGuardTripEvent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for LoopGuardTripEvent

Source§

impl StructuralPartialEq for LoopGuardTripEvent

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = 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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more