Struct llm_chain::chains::sequential::Chain   
source · pub struct Chain { /* private fields */ }Expand description
A sequential chain is a chain where each step is executed in order, with the output of the previous step being available to the next step.
Implementations§
source§impl Chain
 
impl Chain
sourcepub fn new(steps: Vec<Step>) -> Chain
 
pub fn new(steps: Vec<Step>) -> Chain
Creates a new Chain instance with the given sequence of steps.
Arguments
- steps- A vector of- Step<E>objects that define the sequence of steps for the chain.
sourcepub fn of_one(step: Step) -> Chain
 
pub fn of_one(step: Step) -> Chain
Creates a new Chain instance with a single step.
Arguments
- step- A- Step<E>object that defines the single step for the chain.
sourcepub async fn run<E>(
    &self,
    parameters: Parameters,
    executor: &E
) -> Result<Output, SequentialChainError>where
    E: Executor,
 
pub async fn run<E>( &self, parameters: Parameters, executor: &E ) -> Result<Output, SequentialChainError>where E: Executor,
Executes the chain with the given parameters and executor.
This method runs each step in the chain in sequence, passing the output of the previous step to the next step. If the chain is empty, an error is returned.
Arguments
- parameters- A- Parametersobject containing the input parameters for the chain.
- executor- A reference to an executor that implements the- Executortrait.
Returns
- Ok(E::Output)- If the chain executes successfully, the output of the last step is returned.
- Err(SequentialChainError<E::Error>)- If an error occurs during the execution of the chain, the error is returned.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Chain
 
impl<'de> Deserialize<'de> for Chain
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
source§impl StorableEntity for Chain
 
impl StorableEntity for Chain
fn get_metadata() -> Vec<(String, String)>
fn to_envelope(self) -> Envelope<Self>where Self: Sized,
fn from_envelope(envelope: Envelope<Self>) -> Self
fn read_file_sync(path: &str) -> Result<Self, EnvelopeError>
fn write_file_sync(self, path: &str) -> Result<(), EnvelopeError>
Auto Trait Implementations§
impl RefUnwindSafe for Chain
impl Send for Chain
impl Sync for Chain
impl Unpin for Chain
impl UnwindSafe for Chain
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