pub struct ChatHistory { /* private fields */ }Expand description
Chat history for the agent.
Implementations§
Source§impl ChatHistory
impl ChatHistory
Sourcepub fn add_message(&mut self, role: ChatRole, message: MessageContent)
pub fn add_message(&mut self, role: ChatRole, message: MessageContent)
Add a message to the chat history.
Sourcepub fn add_message_schema(
&mut self,
role: &str,
payload: &impl Serialize,
) -> Result<(), ChatHistoryError>
pub fn add_message_schema( &mut self, role: &str, payload: &impl Serialize, ) -> Result<(), ChatHistoryError>
Serializes payload to JSON and stores it as one text turn for role.
Sourcepub fn get_history(&self) -> &[ChatMessage]
pub fn get_history(&self) -> &[ChatMessage]
Get the chat history as the LLM API request format.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChatHistory
impl RefUnwindSafe for ChatHistory
impl Send for ChatHistory
impl Sync for ChatHistory
impl Unpin for ChatHistory
impl UnsafeUnpin for ChatHistory
impl UnwindSafe for ChatHistory
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