Skip to content

Commit

Permalink
feat: add with_messages method to construct TaskChat
Browse files Browse the repository at this point in the history
  • Loading branch information
moldhouse authored and Daniel-AAlpha committed Oct 24, 2024
1 parent 6ef29c5 commit 8fc5c10
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ impl<'a> TaskChat<'a> {
}
}

/// Creates a new TaskChat containing the given messages.
/// All optional TaskChat attributes are left unset.
pub fn with_messages(messages: Vec<Message<'a>>) -> Self {
TaskChat {
messages,
maximum_tokens: None,
temperature: None,
top_p: None,
}
}

/// Pushes a new Message to this TaskChat.
pub fn push_message(mut self, message: Message<'a>) -> Self {
self.messages.push(message);
Expand Down

0 comments on commit 8fc5c10

Please sign in to comment.