pub struct HumanMessagePromptTemplate {
pub prompt: PromptTemplate,
pub additional_kwargs: HashMap<String, Value>,
}Expand description
Human 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 HumanMessagePromptTemplate
impl HumanMessagePromptTemplate
Sourcepub fn new(prompt: PromptTemplate) -> Self
pub fn new(prompt: PromptTemplate) -> Self
Create a new human 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 HumanMessagePromptTemplate
impl BaseMessagePromptTemplate for HumanMessagePromptTemplate
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 HumanMessagePromptTemplate
impl BaseStringMessagePromptTemplate for HumanMessagePromptTemplate
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 HumanMessagePromptTemplate
impl Clone for HumanMessagePromptTemplate
Source§fn clone(&self) -> HumanMessagePromptTemplate
fn clone(&self) -> HumanMessagePromptTemplate
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 HumanMessagePromptTemplate
impl Debug for HumanMessagePromptTemplate
Source§impl<'de> Deserialize<'de> for HumanMessagePromptTemplate
impl<'de> Deserialize<'de> for HumanMessagePromptTemplate
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 HumanMessagePromptTemplate
impl RefUnwindSafe for HumanMessagePromptTemplate
impl Send for HumanMessagePromptTemplate
impl Sync for HumanMessagePromptTemplate
impl Unpin for HumanMessagePromptTemplate
impl UnwindSafe for HumanMessagePromptTemplate
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