pub struct SystemMessagePromptTemplate {
pub prompt: PromptTemplate,
pub additional_kwargs: HashMap<String, Value>,
}Expand description
System message prompt template.
Fields§
§prompt: PromptTemplateThe underlying string prompt template.
additional_kwargs: HashMap<String, Value>Additional keyword arguments to pass to the message.
Implementations§
Source§impl SystemMessagePromptTemplate
impl SystemMessagePromptTemplate
Sourcepub fn new(prompt: PromptTemplate) -> Self
pub fn new(prompt: PromptTemplate) -> Self
Create a new system message prompt template.
Sourcepub fn from_template(template: impl Into<String>) -> Result<Self>
pub fn from_template(template: impl Into<String>) -> Result<Self>
Create from a template string.
Sourcepub fn from_template_with_format(
template: impl Into<String>,
template_format: PromptTemplateFormat,
) -> Result<Self>
pub fn from_template_with_format( template: impl Into<String>, template_format: PromptTemplateFormat, ) -> Result<Self>
Create from a template string with a specific format.
Sourcepub fn from_template_file(template_file: impl AsRef<Path>) -> Result<Self>
pub fn from_template_file(template_file: impl AsRef<Path>) -> Result<Self>
Create from a template file.
Trait Implementations§
Source§impl BaseMessagePromptTemplate for SystemMessagePromptTemplate
impl BaseMessagePromptTemplate for SystemMessagePromptTemplate
Source§fn format_messages(
&self,
kwargs: &HashMap<String, String>,
) -> Result<Vec<BaseMessage>>
fn format_messages( &self, kwargs: &HashMap<String, String>, ) -> Result<Vec<BaseMessage>>
Format messages from kwargs. Read more
Source§fn pretty_repr(&self, html: bool) -> String
fn pretty_repr(&self, html: bool) -> String
Get a pretty representation of the template. Read more
Source§fn aformat_messages(
&self,
kwargs: &HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<BaseMessage>>> + Send + '_>>
fn aformat_messages( &self, kwargs: &HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<Vec<BaseMessage>>> + Send + '_>>
Async format messages from kwargs. Read more
Source§fn pretty_print(&self)
fn pretty_print(&self)
Print a human-readable representation.
Source§impl BaseStringMessagePromptTemplate for SystemMessagePromptTemplate
impl BaseStringMessagePromptTemplate for SystemMessagePromptTemplate
Source§fn prompt(&self) -> &PromptTemplate
fn prompt(&self) -> &PromptTemplate
Get the underlying string prompt template.
Source§fn additional_kwargs(&self) -> &HashMap<String, Value>
fn additional_kwargs(&self) -> &HashMap<String, Value>
Get additional kwargs to pass to the message.
Source§impl Clone for SystemMessagePromptTemplate
impl Clone for SystemMessagePromptTemplate
Source§fn clone(&self) -> SystemMessagePromptTemplate
fn clone(&self) -> SystemMessagePromptTemplate
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 SystemMessagePromptTemplate
impl Debug for SystemMessagePromptTemplate
Source§impl<'de> Deserialize<'de> for SystemMessagePromptTemplate
impl<'de> Deserialize<'de> for SystemMessagePromptTemplate
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 SystemMessagePromptTemplate
impl RefUnwindSafe for SystemMessagePromptTemplate
impl Send for SystemMessagePromptTemplate
impl Sync for SystemMessagePromptTemplate
impl Unpin for SystemMessagePromptTemplate
impl UnwindSafe for SystemMessagePromptTemplate
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