pub struct ContextPiece {
pub content: String,
pub reason: ContextReason,
pub category: ContextCategory,
pub order: i32,
}Expand description
A single piece of context to include in the LLM call.
Fields§
§content: String§reason: ContextReason§category: ContextCategory§order: i32Ordering hint (lower = earlier in context).
Implementations§
Source§impl ContextPiece
impl ContextPiece
pub fn new( content: String, reason: ContextReason, category: ContextCategory, ) -> Self
pub fn with_order(self, order: i32) -> Self
Sourcepub fn tokens_estimate(&self) -> usize
pub fn tokens_estimate(&self) -> usize
Estimated token count (from reason or calculated).
Trait Implementations§
Source§impl Clone for ContextPiece
impl Clone for ContextPiece
Source§fn clone(&self) -> ContextPiece
fn clone(&self) -> ContextPiece
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 ContextPiece
impl Debug for ContextPiece
Source§impl<'de> Deserialize<'de> for ContextPiece
impl<'de> Deserialize<'de> for ContextPiece
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 ContextPiece
impl Display for ContextPiece
Auto Trait Implementations§
impl Freeze for ContextPiece
impl RefUnwindSafe for ContextPiece
impl Send for ContextPiece
impl Sync for ContextPiece
impl Unpin for ContextPiece
impl UnsafeUnpin for ContextPiece
impl UnwindSafe for ContextPiece
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