pub struct PromptTemplate {
pub name: String,
pub description: String,
pub content: String,
pub variables: Vec<PromptVariable>,
pub tags: Vec<String>,
pub author: Option<String>,
pub usage_count: u64,
pub created_at: u64,
pub updated_at: u64,
}Expand description
A user-defined prompt template.
Fields§
§name: StringUnique prompt name (kebab-case).
description: StringHuman-readable description.
content: StringThe prompt content with {{variable}} placeholders.
variables: Vec<PromptVariable>Extracted variables with optional metadata.
Categorization tags.
Author identifier.
usage_count: u64Usage count for popularity ranking.
created_at: u64Creation timestamp (Unix epoch seconds).
updated_at: u64Last update timestamp (Unix epoch seconds).
Implementations§
Source§impl PromptTemplate
impl PromptTemplate
Sourcepub fn new(name: impl Into<String>, content: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, content: impl Into<String>) -> Self
Creates a new prompt template with the given name and content.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Sets the description.
Sets the tags.
Sets the author.
Sourcepub fn with_variables(self, variables: Vec<PromptVariable>) -> Self
pub fn with_variables(self, variables: Vec<PromptVariable>) -> Self
Sets explicit variable definitions, overriding auto-detected ones.
Sourcepub fn variable_names(&self) -> Vec<&str>
pub fn variable_names(&self) -> Vec<&str>
Returns the list of variable names in this template.
Trait Implementations§
Source§impl Clone for PromptTemplate
impl Clone for PromptTemplate
Source§fn clone(&self) -> PromptTemplate
fn clone(&self) -> PromptTemplate
Returns a duplicate 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 Default for PromptTemplate
impl Default for PromptTemplate
Source§fn default() -> PromptTemplate
fn default() -> PromptTemplate
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PromptTemplate
impl<'de> Deserialize<'de> for PromptTemplate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].