Struct MapOverTextAgent
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§
§impl MapOverTextAgent
impl MapOverTextAgent
pub fn new(
name: impl Into<String>,
agent: Arc<dyn TextAgent>,
list_key: impl Into<String>,
) -> MapOverTextAgent
pub fn new( name: impl Into<String>, agent: Arc<dyn TextAgent>, list_key: impl Into<String>, ) -> MapOverTextAgent
Create a new map-over agent that iterates over a list in state.
pub fn item_key(self, key: impl Into<String>) -> MapOverTextAgent
pub fn item_key(self, key: impl Into<String>) -> MapOverTextAgent
Set the state key for the current item (default: “_item”).
pub fn output_key(self, key: impl Into<String>) -> MapOverTextAgent
pub fn output_key(self, key: impl Into<String>) -> MapOverTextAgent
Set the state key for the output list (default: “_results”).
Trait Implementations§
§impl TextAgent for MapOverTextAgent
impl TextAgent for MapOverTextAgent
§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,
MapOverTextAgent: '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,
MapOverTextAgent: '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 !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