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>,
) -> 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.
Sourcepub fn with_middleware_chain(self, chain: MiddlewareChain) -> MapOverTextAgent
pub fn with_middleware_chain(self, chain: MiddlewareChain) -> MapOverTextAgent
Attach a middleware chain. AgentEvent::LoopIteration is emitted
through it before each item is processed (zero-based), so on_event
observers (e.g. M::on_loop) fire per item.
Sourcepub 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”).
Sourcepub 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§
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
'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
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].