Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/serve/openai_chat_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ void parse_parallel_tool_calls(const Json& body, const GenerationRequest& output
}

void parse_stop(const Json& body, GenerationRequest& output) {
output.ignore_eos = get_bool(body, "ignore_eos", false);
if (!body.contains("stop") || body.at("stop").is_null()) { return; }
output.stop_strings_apply_to_reasoning = true;
const Json& stop = body.at("stop");
Expand Down
4 changes: 4 additions & 0 deletions src/serve/request.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ struct GenerationRequest {
ToolChoice tool_choice;
std::vector<std::string> stop_strings;
bool stop_strings_apply_to_reasoning = false;
// Benchmark/serving extension shared with vLLM, SGLang and llama.cpp: suppress the
// checkpoint's default stop tokens so generation runs to the requested token budget.
// Caller-supplied stop tokens and stop strings still apply.
bool ignore_eos = false;
int max_tokens = 0; // resolved budget; zero means immediate output limit
std::optional<bool> enable_thinking; // unset => use the server default
std::optional<std::uint32_t> thinking_budget;
Expand Down
1 change: 1 addition & 0 deletions src/serve/translate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ ninfer::RequestOptions to_request_options(const GenerationRequest& request,
options.output.raw = false;
options.output.preserve_special_tokens = request.uses_tools() || request.has_tool_history();
options.output.tool_name_max_length = static_cast<std::uint32_t>(request.tool_name_max_length);
options.stop.include_model_defaults = !request.ignore_eos;
options.stop.strings.reserve(request.stop_strings.size() *
(request.stop_strings_apply_to_reasoning ? 2U : 1U));
for (const std::string& stop : request.stop_strings) {
Expand Down