pub struct PromptTemplate { /* private fields */ }Expand description
A parsed prompt template that can be rendered with variable substitution.
Implementations§
Source§impl PromptTemplate
impl PromptTemplate
Sourcepub fn from_file(path: &str) -> Result<Self, PromptError>
pub fn from_file(path: &str) -> Result<Self, PromptError>
Load a template from a TOML file on disk.
The file must contain a [messages] section with a required user
string and an optional system string.
Source§impl PromptTemplate
impl PromptTemplate
pub fn new(template: &str) -> Result<Self, PromptError>
Sourcepub fn new_with_system(
user: &str,
system: Option<&str>,
) -> Result<Self, PromptError>
pub fn new_with_system( user: &str, system: Option<&str>, ) -> Result<Self, PromptError>
Parse a user template and an optional system template.
pub fn render(&self) -> RenderBuilder<'_>
Auto Trait Implementations§
impl Freeze for PromptTemplate
impl RefUnwindSafe for PromptTemplate
impl Send for PromptTemplate
impl Sync for PromptTemplate
impl Unpin for PromptTemplate
impl UnsafeUnpin for PromptTemplate
impl UnwindSafe for PromptTemplate
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