pub struct Step { /* private fields */ }
Expand description
A step in a chain of LLM invocations. It is a combination of a prompt and a configuration.
Implementations§
Source§impl Step
impl Step
pub fn for_prompt_template(prompt: Data<StringTemplate>) -> Step
pub fn for_prompt_with_streaming(prompt: Data<StringTemplate>) -> Step
pub fn for_prompt_and_options( prompt: Data<StringTemplate>, options: Options, ) -> Step
pub fn prompt(&self) -> &Data<StringTemplate>
pub fn options(&self) -> &Options
Sourcepub fn to_chain(self) -> Chain
pub fn to_chain(self) -> Chain
Converts this step into a sequential chain with a single step.
§Returns
A sequential chain containing this step.
Sourcepub fn format(
&self,
parameters: &Parameters,
) -> Result<Data<String>, StringTemplateError>
pub fn format( &self, parameters: &Parameters, ) -> Result<Data<String>, StringTemplateError>
Formats the prompt for this step with the given parameters.
Sourcepub async fn run<E>(
&self,
parameters: &Parameters,
executor: &E,
) -> Result<Output, FormatAndExecuteError>
pub async fn run<E>( &self, parameters: &Parameters, executor: &E, ) -> Result<Output, FormatAndExecuteError>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Step
impl<'de> Deserialize<'de> for Step
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Step, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Step, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Step
impl Serialize for Step
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 Step
impl RefUnwindSafe for Step
impl Send for Step
impl Sync for Step
impl Unpin for Step
impl UnwindSafe for Step
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