[router][grpc] Refine streaming processes (#11277)

This commit is contained in:
Chang Su
2025-10-06 15:15:01 -07:00
committed by GitHub
parent 748f86f3de
commit b07c9c76c5
9 changed files with 77 additions and 32 deletions

View File

@@ -187,6 +187,10 @@ impl ReasoningParser for BaseReasoningParser {
fn model_type(&self) -> &str {
&self.model_type
}
fn is_in_reasoning(&self) -> bool {
self.in_reasoning
}
}
#[cfg(test)]

View File

@@ -55,6 +55,10 @@ impl ReasoningParser for DeepSeekR1Parser {
fn model_type(&self) -> &str {
self.base.model_type()
}
fn is_in_reasoning(&self) -> bool {
self.base.is_in_reasoning()
}
}
#[cfg(test)]

View File

@@ -54,6 +54,10 @@ impl ReasoningParser for Glm45Parser {
fn model_type(&self) -> &str {
self.base.model_type()
}
fn is_in_reasoning(&self) -> bool {
self.base.is_in_reasoning()
}
}
#[cfg(test)]

View File

@@ -54,6 +54,10 @@ impl ReasoningParser for KimiParser {
fn model_type(&self) -> &str {
self.base.model_type()
}
fn is_in_reasoning(&self) -> bool {
self.base.is_in_reasoning()
}
}
#[cfg(test)]

View File

@@ -55,6 +55,10 @@ impl ReasoningParser for Qwen3Parser {
fn model_type(&self) -> &str {
self.base.model_type()
}
fn is_in_reasoning(&self) -> bool {
self.base.is_in_reasoning()
}
}
/// QwenThinking parser - variant that assumes reasoning from start.
@@ -106,6 +110,10 @@ impl ReasoningParser for QwenThinkingParser {
fn model_type(&self) -> &str {
self.base.model_type()
}
fn is_in_reasoning(&self) -> bool {
self.base.is_in_reasoning()
}
}
#[cfg(test)]

View File

@@ -54,6 +54,10 @@ impl ReasoningParser for Step3Parser {
fn model_type(&self) -> &str {
self.base.model_type()
}
fn is_in_reasoning(&self) -> bool {
self.base.is_in_reasoning()
}
}
#[cfg(test)]

View File

@@ -69,6 +69,11 @@ pub trait ReasoningParser: Send + Sync {
/// Get the model type this parser is designed for.
fn model_type(&self) -> &str;
/// Check if the parser is currently in reasoning mode.
///
/// Returns true if the parser is currently parsing reasoning content.
fn is_in_reasoning(&self) -> bool;
}
/// Error types for reasoning parsing operations.