@@ -559,6 +559,7 @@ json format_generation_settings(llama_server_context &llama) {
559
559
{ " n_keep" , llama.params .n_keep },
560
560
{ " ignore_eos" , ignore_eos },
561
561
{ " stream" , llama.stream },
562
+ { " logit_bias" , llama.params .logit_bias },
562
563
};
563
564
}
564
565
@@ -638,7 +639,7 @@ bool parse_options_completion(json body, llama_server_context& llama, Response &
638
639
if (!body[" penalize_nl" ].is_null ()) {
639
640
llama.params .penalize_nl = body[" penalize_nl" ].get <float >();
640
641
} else {
641
- llama.params .penalize_nl = false ;
642
+ llama.params .penalize_nl = default_params. penalize_nl ;
642
643
}
643
644
if (!body[" n_keep" ].is_null ()) {
644
645
llama.params .n_keep = body[" n_keep" ].get <int >();
@@ -650,10 +651,10 @@ bool parse_options_completion(json body, llama_server_context& llama, Response &
650
651
} else {
651
652
llama.params .seed = time (NULL );
652
653
}
654
+
655
+ llama.params .logit_bias .clear ();
653
656
if (!body[" ignore_eos" ].is_null () && body[" ignore_eos" ].get <bool >()) {
654
657
llama.params .logit_bias [llama_token_eos ()] = -INFINITY;
655
- } else {
656
- llama.params .logit_bias .erase (llama_token_eos ());
657
658
}
658
659
if (body[" logit_bias" ].is_array ()) {
659
660
int n_vocab = llama_n_vocab (llama.ctx );
@@ -665,6 +666,7 @@ bool parse_options_completion(json body, llama_server_context& llama, Response &
665
666
}
666
667
}
667
668
}
669
+
668
670
if (!body[" prompt" ].is_null ()) {
669
671
llama.params .prompt = body[" prompt" ].get <std::string>();
670
672
} else {
@@ -673,6 +675,7 @@ bool parse_options_completion(json body, llama_server_context& llama, Response &
673
675
res.status = 400 ;
674
676
return false ;
675
677
}
678
+
676
679
llama.params .antiprompt .clear ();
677
680
if (!body[" stop" ].is_null ()) {
678
681
const auto stop = body[" stop" ].get <std::vector<std::string>>();
@@ -888,7 +891,7 @@ int main(int argc, char **argv)
888
891
}
889
892
});
890
893
891
- svr.Options (R"( /.*)" , [&llama](const Request &req , Response &res)
894
+ svr.Options (R"( /.*)" , [&llama](const Request &, Response &res)
892
895
{
893
896
return res.set_content (" " , " application/json" );
894
897
});
0 commit comments