Skip to content

Commit

Permalink
Halt inference
Browse files Browse the repository at this point in the history
  • Loading branch information
lucksus committed Nov 3, 2023
1 parent 2b5edc9 commit 9f817b9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cli/src/eve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,23 @@ pub async fn run(command: EveCommands) -> Result<()> {
&mut Default::default(),
// output callback
|t| {
let mut cont = true;
match t {
InferenceResponse::PromptToken(t) | InferenceResponse::InferredToken(t) | llm::InferenceResponse::SnapshotToken(t) => {
if t == "Eve:" || t == "User:" {
cont = false;
}
print_token(t);
}
_ => {}
}
std::io::stdout().flush().unwrap();

Ok(llm::InferenceFeedback::Continue)
if cont {
Ok(llm::InferenceFeedback::Continue)
} else {
Ok(llm::InferenceFeedback::Halt)
}
}
);

Expand Down

0 comments on commit 9f817b9

Please sign in to comment.