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) -> ChainStep
pub fn when(self, condition: ChainCondition) -> ChainStep
Add a condition for this step.
Sourcepub fn allow_failure(self) -> ChainStep
pub fn allow_failure(self) -> ChainStep
Continue chain even if this step fails.
Sourcepub fn then_extract(self, prompt: impl Into<String>) -> ChainStep
pub fn then_extract(self, prompt: impl Into<String>) -> ChainStep
Extract data after this step.
Sourcepub fn with_timeout(self, ms: u64) -> ChainStep
pub fn with_timeout(self, ms: u64) -> ChainStep
Set timeout for this step.
Sourcepub fn with_retries(self, retries: usize) -> ChainStep
pub fn with_retries(self, retries: usize) -> ChainStep
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<ChainStep, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ChainStep, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ChainStep
impl Serialize for ChainStep
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. 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 UnsafeUnpin 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