pub struct PromptBuilder { /* private fields */ }Implementations§
Source§impl PromptBuilder
impl PromptBuilder
pub fn new( template: String, system_prompt: Option<String>, is_augment: bool, ) -> Self
pub fn system_prompt(&self) -> &str
Sourcepub fn build_for_category(&self, category: &str, index: usize) -> String
pub fn build_for_category(&self, category: &str, index: usize) -> String
Build prompt for from-scratch generation with category
Sourcepub fn build_for_record(&self, record: &Record) -> String
pub fn build_for_record(&self, record: &Record) -> String
Build prompt for augmenting existing data
Sourcepub fn required_variables(&self) -> Vec<String>
pub fn required_variables(&self) -> Vec<String>
Extract variable names from template (e.g., {category}, {text})
Sourcepub fn validate_for_generate(
&self,
categories: &Option<Vec<String>>,
) -> Result<()>
pub fn validate_for_generate( &self, categories: &Option<Vec<String>>, ) -> Result<()>
Validate that all required variables will be available
Sourcepub fn validate_for_augment(&self, available_columns: &[String]) -> Result<()>
pub fn validate_for_augment(&self, available_columns: &[String]) -> Result<()>
Validate that required variables exist in source data
Auto Trait Implementations§
impl Freeze for PromptBuilder
impl RefUnwindSafe for PromptBuilder
impl Send for PromptBuilder
impl Sync for PromptBuilder
impl Unpin for PromptBuilder
impl UnsafeUnpin for PromptBuilder
impl UnwindSafe for PromptBuilder
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> 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