pub struct MapOverTextAgent { /* private fields */ }Expand description
Iterates a single agent over each item in a state list.
Reads state[list_key], runs agent per item (setting state[item_key]),
collects results into state[output_key].
Implementations§
Source§impl MapOverTextAgent
impl MapOverTextAgent
Sourcepub fn new(
name: impl Into<String>,
agent: Arc<dyn TextAgent>,
list_key: impl Into<String>,
) -> Self
pub fn new( name: impl Into<String>, agent: Arc<dyn TextAgent>, list_key: impl Into<String>, ) -> Self
Create a new map-over agent that iterates over a list in state.
Sourcepub fn item_key(self, key: impl Into<String>) -> Self
pub fn item_key(self, key: impl Into<String>) -> Self
Set the state key for the current item (default: “_item”).
Sourcepub fn output_key(self, key: impl Into<String>) -> Self
pub fn output_key(self, key: impl Into<String>) -> Self
Set the state key for the output list (default: “_results”).
Trait Implementations§
Source§impl TextAgent for MapOverTextAgent
impl TextAgent for MapOverTextAgent
Source§fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 State,
) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: '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
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute this agent. Reads/writes
state. Returns the final text output.Auto Trait Implementations§
impl Freeze for MapOverTextAgent
impl !RefUnwindSafe for MapOverTextAgent
impl Send for MapOverTextAgent
impl Sync for MapOverTextAgent
impl Unpin for MapOverTextAgent
impl UnsafeUnpin for MapOverTextAgent
impl !UnwindSafe for MapOverTextAgent
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