pub struct PromptTemplate {
segments: Vec<PromptSegment>,
}Expand description
A system prompt built from static templates + pre-scrubbed inserts.
Cannot be constructed from arbitrary strings. Use PromptTemplateBuilder
to construct via PromptTemplate::builder().
Fields§
§segments: Vec<PromptSegment>Implementations§
Source§impl PromptTemplate
impl PromptTemplate
Sourcepub fn builder() -> PromptTemplateBuilder
pub fn builder() -> PromptTemplateBuilder
Start building a new prompt template.
Sourcepub fn as_str_lossy(&self) -> String
pub fn as_str_lossy(&self) -> String
Concatenate all segments into a single string.
Static segments are included verbatim. Scrubbed segments use the redacted text (PII replaced with placeholders).
Sourcepub fn segment_count(&self) -> usize
pub fn segment_count(&self) -> usize
Number of segments in this template.
Sourcepub fn segments(&self) -> &[PromptSegment]
pub fn segments(&self) -> &[PromptSegment]
Access the segments for inspection.
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<'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
Source§impl Display for PromptTemplate
impl Display 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