Skip to content

Commit

Permalink
add default chat template
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiscode committed Sep 27, 2024
1 parent ab8283e commit 270ecc5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/data/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,19 @@ pub struct ChatTemplate {
pub end: Option<String>,
}

impl Default for ChatTemplate {
fn default() -> Self {
ChatTemplate {
start: None,
roles: ["user", "assistant", "system"]
.iter()
.map(|r| (r.to_string(), format!("<|{r}|>\n{{text}}\n\n")))
.collect(),
end: Some("<|assistant|>\n".to_string()),
}
}
}

impl ChatTemplate {
pub fn new(
start: Option<String>,
Expand Down

0 comments on commit 270ecc5

Please sign in to comment.