Skip to main content

FormatPrompter

Trait FormatPrompter 

Source
pub trait FormatPrompter: Send + Sync {
    // Required methods
    fn format_prompt(
        &self,
        input_variables: PromptArgs,
    ) -> Result<PromptValue, PromptError>;
    fn get_input_variables(&self) -> Vec<String>;

    // Provided method
    fn format_prompt_async<'life0, 'async_trait>(
        &'life0 self,
        input_variables: PromptArgs,
    ) -> Pin<Box<dyn Future<Output = Result<PromptValue, PromptError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

Provided Methods§

Source

fn format_prompt_async<'life0, 'async_trait>( &'life0 self, input_variables: PromptArgs, ) -> Pin<Box<dyn Future<Output = Result<PromptValue, PromptError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Formats the prompt, for prompts that need async work to do it (e.g. a FewShotPromptTemplate choosing examples by embedding similarity). Chains call this one. Defaults to format_prompt.

Trait Implementations§

Source§

impl<FP> From<FP> for Box<dyn FormatPrompter>
where FP: FormatPrompter + 'static,

Source§

fn from(prompt: FP) -> Self

Converts to this type from the input type.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§