pub struct FeedbackEvent {
pub corpus_id: String,
pub query_id: String,
pub score: f64,
pub timestamp: String,
}Expand description
One user-supplied satisfaction signal attached to a specific query.
score is a normalized scalar in [0, 1]:
1.0= perfect, user got exactly what they wanted.0.5= neutral / ambiguous.0.0= wrong, unhelpful, or actively misleading.
Upstream mapping (stars to [0, 1], CTR to [0, 1], etc.) is the
caller’s responsibility — the aggregator just computes statistics on
whatever scalar you supply.
Fields§
§corpus_id: StringMust match the corpus_id of the MetaTrainingRecord
the pipeline was built from.
query_id: StringCaller-supplied query identifier. Free-form; used for deduping and auditing. An empty string is allowed.
score: f64Satisfaction signal in [0, 1]. Clamped at read time by
FeedbackAggregator::summarize; store raw values if you want.
timestamp: StringFree-form timestamp string. Seconds-since-epoch by default from
FeedbackEvent::now; swap in your own format as needed.
Implementations§
Source§impl FeedbackEvent
impl FeedbackEvent
Sourcepub fn now(
corpus_id: impl Into<String>,
query_id: impl Into<String>,
score: f64,
) -> Self
pub fn now( corpus_id: impl Into<String>, query_id: impl Into<String>, score: f64, ) -> Self
Construct with a default timestamp (epoch seconds).
Sourcepub fn append_to_default_store(&self) -> Result<PathBuf>
pub fn append_to_default_store(&self) -> Result<PathBuf>
Append this event to the user’s default feedback store
(~/.sphereql/feedback_events.json).
O(1) per call: opens the file in append mode and writes one JSON-encoded line. Previous implementation loaded the full aggregator, pushed the event, and rewrote the file — O(N) per append, which mattered on a production firehose. Legacy array-format stores are migrated to JSONL on the first append (one-time O(N) cost) and append at O(1) afterward.
Mirrors MetaTrainingRecord::append_to_default_store
— both are instance methods on the data they persist.
Trait Implementations§
Source§impl Clone for FeedbackEvent
impl Clone for FeedbackEvent
Source§fn clone(&self) -> FeedbackEvent
fn clone(&self) -> FeedbackEvent
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 FeedbackEvent
impl Debug for FeedbackEvent
Source§impl<'de> Deserialize<'de> for FeedbackEvent
impl<'de> Deserialize<'de> for FeedbackEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for FeedbackEvent
impl RefUnwindSafe for FeedbackEvent
impl Send for FeedbackEvent
impl Sync for FeedbackEvent
impl Unpin for FeedbackEvent
impl UnsafeUnpin for FeedbackEvent
impl UnwindSafe for FeedbackEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more