Enum swiftide_core::prompt::PromptTemplate
source · pub enum PromptTemplate {
CompiledTemplate(String),
String(String),
Static(&'static str),
}
Expand description
A PromptTemplate
defines a template for a prompt
Variants§
Implementations§
source§impl PromptTemplate
impl PromptTemplate
sourcepub fn from_compiled_template_name(name: impl Into<String>) -> PromptTemplate
pub fn from_compiled_template_name(name: impl Into<String>) -> PromptTemplate
Creates a reference to a template already stored in the repository
pub fn from_string(template: impl Into<String>) -> PromptTemplate
sourcepub async fn extend(tera: &Tera) -> Result<()>
pub async fn extend(tera: &Tera) -> Result<()>
Extends the prompt repository with a custom tera::Tera
instance.
If you have your own prompt templates or want to add other functionality, you can extend
the repository with your own tera::Tera
instance.
WARN: Do not use this inside a pipeline or any form of load, as it will lock the repository
§Errors
Errors if the repository could not be extended
sourcepub async fn try_compiled_from_str(
template: impl AsRef<str> + Send + 'static,
) -> Result<PromptTemplate>
pub async fn try_compiled_from_str( template: impl AsRef<str> + Send + 'static, ) -> Result<PromptTemplate>
Compiles a template from a string and returns a PromptTemplate
with a reference to the
string.
WARN: Do not use this inside a pipeline or any form of load, as it will lock the repository
§Errors
Errors if the template fails to compile
Trait Implementations§
source§impl Clone for PromptTemplate
impl Clone for PromptTemplate
source§fn clone(&self) -> PromptTemplate
fn clone(&self) -> PromptTemplate
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PromptTemplate
impl Debug for PromptTemplate
source§impl From<&'static str> for PromptTemplate
impl From<&'static str> for PromptTemplate
Auto Trait Implementations§
impl Freeze for PromptTemplate
impl RefUnwindSafe for PromptTemplate
impl Send for PromptTemplate
impl Sync for PromptTemplate
impl Unpin 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more