[router][grpc] Further delegate non-stream processing to processing.rs (#11553)
This commit is contained in:
@@ -23,6 +23,9 @@ use std::sync::Arc;
|
||||
|
||||
use tracing::debug;
|
||||
|
||||
use super::context::SharedComponents;
|
||||
use super::pipeline::RequestPipeline;
|
||||
|
||||
/// gRPC PD (Prefill-Decode) router implementation for SGLang
|
||||
#[derive(Clone)]
|
||||
#[allow(dead_code)] // Fields will be used once implementation is complete
|
||||
@@ -37,8 +40,8 @@ pub struct GrpcPDRouter {
|
||||
retry_config: RetryConfig,
|
||||
configured_reasoning_parser: Option<String>,
|
||||
configured_tool_parser: Option<String>,
|
||||
pipeline: super::pipeline::ChatCompletionPipeline,
|
||||
shared_components: Arc<super::context::SharedComponents>,
|
||||
pipeline: RequestPipeline,
|
||||
shared_components: Arc<SharedComponents>,
|
||||
}
|
||||
|
||||
impl GrpcPDRouter {
|
||||
@@ -66,36 +69,21 @@ impl GrpcPDRouter {
|
||||
.clone();
|
||||
|
||||
// Create shared components for pipeline
|
||||
let shared_components = Arc::new(super::context::SharedComponents {
|
||||
let shared_components = Arc::new(SharedComponents {
|
||||
tokenizer: tokenizer.clone(),
|
||||
tool_parser_factory: tool_parser_factory.clone(),
|
||||
reasoning_parser_factory: reasoning_parser_factory.clone(),
|
||||
});
|
||||
|
||||
// Create response processor
|
||||
let processor = super::processing::ResponseProcessor::new(
|
||||
tokenizer.clone(),
|
||||
tool_parser_factory.clone(),
|
||||
reasoning_parser_factory.clone(),
|
||||
ctx.configured_tool_parser.clone(),
|
||||
ctx.configured_reasoning_parser.clone(),
|
||||
);
|
||||
|
||||
// Create streaming processor
|
||||
let streaming_processor = Arc::new(super::streaming::StreamingProcessor::new(
|
||||
tokenizer.clone(),
|
||||
tool_parser_factory.clone(),
|
||||
reasoning_parser_factory.clone(),
|
||||
ctx.configured_tool_parser.clone(),
|
||||
ctx.configured_reasoning_parser.clone(),
|
||||
));
|
||||
|
||||
// Create PD pipeline
|
||||
let pipeline = super::pipeline::ChatCompletionPipeline::new_pd(
|
||||
let pipeline = RequestPipeline::new_pd(
|
||||
worker_registry.clone(),
|
||||
policy_registry.clone(),
|
||||
processor,
|
||||
streaming_processor,
|
||||
tokenizer.clone(),
|
||||
tool_parser_factory.clone(),
|
||||
reasoning_parser_factory.clone(),
|
||||
ctx.configured_tool_parser.clone(),
|
||||
ctx.configured_reasoning_parser.clone(),
|
||||
);
|
||||
|
||||
Ok(GrpcPDRouter {
|
||||
|
||||
Reference in New Issue
Block a user