pub struct ContextReason {
pub source: String,
pub reason: String,
pub relevance_score: f64,
pub tokens_estimate: usize,
pub metadata: HashMap<String, Value>,
}Expand description
Documents why a context piece was included.
This is the key to traceability – every piece of context should have a clear reason for inclusion that can be logged and debugged.
Fields§
§source: String§reason: String§relevance_score: f64§tokens_estimate: usize§metadata: HashMap<String, Value>Implementations§
Source§impl ContextReason
impl ContextReason
pub fn new(source: &str, reason: &str) -> Self
pub fn with_tokens(self, tokens: usize) -> Self
pub fn with_score(self, score: f64) -> Self
Trait Implementations§
Source§impl Clone for ContextReason
impl Clone for ContextReason
Source§fn clone(&self) -> ContextReason
fn clone(&self) -> ContextReason
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContextReason
impl Debug for ContextReason
Source§impl<'de> Deserialize<'de> for ContextReason
impl<'de> Deserialize<'de> for ContextReason
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ContextReason
impl Display for ContextReason
Auto Trait Implementations§
impl Freeze for ContextReason
impl RefUnwindSafe for ContextReason
impl Send for ContextReason
impl Sync for ContextReason
impl Unpin for ContextReason
impl UnsafeUnpin for ContextReason
impl UnwindSafe for ContextReason
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
Mutably borrows from an owned value. Read more