[Frontend] expose stream_interval as req sampling param (#49754)

Signed-off-by: walterbm <walter.beller.morales@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Walter Beller-Morales
2026-07-27 11:30:37 +08:00
committed by GitHub
co-authored by mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent bf4f633b4c
commit 8040ef2426
5 changed files with 114 additions and 0 deletions
@@ -476,6 +476,16 @@ class ChatCompletionRequest(OpenAIBaseModel):
"can detect such behavior and terminate early, saving time and tokens.",
)
stream_interval: Annotated[int, Field(ge=1)] | None = Field(
default=None,
description=(
"Number of tokens to batch into each streamed chunk. Raises the "
"server's `--stream-interval` for this request. Values below the "
"server setting are clamped up to it. The first and last chunks "
"are always sent immediately. Ignored for non-streaming requests."
),
)
# --8<-- [end:chat-completion-extra-params]
@model_validator(mode="before")
@@ -690,6 +700,7 @@ class ChatCompletionRequest(OpenAIBaseModel):
output_kind=(
RequestOutputKind.DELTA if self.stream else RequestOutputKind.FINAL_ONLY
),
stream_interval=self.stream_interval,
structured_outputs=self.extract_structured_outputs(),
logit_bias=self.logit_bias,
bad_words=self.bad_words,