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#3956
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/2278
Author: @kossum
Created: 10/13/2026
Status: ❌ Closed
Base:
main← Head:serve-completions📝 Commits (2)
6882615serve: add the legacy /v1/completions endpointac6aeedfix(serve): restore structured SSE errors and avoid duplicate completion text📊 Changes
6 files changed (+333 additions, -13 deletions)
View changed files
📝
docs/DETAILS.md(+1 -0)📝
serve/frontend.py(+12 -0)📝
serve/server.py(+169 -10)📝
serve/test_monitor.py(+17 -0)📝
serve/test_server.py(+122 -0)📝
serve/test_structured.py(+12 -3)📄 Description
Problem and result
Clients that apply their own chat template need to send a raw prompt to
/v1/completions. Strata currently has no endpoint for that.This adds the legacy OpenAI endpoint with streaming and non-streaming responses,
text_completionobjects, and token usage. The server doesn't apply the chat template again.Related discussion
#2277
Approach
The handler uses the existing generation path and accepts one string prompt.
max_tokens: 0or a negative value uses the remaining context.Explicit thinking-disable flags append the template's no-thinking tail. Without those flags, the prompt passes through unchanged.
Streaming sends each piece of text once. With
echo: true, it sends the prompt once at the start; the finish chunk has empty text.This also keeps the structured-output error handler in the chat endpoint, so a failed streamed response sends an SSE error and
[DONE], not another HTTP response inside the stream. Engine errors after streaming starts are handled as SSE errors too.Validation
Rebased onto main
e88ee39d(0.2.0-beta). These local checks ran on7e08755f.Passed:
Windows, Python 3.13.2, with jsonschema installed:
368 tests, OK, 3 skipped.
Linux, Python 3.11 in Docker, using a dedicated venv with only the pinned
requirements.txtpackages:Reported
"passed": true.git diff --check upstream/mainalso passed.Failed:
The full suite in the same Linux venv:
888 tests, 2 failures, 18 skipped:
test_lifeline.Lifeline.test_the_portable_watcher_ends_the_child_when_the_server_is_killedtest_server.VisionTempFiles.test_work_dir_has_no_space_when_temp_has_oneI reran both tests on clean main
e88ee39dwith the same container and dependencies. Both fail there with the same assertions. I haven't changed either behavior in this PR.Not run:
Limits
Only a string prompt and
n=1/best_of=1are supported. Suffix and logprobs are rejected.stream_optionsaccepts onlyinclude_usage, and only with streaming. Usage still comes on the finish chunk, not a separatechoices: []chunk, so this doesn't yet implement the full OpenAI streaming-usage format.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.