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§
fn format_prompt( &self, input_variables: PromptArgs, ) -> Result<PromptValue, PromptError>
fn get_input_variables(&self) -> Vec<String>
Provided Methods§
Sourcefn 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,
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,
impl<FP> From<FP> for Box<dyn FormatPrompter>where
FP: FormatPrompter + 'static,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".