Improve the default system prompt
This commit is contained in:
@@ -12,7 +12,7 @@ pub(super) struct PreferenceDraft {
|
||||
pub(super) endpoint_cors: bool,
|
||||
pub(super) context_tokens: String,
|
||||
pub(super) max_generated_tokens: String,
|
||||
pub(super) system_prompt: String,
|
||||
pub(super) system_prompt: text_editor::Content,
|
||||
pub(super) temperature: String,
|
||||
pub(super) top_p: String,
|
||||
pub(super) min_p: String,
|
||||
@@ -62,7 +62,7 @@ impl PreferenceDraft {
|
||||
endpoint_cors: config.endpoint.cors,
|
||||
context_tokens: generation.context_tokens.to_string(),
|
||||
max_generated_tokens: generation.max_generated_tokens.to_string(),
|
||||
system_prompt: generation.system_prompt.clone(),
|
||||
system_prompt: text_editor::Content::with_text(&generation.system_prompt),
|
||||
temperature: optional_string(generation.temperature),
|
||||
top_p: optional_string(generation.top_p),
|
||||
min_p: optional_string(generation.min_p),
|
||||
@@ -111,7 +111,7 @@ impl PreferenceDraft {
|
||||
"Maximum generated tokens",
|
||||
&self.max_generated_tokens,
|
||||
)?,
|
||||
system_prompt: self.system_prompt.clone(),
|
||||
system_prompt: self.system_prompt.text(),
|
||||
temperature: parse_optional_f32("Temperature", &self.temperature)?,
|
||||
top_p: parse_optional_f32("Top-p", &self.top_p)?,
|
||||
min_p: parse_optional_f32("Min-p", &self.min_p)?,
|
||||
@@ -423,6 +423,16 @@ impl App {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn multiline_system_prompt_round_trips_through_the_editor() {
|
||||
let draft = PreferenceDraft::from_saved(&Config::default());
|
||||
|
||||
assert_eq!(
|
||||
draft.generation().unwrap().system_prompt,
|
||||
crate::settings::DEFAULT_SYSTEM_PROMPT
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_config_updates_after_lock_poisoning() {
|
||||
let runtime = Arc::new(RwLock::new(Config::default()));
|
||||
|
||||
Reference in New Issue
Block a user