server : ignore empty stop strings (#32093)
This commit is contained in:
1 parent
b54752df40
commit
56fd8a375f
5 files changed
+59
-2
No files matched your search
@@ -718,6 +718,41 @@ static void test_dry_sequence_breakers(testing & t) {
|
||||
}
|
||||
}
|
||||
|
||||
static void test_stop_strings(testing & t) {
|
||||
common_params params_base;
|
||||
|
||||
const auto eval = [&](const json & data) {
|
||||
return server_schema::eval_llama_cmpl_schema(nullptr, params_base, {}, data);
|
||||
};
|
||||
|
||||
{
|
||||
json data;
|
||||
data["stop"] = "";
|
||||
t.assert_true("empty string is ignored", eval(data).antiprompt.empty());
|
||||
}
|
||||
|
||||
{
|
||||
json data;
|
||||
data["stop"] = json::array({""});
|
||||
t.assert_true("empty string in array is ignored", eval(data).antiprompt.empty());
|
||||
}
|
||||
|
||||
{
|
||||
json data;
|
||||
data["stop"] = json::array({"", "zzz"});
|
||||
const std::vector<std::string> expected = {"zzz"};
|
||||
t.assert_true("only non-empty strings are kept", eval(data).antiprompt == expected);
|
||||
}
|
||||
|
||||
{
|
||||
params_base.antiprompt = {"User:"};
|
||||
json data;
|
||||
data["stop"] = json::array({""});
|
||||
const std::vector<std::string> expected = {"User:"};
|
||||
t.assert_true("falls back to CLI defaults", eval(data).antiprompt == expected);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// glob_match
|
||||
//
|
||||
@@ -842,6 +877,7 @@ int main(int argc, char ** argv) {
|
||||
t.test("decision_depth", test_decision_depth);
|
||||
t.test("glob_match", test_glob_match);
|
||||
t.test("dry_sequence_breakers", test_dry_sequence_breakers);
|
||||
t.test("stop_strings", test_stop_strings);
|
||||
t.test("speech_convert", test_speech_convert);
|
||||
t.test("pcm_f32_to_s16", test_pcm_f32_to_s16);
|
||||
|
||||
|
||||
Reference in new issue
Block a user