pub struct ChatMessagePromptTemplate {
pub prompt: PromptTemplate,
pub role: String,
pub additional_kwargs: HashMap<String, Value>,
}Expand description
Chat message prompt template with a specific role.
Fields§
§prompt: PromptTemplateThe underlying string prompt template.
role: StringRole of the message.
additional_kwargs: HashMap<String, Value>Additional keyword arguments to pass to the message.
Implementations§
Source§impl ChatMessagePromptTemplate
impl ChatMessagePromptTemplate
Sourcepub fn new(prompt: PromptTemplate, role: impl Into<String>) -> Self
pub fn new(prompt: PromptTemplate, role: impl Into<String>) -> Self
Create a new chat message prompt template.
Sourcepub fn from_template(
template: impl Into<String>,
role: impl Into<String>,
template_format: PromptTemplateFormat,
) -> Result<Self>
pub fn from_template( template: impl Into<String>, role: impl Into<String>, template_format: PromptTemplateFormat, ) -> Result<Self>
Create from a template string.
Trait Implementations§
Source§impl BaseMessagePromptTemplate for ChatMessagePromptTemplate
impl BaseMessagePromptTemplate for ChatMessagePromptTemplate
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 ChatMessagePromptTemplate
impl BaseStringMessagePromptTemplate for ChatMessagePromptTemplate
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 ChatMessagePromptTemplate
impl Clone for ChatMessagePromptTemplate
Source§fn clone(&self) -> ChatMessagePromptTemplate
fn clone(&self) -> ChatMessagePromptTemplate
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 ChatMessagePromptTemplate
impl Debug for ChatMessagePromptTemplate
Source§impl<'de> Deserialize<'de> for ChatMessagePromptTemplate
impl<'de> Deserialize<'de> for ChatMessagePromptTemplate
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 ChatMessagePromptTemplate
impl RefUnwindSafe for ChatMessagePromptTemplate
impl Send for ChatMessagePromptTemplate
impl Sync for ChatMessagePromptTemplate
impl Unpin for ChatMessagePromptTemplate
impl UnwindSafe for ChatMessagePromptTemplate
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