[router] forward stream_options in request (#7860)

This commit is contained in:
Shuaiyi Zhang
2025-07-08 23:03:38 +08:00
committed by GitHub
parent 653b873b91
commit 51ae40306a
3 changed files with 21 additions and 0 deletions

View File

@@ -52,6 +52,10 @@ pub struct CompletionRequest {
#[serde(default)]
pub stream: bool,
/// Options for streaming response
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_options: Option<StreamOptions>,
/// Include the log probabilities on the logprobs most likely tokens
#[serde(skip_serializing_if = "Option::is_none")]
pub logprobs: Option<u32>,
@@ -132,6 +136,10 @@ pub struct ChatCompletionRequest {
#[serde(default)]
pub stream: bool,
/// Options for streaming response
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_options: Option<StreamOptions>,
/// Up to 4 sequences where the API will stop generating further tokens
#[serde(skip_serializing_if = "Option::is_none")]
pub stop: Option<StringOrArray>,
@@ -258,6 +266,12 @@ pub struct ImageUrl {
pub detail: Option<String>, // "auto", "low", or "high"
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct StreamOptions {
#[serde(skip_serializing_if = "Option::is_none")]
pub include_usage: Option<bool>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(tag = "type")]
pub enum ResponseFormat {