diff --git a/binding.cpp b/binding.cpp index bd2f895..149cdfd 100644 --- a/binding.cpp +++ b/binding.cpp @@ -513,11 +513,17 @@ int llama_predict(void* params_ptr, void* state_pr, char* result, bool debug) { : 0; if (last_output.find(antiprompt, search_start_pos) != std::string::npos) { + is_antiprompt = true; break; } } } } + + // found antiprompt + if (is_antiprompt) { + break; + } // end of text token if (!embd.empty() && embd.back() == llama_token_eos(ctx)) {