[router][grpc] Refine streaming processes (#11277)
This commit is contained in:
@@ -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)]
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user