[router] Use get_pooled in process_single_choice (#11079)

This commit is contained in:
Chang Su
2025-09-29 15:48:00 -07:00
committed by GitHub
parent 9de1320b63
commit f065e5bea5

View File

@@ -769,10 +769,13 @@ impl GrpcRouter {
// Check if reasoning parsing is enabled and separate_reasoning is requested // Check if reasoning parsing is enabled and separate_reasoning is requested
if original_request.separate_reasoning { if original_request.separate_reasoning {
if let Ok(mut parser) = self let pooled_parser = self
.reasoning_parser_factory .reasoning_parser_factory
.create(&original_request.model) .get_pooled(&original_request.model);
{
let mut parser = pooled_parser
.lock()
.map_err(|e| format!("Failed to acquire reasoning parser lock: {}", e))?;
match parser.detect_and_parse_reasoning(&processed_text) { match parser.detect_and_parse_reasoning(&processed_text) {
Ok(result) => { Ok(result) => {
if !result.reasoning_text.is_empty() { if !result.reasoning_text.is_empty() {
@@ -785,7 +788,6 @@ impl GrpcRouter {
} }
} }
} }
}
// Step 2: Handle tool call parsing // Step 2: Handle tool call parsing
let mut tool_calls: Option<Vec<crate::protocols::spec::ToolCall>> = None; let mut tool_calls: Option<Vec<crate::protocols::spec::ToolCall>> = None;