pub struct ChainFallback { /* private fields */ }Expand description
Chain fallback handler that tries multiple handlers in sequence.
Tries each handler in order until one returns a non-Fail result. If all handlers fail, returns the last Fail result.
§Example
use forge_agent::workflow::tools::{ChainFallback, RetryFallback, SkipFallback};
let fallback = ChainFallback::new()
.add(RetryFallback::new(3, 100))
.add(SkipFallback::skip());Implementations§
Source§impl ChainFallback
impl ChainFallback
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new ChainFallback.
§Example
use forge_agent::workflow::tools::ChainFallback;
let fallback = ChainFallback::new();Sourcepub fn add(self, handler: impl FallbackHandler + 'static) -> Self
pub fn add(self, handler: impl FallbackHandler + 'static) -> Self
Adds a handler to the chain.
§Arguments
handler- Handler to add to the chain
§Returns
Self for builder pattern chaining
§Example
use forge_agent::workflow::tools::{ChainFallback, RetryFallback, SkipFallback};
let fallback = ChainFallback::new()
.add(RetryFallback::new(3, 100))
.add(SkipFallback::skip());Trait Implementations§
Source§impl Clone for ChainFallback
impl Clone for ChainFallback
Source§fn clone(&self) -> ChainFallback
fn clone(&self) -> ChainFallback
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 Debug for ChainFallback
impl Debug for ChainFallback
Source§impl Default for ChainFallback
impl Default for ChainFallback
Source§impl FallbackHandler for ChainFallback
impl FallbackHandler for ChainFallback
Source§fn handle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
error: &'life1 ToolError,
invocation: &'life2 ToolInvocation,
) -> Pin<Box<dyn Future<Output = FallbackResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
error: &'life1 ToolError,
invocation: &'life2 ToolInvocation,
) -> Pin<Box<dyn Future<Output = FallbackResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Handles a tool execution error. Read more
Auto Trait Implementations§
impl Freeze for ChainFallback
impl !RefUnwindSafe for ChainFallback
impl Send for ChainFallback
impl Sync for ChainFallback
impl Unpin for ChainFallback
impl UnsafeUnpin for ChainFallback
impl !UnwindSafe for ChainFallback
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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