pub struct DropFailedToolResultsStrategy { /* private fields */ }Expand description
Strategy that removes Part::ToolResult parts where is_error is
true.
Failed tool invocations clutter the transcript and can confuse the model on subsequent turns. This strategy strips those results while leaving successful tool output intact.
When drop_empty_items is true (the default), items that become empty
after removal are dropped entirely.
§Example
use agentkit_compaction::DropFailedToolResultsStrategy;
let strategy = DropFailedToolResultsStrategy::new();
// Keep items that become empty after stripping failed results:
let keep_empties = DropFailedToolResultsStrategy::new().drop_empty_items(false);Implementations§
Source§impl DropFailedToolResultsStrategy
impl DropFailedToolResultsStrategy
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new strategy that drops failed tool results 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 failed-result removal are dropped from the transcript.
Defaults to true.
Trait Implementations§
Source§impl Clone for DropFailedToolResultsStrategy
impl Clone for DropFailedToolResultsStrategy
Source§fn clone(&self) -> DropFailedToolResultsStrategy
fn clone(&self) -> DropFailedToolResultsStrategy
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 DropFailedToolResultsStrategy
impl CompactionStrategy for DropFailedToolResultsStrategy
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 Default for DropFailedToolResultsStrategy
impl Default for DropFailedToolResultsStrategy
Source§fn default() -> DropFailedToolResultsStrategy
fn default() -> DropFailedToolResultsStrategy
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DropFailedToolResultsStrategy
impl<'de> Deserialize<'de> for DropFailedToolResultsStrategy
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 DropFailedToolResultsStrategy
impl PartialEq for DropFailedToolResultsStrategy
Source§fn eq(&self, other: &DropFailedToolResultsStrategy) -> bool
fn eq(&self, other: &DropFailedToolResultsStrategy) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for DropFailedToolResultsStrategy
impl StructuralPartialEq for DropFailedToolResultsStrategy
Auto Trait Implementations§
impl Freeze for DropFailedToolResultsStrategy
impl RefUnwindSafe for DropFailedToolResultsStrategy
impl Send for DropFailedToolResultsStrategy
impl Sync for DropFailedToolResultsStrategy
impl Unpin for DropFailedToolResultsStrategy
impl UnsafeUnpin for DropFailedToolResultsStrategy
impl UnwindSafe for DropFailedToolResultsStrategy
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