pub struct ChainStep {
pub instruction: String,
pub condition: Option<ChainCondition>,
pub continue_on_failure: bool,
pub extract: Option<String>,
pub timeout_ms: Option<u64>,
pub max_retries: Option<usize>,
}Expand description
A single step in an action chain.
Fields§
§instruction: StringThe instruction to execute (natural language or action spec).
condition: Option<ChainCondition>Optional condition that must be true to execute.
continue_on_failure: boolWhether to continue the chain if this step fails.
extract: Option<String>Optional extraction prompt after this step.
timeout_ms: Option<u64>Optional timeout for this step in milliseconds.
max_retries: Option<usize>Maximum retries for this step.
Implementations§
Source§impl ChainStep
impl ChainStep
Sourcepub fn when(self, condition: ChainCondition) -> Self
pub fn when(self, condition: ChainCondition) -> Self
Add a condition for this step.
Sourcepub fn allow_failure(self) -> Self
pub fn allow_failure(self) -> Self
Continue chain even if this step fails.
Sourcepub fn then_extract(self, prompt: impl Into<String>) -> Self
pub fn then_extract(self, prompt: impl Into<String>) -> Self
Extract data after this step.
Sourcepub fn with_timeout(self, ms: u64) -> Self
pub fn with_timeout(self, ms: u64) -> Self
Set timeout for this step.
Sourcepub fn with_retries(self, retries: usize) -> Self
pub fn with_retries(self, retries: usize) -> Self
Set max retries for this step.
Sourcepub fn should_execute(&self, context: &ChainContext) -> bool
pub fn should_execute(&self, context: &ChainContext) -> bool
Check if this step should be executed based on condition.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ChainStep
impl<'de> Deserialize<'de> for ChainStep
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ChainStep
impl RefUnwindSafe for ChainStep
impl Send for ChainStep
impl Sync for ChainStep
impl Unpin for ChainStep
impl UnwindSafe for ChainStep
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