Struct FallbackTextAgent
pub struct FallbackTextAgent { /* private fields */ }Expand description
Tries each child agent in sequence. Returns the first successful result. If all fail, returns the last error.
Implementations§
§impl FallbackTextAgent
impl FallbackTextAgent
pub fn new(
name: impl Into<String>,
candidates: Vec<Arc<dyn TextAgent>>,
) -> FallbackTextAgent
pub fn new( name: impl Into<String>, candidates: Vec<Arc<dyn TextAgent>>, ) -> FallbackTextAgent
Create a new fallback agent that tries candidates in order.
pub fn with_middleware_chain(self, chain: MiddlewareChain) -> FallbackTextAgent
pub fn with_middleware_chain(self, chain: MiddlewareChain) -> FallbackTextAgent
Attach a middleware chain. AgentEvent::FallbackActivated is emitted
through it when a fallback branch (any candidate after the first) is
tried, so on_event observers (M::on_fallback) fire.
Trait Implementations§
§impl TextAgent for FallbackTextAgent
impl TextAgent for FallbackTextAgent
§fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 State,
) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FallbackTextAgent: 'async_trait,
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 State,
) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FallbackTextAgent: 'async_trait,
Execute this agent. Reads/writes
state. Returns the final text output.Auto Trait Implementations§
impl Freeze for FallbackTextAgent
impl !RefUnwindSafe for FallbackTextAgent
impl Send for FallbackTextAgent
impl Sync for FallbackTextAgent
impl Unpin for FallbackTextAgent
impl !UnwindSafe for FallbackTextAgent
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