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
impl LoopGuardTripEvent
Sourcepub fn new(
recorded_at_secs: u64,
model_name: &str,
detector: LoopGuardTrip,
mode: LoopGuardMode,
) -> Self
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.
Sourcepub fn with_signature(self, signature: &str) -> Self
pub fn with_signature(self, signature: &str) -> Self
The repeated tool-call batch’s signature, kept only as its hash.
Sourcepub fn with_session(self, session_id: &str) -> Self
pub fn with_session(self, session_id: &str) -> Self
The request’s session id, kept only as its hash.
Sourcepub const fn with_repeats(self, count: u32, threshold: u32) -> Self
pub const fn with_repeats(self, count: u32, threshold: u32) -> Self
How many times the reply repeated, and the threshold it crossed.
Sourcepub const fn recorded_at_secs(&self) -> u64
pub const fn recorded_at_secs(&self) -> u64
When the decision was taken, in seconds since the Unix epoch.
Sourcepub fn model_name(&self) -> &str
pub fn model_name(&self) -> &str
The model the request named, bounded.
Sourcepub const fn detector(&self) -> LoopGuardTrip
pub const fn detector(&self) -> LoopGuardTrip
Which detector tripped.
Sourcepub const fn mode(&self) -> LoopGuardMode
pub const fn mode(&self) -> LoopGuardMode
The mode the decision was taken under.
Sourcepub fn signature_hash(&self) -> Option<&str>
pub fn signature_hash(&self) -> Option<&str>
The signature’s hash, for a loop.
Sourcepub fn session_hash(&self) -> Option<&str>
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.
Sourcepub const fn repeat_count(&self) -> Option<u32>
pub const fn repeat_count(&self) -> Option<u32>
How many times the reply repeated, for stagnation.
Trait Implementations§
Source§impl Clone for LoopGuardTripEvent
impl Clone for LoopGuardTripEvent
Source§fn clone(&self) -> LoopGuardTripEvent
fn clone(&self) -> LoopGuardTripEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LoopGuardTripEvent
impl Debug for LoopGuardTripEvent
Source§impl PartialEq for LoopGuardTripEvent
impl PartialEq for LoopGuardTripEvent
Source§fn eq(&self, other: &LoopGuardTripEvent) -> bool
fn eq(&self, other: &LoopGuardTripEvent) -> bool
self and other values to be equal, and is used by ==.