pub struct DropReasoningStrategy { /* private fields */ }Expand description
Strategy that removes Part::Reasoning parts from every item.
Reasoning parts contain chain-of-thought content that is useful during generation but rarely needed once the answer has been produced. Stripping them reduces transcript size without losing user-visible content.
When drop_empty_items is true (the default), items that become empty
after reasoning removal are dropped entirely.
§Example
use agentkit_compaction::DropReasoningStrategy;
let strategy = DropReasoningStrategy::new();
// Keep items that become empty after stripping reasoning:
let keep_empties = DropReasoningStrategy::new().drop_empty_items(false);Implementations§
Source§impl DropReasoningStrategy
impl DropReasoningStrategy
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new strategy that drops reasoning parts and removes items that become empty as a result.
Sourcepub fn drop_empty_items(self, value: bool) -> Self
pub fn drop_empty_items(self, value: bool) -> Self
Control whether items that become empty after reasoning removal are dropped from the transcript.
Defaults to true.
Trait Implementations§
Source§impl Clone for DropReasoningStrategy
impl Clone for DropReasoningStrategy
Source§fn clone(&self) -> DropReasoningStrategy
fn clone(&self) -> DropReasoningStrategy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl CompactionStrategy for DropReasoningStrategy
impl CompactionStrategy for DropReasoningStrategy
Source§fn apply<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: CompactionRequest,
_ctx: &'life1 mut CompactionContext<'life2>,
) -> Pin<Box<dyn Future<Output = Result<CompactionResult, CompactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn apply<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: CompactionRequest,
_ctx: &'life1 mut CompactionContext<'life2>,
) -> Pin<Box<dyn Future<Output = Result<CompactionResult, CompactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Apply this strategy to the transcript in
request. Read moreSource§impl Debug for DropReasoningStrategy
impl Debug for DropReasoningStrategy
Source§impl Default for DropReasoningStrategy
impl Default for DropReasoningStrategy
Source§fn default() -> DropReasoningStrategy
fn default() -> DropReasoningStrategy
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DropReasoningStrategy
impl<'de> Deserialize<'de> for DropReasoningStrategy
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 PartialEq for DropReasoningStrategy
impl PartialEq for DropReasoningStrategy
Source§impl Serialize for DropReasoningStrategy
impl Serialize for DropReasoningStrategy
impl Eq for DropReasoningStrategy
impl StructuralPartialEq for DropReasoningStrategy
Auto Trait Implementations§
impl Freeze for DropReasoningStrategy
impl RefUnwindSafe for DropReasoningStrategy
impl Send for DropReasoningStrategy
impl Sync for DropReasoningStrategy
impl Unpin for DropReasoningStrategy
impl UnsafeUnpin for DropReasoningStrategy
impl UnwindSafe for DropReasoningStrategy
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