Skip to content

Commit

Permalink
update: merge system and sysprompts, only sleep is sink not empty
Browse files Browse the repository at this point in the history
Signed-off-by: Milos Gajdos <[email protected]>
  • Loading branch information
milosgajdos committed Apr 22, 2024
1 parent 612ad76 commit 1a8c3f0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
4 changes: 3 additions & 1 deletion rustbot/src/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ pub async fn play(
sink.append(source);
}
}
sink.sleep_until_end();
if !sink.empty() {
sink.sleep_until_end();
}
Ok(())
}
2 changes: 0 additions & 2 deletions rustbot/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ pub struct App {

#[derive(Args, Debug)]
pub struct Prompt {
#[arg(long, default_value = DEFAULT_SYSTEM_PROMPT, help = "system prompt")]
pub system: Option<String>,
#[arg(long, default_value = DEFAULT_SEED_PROMPT, help = "instruction prompt")]
pub seed: Option<String>,
}
Expand Down
4 changes: 1 addition & 3 deletions rustbot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ mod tts;
async fn main() -> Result<()> {
let args = cli::App::parse();

let system_prompt = args.prompt.system.unwrap();
let seed_prompt = args.prompt.seed.unwrap();
let prompt = system_prompt + "\n" + &seed_prompt;

// NOTE: we could also add Stream::builder to the jet module
// and instead of passing config we could build it by chaining methods.
Expand All @@ -41,7 +39,7 @@ async fn main() -> Result<()> {
let c = llm::Config {
hist_size: args.llm.hist_size,
model_name: args.llm.model_name,
seed_prompt: Some(prompt),
seed_prompt: Some(seed_prompt),
..llm::Config::default()
};
let l = llm::LLM::new(c);
Expand Down
6 changes: 3 additions & 3 deletions rustbot/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ pub const BOT_NAME: &str = "rustbot";
pub const BOT_SUB_SUBJECT: &str = "rust";
pub const BOT_PUB_SUBJECT: &str = "go";

pub const DEFAULT_SYSTEM_PROMPT: &str = "You are a Rust programming language expert \
pub const DEFAULT_SEED_PROMPT: &str = "You are a Rust programming language expert \
and a helpful AI assistant trying to learn about Go programming language. \
You will answer questions ONLY about Rust and ONLY ask questions about Go. \
You do NOT explain how Go works. You are NOT Go expert! You ONLY compare Go \
to Rust. When you receive the response you will evaluate it from a Rust programmer \
point of view and ask followup questions about Go. NEVER use emojis in your answers! \
Your answers must NOT be longer than 100 words!";
pub const DEFAULT_SEED_PROMPT: &str = "Question: What is the biggest strength of Rust?
Your answers must NOT be longer than 100 words! \
Question: What is the biggest strength of Rust?
Assistant: Rust's biggest strength lies in its focus on safety, particularly memory \
safety, without sacrificing performance. Can you tell me what are some of the biggest \
strengths of Go that make it stand out from other programming languages?
Expand Down

0 comments on commit 1a8c3f0

Please sign in to comment.