mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4572
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/3332
Author: @kossum
Created: 10/20/2026
Status: 🔄 Open
Base:
main← Head:serve-completions📝 Commits (4)
e04fe08serve: add the legacy /v1/completions endpoint7e08755fix(serve): restore structured SSE errors and avoid duplicate completion textca77c15serve: preserve raw completions prompts and generated text6c46256Merge upstream/main into serve-completions📊 Changes
6 files changed (+465 additions, -24 deletions)
View changed files
📝
docs/DETAILS.md(+9 -0)📝
serve/frontend.py(+12 -0)📝
serve/server.py(+211 -21)📝
serve/test_monitor.py(+17 -0)📝
serve/test_server.py(+204 -0)📝
serve/test_structured.py(+12 -3)📄 Description
Problem and result
Clients that build their own prompts need
/v1/completions. Sending those prompts through the chat API would apply the chat template again.This adds the endpoint for string prompts, with streaming and non-streaming responses in the OpenAI
text_completionformat, including token usage. It also handles continuing a reply that was cut off by a token limit.Related discussion
#2277, #2278.
This replaces #2278 after the tracker reset. The reopen format check passed, but GitHub returned "Validation Failed". The bot suggested opening a new PR and linking the old one. The earlier review and fixes are in #2278.
The latest changes address the continuation issues reported by @fulgurist in this PR.
Approach
The handler reuses the existing generation path without rendering a chat template. It returns the raw continuation, including
</think>, the newlines after it and literal tool-call text.The initial thinking state comes from whether the prompt's last
<think>is still open. This route does not apply automatic answer-room budgeting or reasoning recovery. An explicit requestreasoning_budget_tokensstill works when continuing an open thinking block.For anyone already running an earlier version of this branch: disabling thinking no longer appends a no-think tail. Clients that need one must include it in their own prompt. Reasoning budgets from server or shared settings no longer apply to this route, and output markers previously consumed by the chat parser are now preserved.
max_tokens: 0or a negative value uses the remaining context. Withecho: true, the prompt is returned once at the start and the finish chunk has empty text.The structured-output error handler stays in the chat endpoint. Errors after streaming starts are sent as SSE errors followed by
[DONE], rather than a second HTTP response inside the stream.Validation
Tested
6c46256b, after merging main atc62d5e3a.Passed:
On Windows with Python 3.13.2, using the project venv from Git Bash:
1312 tests, OK with 24 skipped.
PYTHONUTF8=0is needed for the Windows process test to decode the local CP932tasklistoutput.I also tested the merged version against a running Qwen3.8-Flash-Next model with the existing Strata 0.1.53 native engine:
GitHub's
Linux / runtime requirements onlycheck passed on this revision.git diff --check upstream/mainpassed locally.Failed:
No endpoint or automated-test failures in the checks above. One live response had off-topic reasoning but still gave the correct final answer. Three follow-up requests did not reproduce that; the cause is unconfirmed.
Not run:
7e08755f.Limits
The endpoint accepts one string prompt and supports only
n=1andbest_of=1. Suffix and logprobs are rejected.stream_optionsaccepts onlyinclude_usage, with streaming enabled. Usage is returned on the finish chunk rather than a separatechoices: []chunk, so the OpenAI streaming-usage format is not fully implemented.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.