diff --git a/sgl-router/Cargo.toml b/sgl-router/Cargo.toml index 3535f4e03..45db679e2 100644 --- a/sgl-router/Cargo.toml +++ b/sgl-router/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "sglang-router" +name = "sgl-model-gateway" version = "0.2.3" edition = "2021" @@ -11,12 +11,11 @@ vendored-openssl = ["openssl/vendored"] unused_qualifications = "warn" [lib] -name = "sglang_router_rs" -# Pure Rust library (rlib for the binary and other Rust dependents) +name = "sgl_model_gateway" crate-type = ["rlib"] [[bin]] -name = "sglang-router" +name = "sgl-model-gateway" path = "src/main.rs" [[bin]] diff --git a/sgl-router/README.md b/sgl-router/README.md index 780df2444..a7b099978 100644 --- a/sgl-router/README.md +++ b/sgl-router/README.md @@ -93,20 +93,28 @@ pip install --force-reinstall dist/*.whl After installation, verify the installation and check version information: ```bash -# Short version info (Rust binary) -./target/release/sglang-router -v +# Simple version (Rust binary) +./target/release/sgl-model-gateway --version +# or use aliases +./target/release/smg --version +./target/release/amg --version -# Full version info with build details (Rust binary) -./target/release/sglang-router --version +# Full version info with build details +./target/release/sgl-model-gateway --version-verbose + +# Python CLI +amg --version +amg --version-verbose +python3 -m sglang_router --version ``` -The `-v` flag displays a concise version string, while `--version` (or `-V`) shows comprehensive build information including Git commit, build time, compiler versions, and platform details. +The `--version` (or `-V`) flag displays the version string. Use `--version-verbose` for comprehensive build information including Git commit, build time, compiler versions, and platform details. ## Quick Start ### Regular HTTP Routing - **Rust binary** ```bash - ./target/release/sglang-router \ + ./target/release/sgl-model-gateway \ --worker-urls http://worker1:8000 http://worker2:8000 \ --policy cache_aware ``` @@ -121,7 +129,7 @@ The `-v` flag displays a concise version string, while `--version` (or `-V`) sho ### Prefill/Decode Disaggregation (PD) - **Rust binary** ```bash - ./target/release/sglang-router \ + ./target/release/sgl-model-gateway \ --pd-disaggregation \ --prefill http://prefill1:30001 9001 \ --prefill http://prefill2:30002 \ @@ -146,7 +154,7 @@ Prefill entries accept an optional bootstrap port. PD mode merges prefill metada ### Multi-Model Inference Gateway Enable IGW mode to route multiple models through a single router while applying per-model policies: ```bash -./target/release/sglang-router \ +./target/release/sgl-model-gateway \ --enable-igw \ --policy cache_aware \ --max-concurrent-requests 512 @@ -194,7 +202,7 @@ Add more workers with the same API; include optional `labels` (for per-model pol ### gRPC Routing - **Rust binary** ```bash - ./target/release/sglang-router \ + ./target/release/sgl-model-gateway \ --worker-urls grpc://worker-grpc-0:31001 grpc://worker-grpc-1:31002 \ --tokenizer-path /path/to/tokenizer.json \ --reasoning-parser deepseek-r1 \ @@ -229,7 +237,7 @@ python3 -m sglang_router.launch_router \ **Notes** - OpenAI backend mode acts as a proxy to a single remote endpoint; load balancing is not applied. - Provide exactly one `--worker-urls` entry per router instance. -- The Rust binary supports the same flags (`./target/release/sglang-router --backend openai ...`). +- The Rust binary supports the same flags (`./target/release/sgl-model-gateway --backend openai ...`). ### MCP Integration The SGL Model Gateway provides native Model Context Protocol (MCP) client integration, enabling tool calling across STDIO, SSE, and Streamable transports. MCP servers are configured via a YAML configuration file and registered at startup through the workflow engine. @@ -237,7 +245,7 @@ The SGL Model Gateway provides native Model Context Protocol (MCP) client integr #### Basic Usage ```bash # Rust binary -./target/release/sglang-router \ +./target/release/sgl-model-gateway \ --mcp-config-path /path/to/mcp-config.yaml \ --worker-urls http://worker1:8000 @@ -407,7 +415,7 @@ All administrative routes inherit router API-key protection when `--api-key` is ### Service Discovery Enable Kubernetes discovery to reconcile workers automatically: ```bash -./target/release/sglang-router \ +./target/release/sgl-model-gateway \ --service-discovery \ --selector app=sglang-worker role=inference \ --service-discovery-namespace sglang-system \ diff --git a/sgl-router/benches/request_processing.rs b/sgl-router/benches/request_processing.rs index 54d704512..60d51faf0 100644 --- a/sgl-router/benches/request_processing.rs +++ b/sgl-router/benches/request_processing.rs @@ -2,7 +2,7 @@ use std::time::Instant; use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; use serde_json::{from_str, to_string, to_value, to_vec}; -use sglang_router_rs::{ +use sgl_model_gateway::{ core::{BasicWorker, BasicWorkerBuilder, Worker, WorkerType}, protocols::{ chat::{ChatCompletionRequest, ChatMessage, MessageContent}, diff --git a/sgl-router/benches/tokenizer_benchmark.rs b/sgl-router/benches/tokenizer_benchmark.rs index 1175bfb6a..c53ee300f 100644 --- a/sgl-router/benches/tokenizer_benchmark.rs +++ b/sgl-router/benches/tokenizer_benchmark.rs @@ -13,7 +13,7 @@ use std::{ }; use criterion::{black_box, criterion_group, BenchmarkId, Criterion, Throughput}; -use sglang_router_rs::tokenizer::{ +use sgl_model_gateway::tokenizer::{ cache::{CacheConfig, CachedTokenizer}, huggingface::HuggingFaceTokenizer, sequence::Sequence, @@ -31,7 +31,7 @@ fn get_tokenizer_path() -> &'static PathBuf { // with special: true, normalized: false - perfect for demonstrating L1 cache let rt = tokio::runtime::Runtime::new().expect("Failed to create tokio runtime"); let tokenizer_dir = rt.block_on(async { - sglang_router_rs::tokenizer::hub::download_tokenizer_from_hf( + sgl_model_gateway::tokenizer::hub::download_tokenizer_from_hf( "Qwen/Qwen3-4B-Instruct-2507", ) .await diff --git a/sgl-router/benches/tool_parser_benchmark.rs b/sgl-router/benches/tool_parser_benchmark.rs index 0e09bbd4c..30fd76f15 100644 --- a/sgl-router/benches/tool_parser_benchmark.rs +++ b/sgl-router/benches/tool_parser_benchmark.rs @@ -19,7 +19,7 @@ use std::{ use criterion::{black_box, criterion_group, BenchmarkId, Criterion, Throughput}; use serde_json::json; -use sglang_router_rs::{ +use sgl_model_gateway::{ protocols::common::{Function, Tool}, tool_parser::{JsonParser, ParserFactory as ToolParserFactory, ToolParser}, }; diff --git a/sgl-router/bindings/golang/Cargo.toml b/sgl-router/bindings/golang/Cargo.toml index eaedea36c..28f209050 100644 --- a/sgl-router/bindings/golang/Cargo.toml +++ b/sgl-router/bindings/golang/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "sglang-router-golang" -version = "0.2.2" +name = "sgl-model-gateway-golang" +version = "0.2.3" edition = "2021" [lib] -name = "sglang_router_rs" +name = "sgl_model_gateway_go" crate-type = ["cdylib"] [dependencies] @@ -18,14 +18,13 @@ once_cell = "1.21.3" futures-util = "0.3" tracing = "0.1" -[dependencies.sglang-router] +[dependencies.sgl-model-gateway] path = "../.." default-features = true -package = "sglang-router" [features] default = [] -vendored-openssl = ["sglang-router/vendored-openssl"] +vendored-openssl = ["sgl-model-gateway/vendored-openssl"] [profile.release] opt-level = "z" # Optimize for size diff --git a/sgl-router/bindings/golang/src/client.rs b/sgl-router/bindings/golang/src/client.rs index 87543ecec..b4359567f 100644 --- a/sgl-router/bindings/golang/src/client.rs +++ b/sgl-router/bindings/golang/src/client.rs @@ -8,11 +8,11 @@ use tokio::runtime::Runtime; use once_cell::sync::Lazy; use uuid::Uuid; -use sglang_router::tokenizer::create_tokenizer_from_file; -use sglang_router::tokenizer::traits::Tokenizer; -use sglang_router::grpc_client::sglang_scheduler::SglangSchedulerClient; -use sglang_router::protocols::chat::ChatCompletionRequest; -use sglang_router::routers::grpc::utils::{process_chat_messages, generate_tool_constraints}; +use sgl_model_gateway::tokenizer::create_tokenizer_from_file; +use sgl_model_gateway::tokenizer::traits::Tokenizer; +use sgl_model_gateway::grpc_client::sglang_scheduler::SglangSchedulerClient; +use sgl_model_gateway::protocols::chat::ChatCompletionRequest; +use sgl_model_gateway::routers::grpc::utils::{process_chat_messages, generate_tool_constraints}; use super::error::{SglErrorCode, set_error_message}; use super::grpc_converter::sgl_grpc_response_converter_create; diff --git a/sgl-router/bindings/golang/src/grpc_converter.rs b/sgl-router/bindings/golang/src/grpc_converter.rs index c8ec7ecf3..e808884b7 100644 --- a/sgl-router/bindings/golang/src/grpc_converter.rs +++ b/sgl-router/bindings/golang/src/grpc_converter.rs @@ -9,12 +9,12 @@ use serde_json::Value; use tokio::runtime::Runtime; use once_cell::sync::Lazy; -use sglang_router::tokenizer::traits::Tokenizer; -use sglang_router::tokenizer::stream::DecodeStream; -use sglang_router::tool_parser::ToolParser; -use sglang_router::protocols::common::{Tool, ToolChoice, ToolChoiceValue, ToolCallDelta, FunctionCallDelta, Usage, StringOrArray}; -use sglang_router::tokenizer::stop::StopSequenceDecoder; -use sglang_router::grpc_client::sglang_proto as proto; +use sgl_model_gateway::tokenizer::traits::Tokenizer; +use sgl_model_gateway::tokenizer::stream::DecodeStream; +use sgl_model_gateway::tool_parser::ToolParser; +use sgl_model_gateway::protocols::common::{Tool, ToolChoice, ToolChoiceValue, ToolCallDelta, FunctionCallDelta, Usage, StringOrArray}; +use sgl_model_gateway::tokenizer::stop::StopSequenceDecoder; +use sgl_model_gateway::grpc_client::sglang_proto as proto; use super::error::{SglErrorCode, set_error_message, clear_error_message}; use super::tokenizer::TokenizerHandle; @@ -22,9 +22,9 @@ use super::utils::generate_tool_call_id; /// Global parser factory (initialized once) // Use the re-exported ParserFactory from tool_parser module -static PARSER_FACTORY: Lazy = Lazy::new(|| { +static PARSER_FACTORY: Lazy = Lazy::new(|| { // ParserFactory is re-exported from tool_parser::factory, so we can use it directly - sglang_router::tool_parser::ParserFactory::default() + sgl_model_gateway::tool_parser::ParserFactory::default() }); /// Global tokio runtime for async operations @@ -151,7 +151,7 @@ pub unsafe extern "C" fn sgl_grpc_response_converter_create( // Create stop decoder if needed let stop_decoder = if stop.is_some() || stop_token_ids.is_some() { Some(Arc::new(tokio::sync::Mutex::new( - sglang_router::routers::grpc::utils::create_stop_decoder( + sgl_model_gateway::routers::grpc::utils::create_stop_decoder( &tokenizer, stop.as_ref(), stop_token_ids.as_ref(), @@ -389,9 +389,9 @@ pub(crate) async fn convert_proto_chunk_to_openai( request_id: &str, created: u64, system_fingerprint: Option<&str>, -) -> Result, String> { - use sglang_router::grpc_client::sglang_proto::generate_response::Response::*; - use sglang_router::protocols::chat::{ChatCompletionStreamResponse, ChatMessageDelta, ChatStreamChoice}; +) -> Result, String> { + use sgl_model_gateway::grpc_client::sglang_proto::generate_response::Response::*; + use sgl_model_gateway::protocols::chat::{ChatCompletionStreamResponse, ChatMessageDelta, ChatStreamChoice}; match proto_response.response { Some(Chunk(chunk)) => { @@ -427,19 +427,19 @@ pub(crate) async fn convert_proto_chunk_to_openai( let mut text = String::new(); for &token_id in &chunk.token_ids { match decoder_guard.process_token(token_id).unwrap_or_else(|_| { - sglang_router::tokenizer::stop::SequenceDecoderOutput::Held + sgl_model_gateway::tokenizer::stop::SequenceDecoderOutput::Held }) { - sglang_router::tokenizer::stop::SequenceDecoderOutput::Text(t) => { + sgl_model_gateway::tokenizer::stop::SequenceDecoderOutput::Text(t) => { text.push_str(&t); } - sglang_router::tokenizer::stop::SequenceDecoderOutput::StoppedWithText(t) => { + sgl_model_gateway::tokenizer::stop::SequenceDecoderOutput::StoppedWithText(t) => { text.push_str(&t); break; } - sglang_router::tokenizer::stop::SequenceDecoderOutput::Stopped => { + sgl_model_gateway::tokenizer::stop::SequenceDecoderOutput::Stopped => { break; } - sglang_router::tokenizer::stop::SequenceDecoderOutput::Held => {} + sgl_model_gateway::tokenizer::stop::SequenceDecoderOutput::Held => {} } } text diff --git a/sgl-router/bindings/golang/src/stream.rs b/sgl-router/bindings/golang/src/stream.rs index 8bd57ac6c..65cd32476 100644 --- a/sgl-router/bindings/golang/src/stream.rs +++ b/sgl-router/bindings/golang/src/stream.rs @@ -23,7 +23,7 @@ use tokio::runtime::Runtime; use once_cell::sync::Lazy; use futures_util::StreamExt; -use sglang_router::grpc_client::{sglang_proto as proto, sglang_scheduler::{SglangSchedulerClient, AbortOnDropStream}}; +use sgl_model_gateway::grpc_client::{sglang_proto as proto, sglang_scheduler::{SglangSchedulerClient, AbortOnDropStream}}; use super::error::{SglErrorCode, set_error_message}; use super::grpc_converter::{GrpcResponseConverterHandle, convert_proto_chunk_to_openai}; diff --git a/sgl-router/bindings/golang/src/tokenizer.rs b/sgl-router/bindings/golang/src/tokenizer.rs index 191054c29..567abefc8 100644 --- a/sgl-router/bindings/golang/src/tokenizer.rs +++ b/sgl-router/bindings/golang/src/tokenizer.rs @@ -6,7 +6,7 @@ use std::ptr; use std::sync::Arc; use serde_json::Value; -use sglang_router::tokenizer::{ +use sgl_model_gateway::tokenizer::{ create_tokenizer_from_file, traits::Tokenizer as TokenizerTrait, chat_template::ChatTemplateParams, diff --git a/sgl-router/bindings/golang/src/tool_parser.rs b/sgl-router/bindings/golang/src/tool_parser.rs index 1889ac162..49b2639a9 100644 --- a/sgl-router/bindings/golang/src/tool_parser.rs +++ b/sgl-router/bindings/golang/src/tool_parser.rs @@ -9,8 +9,8 @@ use serde_json::{json, Value}; use tokio::runtime::Runtime; use once_cell::sync::Lazy; -use sglang_router::tool_parser::{ParserFactory, ToolParser}; -use sglang_router::protocols::common::Tool; +use sgl_model_gateway::tool_parser::{ParserFactory, ToolParser}; +use sgl_model_gateway::protocols::common::Tool; use super::error::{SglErrorCode, set_error_message, clear_error_message}; use super::utils::generate_tool_call_id; diff --git a/sgl-router/bindings/python/Cargo.toml b/sgl-router/bindings/python/Cargo.toml index d2054d76d..68f73fd14 100644 --- a/sgl-router/bindings/python/Cargo.toml +++ b/sgl-router/bindings/python/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "sglang-router-python" -version = "0.2.2" +name = "sgl-model-gateway-python" +version = "0.2.3" edition = "2021" [lib] @@ -11,14 +11,13 @@ crate-type = ["cdylib"] pyo3 = { version = "0.27.1", features = ["extension-module", "abi3-py38"] } tokio = { version = "1.42.0", features = ["full"] } -[dependencies.sglang-router] +[dependencies.sgl-model-gateway] path = "../.." default-features = true -package = "sglang-router" [features] default = ["pyo3/extension-module"] -vendored-openssl = ["sglang-router/vendored-openssl"] +vendored-openssl = ["sgl-model-gateway/vendored-openssl"] [profile.ci] inherits = "release" diff --git a/sgl-router/bindings/python/src/lib.rs b/sgl-router/bindings/python/src/lib.rs index 16e5c225b..8a321cc95 100644 --- a/sgl-router/bindings/python/src/lib.rs +++ b/sgl-router/bindings/python/src/lib.rs @@ -1,5 +1,5 @@ use pyo3::prelude::*; -use sglang_router::*; +use sgl_model_gateway::*; use std::collections::HashMap; // Define the enums with PyO3 bindings diff --git a/sgl-router/src/core/model_card.rs b/sgl-router/src/core/model_card.rs index a2c27360d..f1d31bcb7 100644 --- a/sgl-router/src/core/model_card.rs +++ b/sgl-router/src/core/model_card.rs @@ -90,7 +90,7 @@ impl std::fmt::Display for ProviderType { /// # Example /// /// ``` -/// use sglang_router_rs::core::{ModelCard, ModelType, ProviderType}; +/// use sgl_model_gateway::core::{ModelCard, ModelType, ProviderType}; /// /// let card = ModelCard::new("meta-llama/Llama-3.1-8B-Instruct") /// .with_display_name("Llama 3.1 8B Instruct") diff --git a/sgl-router/src/logging.rs b/sgl-router/src/logging.rs index 7590e9e15..674149274 100644 --- a/sgl-router/src/logging.rs +++ b/sgl-router/src/logging.rs @@ -28,7 +28,7 @@ impl Default for LoggingConfig { log_dir: None, colorize: true, log_file_name: "sgl-router".to_string(), - log_targets: Some(vec!["sglang_router_rs".to_string()]), + log_targets: Some(vec!["sgl_model_gateway".to_string()]), } } } @@ -63,7 +63,7 @@ pub fn init_logging(config: LoggingConfig) -> LogGuard { }) .collect::() } else { - format!("sglang_router_rs={}", level_filter) + format!("sgl_model_gateway={}", level_filter) }; EnvFilter::new(filter_string) diff --git a/sgl-router/src/main.rs b/sgl-router/src/main.rs index 2ea5ee82a..87b39aa19 100644 --- a/sgl-router/src/main.rs +++ b/sgl-router/src/main.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use clap::{ArgAction, Parser, Subcommand, ValueEnum}; -use sglang_router_rs::{ +use sgl_model_gateway::{ config::{ CircuitBreakerConfig, ConfigError, ConfigResult, DiscoveryConfig, HealthCheckConfig, HistoryBackend, MetricsConfig, OracleConfig, PolicyConfig, PostgresConfig, RetryConfig, diff --git a/sgl-router/src/middleware.rs b/sgl-router/src/middleware.rs index e9fb86220..e4811b1ef 100644 --- a/sgl-router/src/middleware.rs +++ b/sgl-router/src/middleware.rs @@ -222,7 +222,7 @@ impl OnRequest for RequestLogger { // Log the request start info!( - target: "sglang_router_rs::request", + target: "sgl_model_gateway::request", "started processing request" ); } @@ -254,17 +254,17 @@ impl OnResponse for ResponseLogger { let _enter = span.enter(); if status.is_server_error() { error!( - target: "sglang_router_rs::response", + target: "sgl_model_gateway::response", "request failed with server error" ); } else if status.is_client_error() { warn!( - target: "sglang_router_rs::response", + target: "sgl_model_gateway::response", "request failed with client error" ); } else { info!( - target: "sglang_router_rs::response", + target: "sgl_model_gateway::response", "finished processing request" ); } @@ -303,7 +303,7 @@ pub struct RequestLogEntry { pub fn log_request(entry: RequestLogEntry) { if entry.status >= 500 { tracing::error!( - target: "sglang_router_rs::http", + target: "sgl_model_gateway::http", request_id = %entry.request_id, method = %entry.method, uri = %entry.uri, @@ -316,7 +316,7 @@ pub fn log_request(entry: RequestLogEntry) { ); } else if entry.status >= 400 { tracing::warn!( - target: "sglang_router_rs::http", + target: "sgl_model_gateway::http", request_id = %entry.request_id, method = %entry.method, uri = %entry.uri, @@ -328,7 +328,7 @@ pub fn log_request(entry: RequestLogEntry) { ); } else { tracing::info!( - target: "sglang_router_rs::http", + target: "sgl_model_gateway::http", request_id = %entry.request_id, method = %entry.method, uri = %entry.uri, diff --git a/sgl-router/src/routers/grpc/harmony/mod.rs b/sgl-router/src/routers/grpc/harmony/mod.rs index 772dca357..58f45756d 100644 --- a/sgl-router/src/routers/grpc/harmony/mod.rs +++ b/sgl-router/src/routers/grpc/harmony/mod.rs @@ -18,7 +18,7 @@ //! ## Usage //! //! ```ignore -//! use sglang_router_rs::routers::grpc::harmony::{HarmonyDetector, HarmonyBuilder}; +//! use sgl_model_gateway::routers::grpc::harmony::{HarmonyDetector, HarmonyBuilder}; //! //! // Detect if model supports Harmony //! if HarmonyDetector::is_harmony_model("gpt-4o") { diff --git a/sgl-router/src/tokenizer/README.md b/sgl-router/src/tokenizer/README.md index 49ea3aa34..2a4b7a3d5 100644 --- a/sgl-router/src/tokenizer/README.md +++ b/sgl-router/src/tokenizer/README.md @@ -138,7 +138,7 @@ as of `sgl-router/src/tokenizer/*`. ## Usage Examples ```rust use std::sync::Arc; -use sglang_router_rs::tokenizer::{ +use sgl_model_gateway::tokenizer::{ create_tokenizer, SequenceDecoderOutput, StopSequenceDecoderBuilder, Tokenizer, }; @@ -172,7 +172,7 @@ for &token in encoding.token_ids() { ```rust // Apply a chat template when one is bundled with the tokenizer -use sglang_router_rs::tokenizer::{chat_template::ChatTemplateParams, HuggingFaceTokenizer}; +use sgl_model_gateway::tokenizer::{chat_template::ChatTemplateParams, HuggingFaceTokenizer}; let mut hf = HuggingFaceTokenizer::from_file_with_chat_template( "./tokenizer.json", diff --git a/sgl-router/tests/api_endpoints_test.rs b/sgl-router/tests/api_endpoints_test.rs index ac4c93e21..8318cafba 100644 --- a/sgl-router/tests/api_endpoints_test.rs +++ b/sgl-router/tests/api_endpoints_test.rs @@ -10,7 +10,7 @@ use axum::{ use common::mock_worker::{HealthStatus, MockWorker, MockWorkerConfig, WorkerType}; use reqwest::Client; use serde_json::json; -use sglang_router_rs::{ +use sgl_model_gateway::{ app_context::AppContext, config::{RouterConfig, RoutingMode}, core::Job, @@ -1028,7 +1028,7 @@ mod responses_endpoint_tests { let app = ctx.create_app().await; // Directly store a response in the storage to test the retrieval endpoint - use sglang_router_rs::data_connector::{ResponseId, StoredResponse}; + use sgl_model_gateway::data_connector::{ResponseId, StoredResponse}; let mut stored_response = StoredResponse::new(None); stored_response.id = ResponseId::from("resp_test_input_items"); stored_response.input = json!([ diff --git a/sgl-router/tests/cache_aware_backward_compat_test.rs b/sgl-router/tests/cache_aware_backward_compat_test.rs index 9cafd6240..6e45fc372 100644 --- a/sgl-router/tests/cache_aware_backward_compat_test.rs +++ b/sgl-router/tests/cache_aware_backward_compat_test.rs @@ -1,6 +1,6 @@ use std::{collections::HashMap, sync::Arc}; -use sglang_router_rs::{ +use sgl_model_gateway::{ core::{BasicWorkerBuilder, Worker, WorkerType}, policies::{CacheAwareConfig, CacheAwarePolicy, LoadBalancingPolicy}, }; diff --git a/sgl-router/tests/chat_template_format_detection.rs b/sgl-router/tests/chat_template_format_detection.rs index 2e233533d..519047e37 100644 --- a/sgl-router/tests/chat_template_format_detection.rs +++ b/sgl-router/tests/chat_template_format_detection.rs @@ -1,4 +1,4 @@ -use sglang_router_rs::{ +use sgl_model_gateway::{ protocols::chat::{ChatMessage, MessageContent}, tokenizer::chat_template::{ detect_chat_template_content_format, ChatTemplateContentFormat, ChatTemplateParams, diff --git a/sgl-router/tests/chat_template_integration.rs b/sgl-router/tests/chat_template_integration.rs index 805175755..165a01228 100644 --- a/sgl-router/tests/chat_template_integration.rs +++ b/sgl-router/tests/chat_template_integration.rs @@ -1,4 +1,4 @@ -use sglang_router_rs::{ +use sgl_model_gateway::{ protocols::{ chat::{ChatMessage, MessageContent}, common::{ContentPart, ImageUrl}, diff --git a/sgl-router/tests/chat_template_loading.rs b/sgl-router/tests/chat_template_loading.rs index 428101565..945f1506f 100644 --- a/sgl-router/tests/chat_template_loading.rs +++ b/sgl-router/tests/chat_template_loading.rs @@ -2,7 +2,7 @@ mod tests { use std::fs; - use sglang_router_rs::{ + use sgl_model_gateway::{ protocols::chat::{ChatMessage, MessageContent}, tokenizer::{chat_template::ChatTemplateParams, huggingface::HuggingFaceTokenizer}, }; @@ -78,7 +78,7 @@ mod tests { .map(|msg| serde_json::to_value(msg).unwrap()) .collect(); - use sglang_router_rs::tokenizer::chat_template::ChatTemplateParams; + use sgl_model_gateway::tokenizer::chat_template::ChatTemplateParams; let params = ChatTemplateParams { add_generation_prompt: true, ..Default::default() diff --git a/sgl-router/tests/common/mod.rs b/sgl-router/tests/common/mod.rs index 4822b34b4..aa3893fb2 100644 --- a/sgl-router/tests/common/mod.rs +++ b/sgl-router/tests/common/mod.rs @@ -14,7 +14,7 @@ use std::{ }; use serde_json::json; -use sglang_router_rs::{ +use sgl_model_gateway::{ app_context::AppContext, config::RouterConfig, core::{LoadMonitor, WorkerRegistry}, @@ -90,8 +90,8 @@ pub async fn create_test_context(config: RouterConfig) -> Arc { // Initialize JobQueue after AppContext is created let weak_context = Arc::downgrade(&app_context); - let job_queue = sglang_router_rs::core::JobQueue::new( - sglang_router_rs::core::JobQueueConfig::default(), + let job_queue = sgl_model_gateway::core::JobQueue::new( + sgl_model_gateway::core::JobQueueConfig::default(), weak_context, ); app_context @@ -100,7 +100,7 @@ pub async fn create_test_context(config: RouterConfig) -> Arc { .expect("JobQueue should only be initialized once"); // Initialize WorkflowEngine and register workflows - use sglang_router_rs::core::workflow::{ + use sgl_model_gateway::core::workflow::{ create_worker_registration_workflow, create_worker_removal_workflow, WorkflowEngine, }; let engine = Arc::new(WorkflowEngine::new()); @@ -112,7 +112,7 @@ pub async fn create_test_context(config: RouterConfig) -> Arc { .expect("WorkflowEngine should only be initialized once"); // Initialize MCP manager with empty config - use sglang_router_rs::mcp::{McpConfig, McpManager}; + use sgl_model_gateway::mcp::{McpConfig, McpManager}; let empty_config = McpConfig { servers: vec![], pool: Default::default(), @@ -137,7 +137,7 @@ pub async fn create_test_context_with_mcp_config( config: RouterConfig, mcp_config_path: &str, ) -> Arc { - use sglang_router_rs::mcp::{McpConfig, McpManager}; + use sgl_model_gateway::mcp::{McpConfig, McpManager}; let client = reqwest::Client::new(); @@ -201,8 +201,8 @@ pub async fn create_test_context_with_mcp_config( // Initialize JobQueue after AppContext is created let weak_context = Arc::downgrade(&app_context); - let job_queue = sglang_router_rs::core::JobQueue::new( - sglang_router_rs::core::JobQueueConfig::default(), + let job_queue = sgl_model_gateway::core::JobQueue::new( + sgl_model_gateway::core::JobQueueConfig::default(), weak_context, ); app_context @@ -211,7 +211,7 @@ pub async fn create_test_context_with_mcp_config( .expect("JobQueue should only be initialized once"); // Initialize WorkflowEngine and register workflows - use sglang_router_rs::core::workflow::{ + use sgl_model_gateway::core::workflow::{ create_worker_registration_workflow, create_worker_removal_workflow, WorkflowEngine, }; let engine = Arc::new(WorkflowEngine::new()); diff --git a/sgl-router/tests/common/test_app.rs b/sgl-router/tests/common/test_app.rs index 4cc2f6671..2fbb8c74b 100644 --- a/sgl-router/tests/common/test_app.rs +++ b/sgl-router/tests/common/test_app.rs @@ -2,7 +2,7 @@ use std::sync::{Arc, OnceLock}; use axum::Router; use reqwest::Client; -use sglang_router_rs::{ +use sgl_model_gateway::{ app_context::AppContext, config::RouterConfig, core::{LoadMonitor, WorkerRegistry}, diff --git a/sgl-router/tests/mcp_test.rs b/sgl-router/tests/mcp_test.rs index 4254d48cb..8ab50d26d 100644 --- a/sgl-router/tests/mcp_test.rs +++ b/sgl-router/tests/mcp_test.rs @@ -13,7 +13,7 @@ use std::collections::HashMap; use common::mock_mcp_server::MockMCPServer; use serde_json::json; -use sglang_router_rs::mcp::{McpConfig, McpError, McpManager, McpServerConfig, McpTransport}; +use sgl_model_gateway::mcp::{McpConfig, McpError, McpManager, McpServerConfig, McpTransport}; /// Create a new mock server for testing (each test gets its own) async fn create_mock_server() -> MockMCPServer { diff --git a/sgl-router/tests/metrics_aggregator_test.rs b/sgl-router/tests/metrics_aggregator_test.rs index b8797180f..f019efa7c 100644 --- a/sgl-router/tests/metrics_aggregator_test.rs +++ b/sgl-router/tests/metrics_aggregator_test.rs @@ -1,4 +1,4 @@ -use sglang_router_rs::core::metrics_aggregator::{aggregate_metrics, MetricPack}; +use sgl_model_gateway::core::metrics_aggregator::{aggregate_metrics, MetricPack}; #[test] fn test_aggregate_simple() { diff --git a/sgl-router/tests/policy_registry_integration.rs b/sgl-router/tests/policy_registry_integration.rs index 6926707be..5e3f54bd3 100644 --- a/sgl-router/tests/policy_registry_integration.rs +++ b/sgl-router/tests/policy_registry_integration.rs @@ -2,7 +2,7 @@ use std::{collections::HashMap, sync::Arc}; -use sglang_router_rs::{ +use sgl_model_gateway::{ config::PolicyConfig, core::WorkerRegistry, policies::PolicyRegistry, protocols::worker_spec::WorkerConfigRequest, routers::router_manager::RouterManager, }; @@ -115,7 +115,7 @@ async fn test_policy_registry_with_router_manager() { #[test] fn test_policy_registry_cleanup() { - use sglang_router_rs::{config::PolicyConfig, policies::PolicyRegistry}; + use sgl_model_gateway::{config::PolicyConfig, policies::PolicyRegistry}; let registry = PolicyRegistry::new(PolicyConfig::RoundRobin); @@ -142,7 +142,7 @@ fn test_policy_registry_cleanup() { #[test] fn test_policy_registry_multiple_models() { - use sglang_router_rs::{config::PolicyConfig, policies::PolicyRegistry}; + use sgl_model_gateway::{config::PolicyConfig, policies::PolicyRegistry}; let registry = PolicyRegistry::new(PolicyConfig::RoundRobin); diff --git a/sgl-router/tests/request_formats_test.rs b/sgl-router/tests/request_formats_test.rs index e7e40b78d..2475bef6f 100644 --- a/sgl-router/tests/request_formats_test.rs +++ b/sgl-router/tests/request_formats_test.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use common::mock_worker::{HealthStatus, MockWorker, MockWorkerConfig, WorkerType}; use reqwest::Client; use serde_json::json; -use sglang_router_rs::{ +use sgl_model_gateway::{ config::{RouterConfig, RoutingMode}, routers::{RouterFactory, RouterTrait}, }; diff --git a/sgl-router/tests/responses_api_test.rs b/sgl-router/tests/responses_api_test.rs index beed0669c..31285868a 100644 --- a/sgl-router/tests/responses_api_test.rs +++ b/sgl-router/tests/responses_api_test.rs @@ -1,7 +1,7 @@ // Integration test for Responses API use axum::http::StatusCode; -use sglang_router_rs::protocols::{ +use sgl_model_gateway::protocols::{ common::{GenerationRequest, ToolChoice, ToolChoiceValue, UsageInfo}, responses::{ ReasoningEffort, ResponseInput, ResponseReasoningParam, ResponseTool, ResponseToolType, @@ -14,7 +14,7 @@ use common::{ mock_mcp_server::MockMCPServer, mock_worker::{HealthStatus, MockWorker, MockWorkerConfig, WorkerType}, }; -use sglang_router_rs::{config::RouterConfig, routers::RouterFactory}; +use sgl_model_gateway::{config::RouterConfig, routers::RouterFactory}; #[tokio::test] async fn test_non_streaming_mcp_minimal_e2e_with_persistence() { @@ -393,7 +393,7 @@ fn test_usage_conversion() { completion_tokens: 25, total_tokens: 40, reasoning_tokens: Some(8), - prompt_tokens_details: Some(sglang_router_rs::protocols::common::PromptTokenUsageInfo { + prompt_tokens_details: Some(sgl_model_gateway::protocols::common::PromptTokenUsageInfo { cached_tokens: 3, }), }; @@ -781,7 +781,7 @@ async fn test_max_tool_calls_limit() { async fn setup_streaming_mcp_test() -> ( MockMCPServer, MockWorker, - Box, + Box, tempfile::TempDir, ) { let mcp = MockMCPServer::start().await.expect("start mcp"); diff --git a/sgl-router/tests/spec/chat_completion.rs b/sgl-router/tests/spec/chat_completion.rs index 3b30c1850..eaef324a4 100644 --- a/sgl-router/tests/spec/chat_completion.rs +++ b/sgl-router/tests/spec/chat_completion.rs @@ -1,5 +1,5 @@ use serde_json::json; -use sglang_router_rs::protocols::{ +use sgl_model_gateway::protocols::{ chat::{ChatCompletionRequest, ChatMessage, MessageContent}, common::{ Function, FunctionCall, FunctionChoice, StreamOptions, Tool, ToolChoice, ToolChoiceValue, diff --git a/sgl-router/tests/spec/chat_message.rs b/sgl-router/tests/spec/chat_message.rs index 5aeaf1b14..539c12d9c 100644 --- a/sgl-router/tests/spec/chat_message.rs +++ b/sgl-router/tests/spec/chat_message.rs @@ -1,5 +1,5 @@ use serde_json::json; -use sglang_router_rs::protocols::chat::{ChatMessage, MessageContent}; +use sgl_model_gateway::protocols::chat::{ChatMessage, MessageContent}; #[test] fn test_chat_message_tagged_by_role_system() { diff --git a/sgl-router/tests/spec/embedding.rs b/sgl-router/tests/spec/embedding.rs index 2a55d88af..af26ba679 100644 --- a/sgl-router/tests/spec/embedding.rs +++ b/sgl-router/tests/spec/embedding.rs @@ -1,5 +1,5 @@ use serde_json::{from_str, json, to_string}; -use sglang_router_rs::protocols::{common::GenerationRequest, embedding::EmbeddingRequest}; +use sgl_model_gateway::protocols::{common::GenerationRequest, embedding::EmbeddingRequest}; #[test] fn test_embedding_request_serialization_string_input() { diff --git a/sgl-router/tests/spec/rerank.rs b/sgl-router/tests/spec/rerank.rs index 3f6524a0c..4a40990d3 100644 --- a/sgl-router/tests/spec/rerank.rs +++ b/sgl-router/tests/spec/rerank.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use serde_json::{from_str, to_string, Number, Value}; -use sglang_router_rs::protocols::{ +use sgl_model_gateway::protocols::{ common::{GenerationRequest, StringOrArray, UsageInfo}, rerank::{RerankRequest, RerankResponse, RerankResult, V1RerankReqInput}, }; diff --git a/sgl-router/tests/spec/responses.rs b/sgl-router/tests/spec/responses.rs index 8814c12e7..eab839c20 100644 --- a/sgl-router/tests/spec/responses.rs +++ b/sgl-router/tests/spec/responses.rs @@ -1,5 +1,5 @@ use serde_json::json; -use sglang_router_rs::protocols::{ +use sgl_model_gateway::protocols::{ common::{Function, StringOrArray, ToolChoice, ToolChoiceValue}, responses::{ IncludeField, ResponseInput, ResponseInputOutputItem, ResponseTool, ResponseToolType, @@ -963,7 +963,7 @@ fn test_validate_input_items_structure() { /// Test tool_choice defaults to auto when tools are present #[test] fn test_normalize_tool_choice_auto() { - use sglang_router_rs::protocols::validated::Normalizable; + use sgl_model_gateway::protocols::validated::Normalizable; let mut request = ResponsesRequest { input: ResponseInput::Text("test".to_string()), @@ -1004,7 +1004,7 @@ fn test_normalize_tool_choice_auto() { /// Test tool_choice defaults to none when tools array is empty #[test] fn test_normalize_tool_choice_none() { - use sglang_router_rs::protocols::validated::Normalizable; + use sgl_model_gateway::protocols::validated::Normalizable; let mut request = ResponsesRequest { input: ResponseInput::Text("test".to_string()), @@ -1031,7 +1031,7 @@ fn test_normalize_tool_choice_none() { /// Test tool_choice is not overridden if already set #[test] fn test_normalize_tool_choice_no_override() { - use sglang_router_rs::protocols::validated::Normalizable; + use sgl_model_gateway::protocols::validated::Normalizable; let mut request = ResponsesRequest { input: ResponseInput::Text("test".to_string()), @@ -1068,7 +1068,7 @@ fn test_normalize_tool_choice_no_override() { /// Test parallel_tool_calls defaults to true when tools are present #[test] fn test_normalize_parallel_tool_calls() { - use sglang_router_rs::protocols::validated::Normalizable; + use sgl_model_gateway::protocols::validated::Normalizable; let mut request = ResponsesRequest { input: ResponseInput::Text("test".to_string()), @@ -1107,7 +1107,7 @@ fn test_normalize_parallel_tool_calls() { /// Test parallel_tool_calls is not set when tools are absent #[test] fn test_normalize_parallel_tool_calls_no_tools() { - use sglang_router_rs::protocols::validated::Normalizable; + use sgl_model_gateway::protocols::validated::Normalizable; let mut request = ResponsesRequest { input: ResponseInput::Text("test".to_string()), @@ -1127,7 +1127,7 @@ fn test_normalize_parallel_tool_calls_no_tools() { /// Test parallel_tool_calls is not overridden if already set #[test] fn test_normalize_parallel_tool_calls_no_override() { - use sglang_router_rs::protocols::validated::Normalizable; + use sgl_model_gateway::protocols::validated::Normalizable; let mut request = ResponsesRequest { input: ResponseInput::Text("test".to_string()), @@ -1162,7 +1162,7 @@ fn test_normalize_parallel_tool_calls_no_override() { /// Test store defaults to true #[test] fn test_normalize_store_default() { - use sglang_router_rs::protocols::validated::Normalizable; + use sgl_model_gateway::protocols::validated::Normalizable; let mut request = ResponsesRequest { input: ResponseInput::Text("test".to_string()), @@ -1182,7 +1182,7 @@ fn test_normalize_store_default() { /// Test store is not overridden if already set #[test] fn test_normalize_store_no_override() { - use sglang_router_rs::protocols::validated::Normalizable; + use sgl_model_gateway::protocols::validated::Normalizable; let mut request = ResponsesRequest { input: ResponseInput::Text("test".to_string()), diff --git a/sgl-router/tests/streaming_tests.rs b/sgl-router/tests/streaming_tests.rs index 701f218b1..cbcacff11 100644 --- a/sgl-router/tests/streaming_tests.rs +++ b/sgl-router/tests/streaming_tests.rs @@ -6,7 +6,7 @@ use common::mock_worker::{HealthStatus, MockWorker, MockWorkerConfig, WorkerType use futures_util::StreamExt; use reqwest::Client; use serde_json::json; -use sglang_router_rs::{ +use sgl_model_gateway::{ config::{RouterConfig, RoutingMode}, routers::{RouterFactory, RouterTrait}, }; diff --git a/sgl-router/tests/test_openai_routing.rs b/sgl-router/tests/test_openai_routing.rs index 8e7756011..6c24f9bf2 100644 --- a/sgl-router/tests/test_openai_routing.rs +++ b/sgl-router/tests/test_openai_routing.rs @@ -17,7 +17,7 @@ use axum::{ Json, Router, }; use serde_json::json; -use sglang_router_rs::{ +use sgl_model_gateway::{ config::{ ConfigError, ConfigValidator, HistoryBackend, OracleConfig, RouterConfig, RoutingMode, }, @@ -577,12 +577,14 @@ async fn test_router_factory_openai_mode() { worker_urls: vec!["https://api.openai.com".to_string()], }; - let router_config = - RouterConfig::new(routing_mode, sglang_router_rs::config::PolicyConfig::Random); + let router_config = RouterConfig::new( + routing_mode, + sgl_model_gateway::config::PolicyConfig::Random, + ); let app_context = common::create_test_context(router_config).await; - let router = sglang_router_rs::routers::RouterFactory::create_router(&app_context).await; + let router = sgl_model_gateway::routers::RouterFactory::create_router(&app_context).await; assert!( router.is_ok(), "Router factory should create OpenAI router successfully" diff --git a/sgl-router/tests/test_pd_routing.rs b/sgl-router/tests/test_pd_routing.rs index 1151e144b..f26049f70 100644 --- a/sgl-router/tests/test_pd_routing.rs +++ b/sgl-router/tests/test_pd_routing.rs @@ -1,7 +1,7 @@ #[cfg(test)] mod test_pd_routing { use serde_json::json; - use sglang_router_rs::{ + use sgl_model_gateway::{ app_context::AppContext, config::{PolicyConfig, RouterConfig, RoutingMode}, core::{BasicWorkerBuilder, Worker, WorkerType}, @@ -38,7 +38,7 @@ mod test_pd_routing { #[test] fn test_worker_types() { - use sglang_router_rs::core::{BasicWorkerBuilder, Worker, WorkerType}; + use sgl_model_gateway::core::{BasicWorkerBuilder, Worker, WorkerType}; let prefill_worker: Box = Box::new( BasicWorkerBuilder::new("http://prefill:8080") @@ -214,7 +214,7 @@ mod test_pd_routing { let app_context = { use std::sync::{Arc, OnceLock}; - use sglang_router_rs::{ + use sgl_model_gateway::{ core::{LoadMonitor, WorkerRegistry}, data_connector::{ MemoryConversationItemStorage, MemoryConversationStorage, @@ -673,7 +673,7 @@ mod test_pd_routing { #[test] fn test_bootstrap_injection_with_benchmark_requests() { - use sglang_router_rs::core::{BasicWorkerBuilder, Worker, WorkerType}; + use sgl_model_gateway::core::{BasicWorkerBuilder, Worker, WorkerType}; let mut benchmark_request = json!({ "input_ids": vec![vec![1, 2, 3, 4]; 16], // Batch size 16 diff --git a/sgl-router/tests/tokenizer_cache_correctness_test.rs b/sgl-router/tests/tokenizer_cache_correctness_test.rs index 66a1838fe..eef0d2d55 100644 --- a/sgl-router/tests/tokenizer_cache_correctness_test.rs +++ b/sgl-router/tests/tokenizer_cache_correctness_test.rs @@ -9,7 +9,7 @@ use std::{ sync::{Arc, OnceLock}, }; -use sglang_router_rs::tokenizer::{ +use sgl_model_gateway::tokenizer::{ cache::{CacheConfig, CachedTokenizer}, hub::download_tokenizer_from_hf, huggingface::HuggingFaceTokenizer, diff --git a/sgl-router/tests/tokenizer_integration.rs b/sgl-router/tests/tokenizer_integration.rs index b6fb68232..b88943e4b 100644 --- a/sgl-router/tests/tokenizer_integration.rs +++ b/sgl-router/tests/tokenizer_integration.rs @@ -7,7 +7,7 @@ mod common; use std::sync::Arc; use common::{ensure_tokenizer_cached, EXPECTED_HASHES, TEST_PROMPTS}; -use sglang_router_rs::tokenizer::{ +use sgl_model_gateway::tokenizer::{ factory, huggingface::HuggingFaceTokenizer, sequence::Sequence, stop::*, stream::DecodeStream, traits::*, }; @@ -269,7 +269,7 @@ fn test_batch_encoding() { #[test] fn test_special_tokens() { - use sglang_router_rs::tokenizer::traits::Tokenizer as TokenizerTrait; + use sgl_model_gateway::tokenizer::traits::Tokenizer as TokenizerTrait; let tokenizer_path = ensure_tokenizer_cached(); let tokenizer = HuggingFaceTokenizer::from_file(tokenizer_path.to_str().unwrap()) @@ -398,7 +398,7 @@ fn test_load_chat_template_from_local_file() { #[tokio::test] async fn test_tinyllama_embedded_template() { - use sglang_router_rs::tokenizer::hub::download_tokenizer_from_hf; + use sgl_model_gateway::tokenizer::hub::download_tokenizer_from_hf; // Skip in CI without HF_TOKEN @@ -434,7 +434,7 @@ async fn test_tinyllama_embedded_template() { #[tokio::test] async fn test_qwen3_next_embedded_template() { - use sglang_router_rs::tokenizer::hub::download_tokenizer_from_hf; + use sgl_model_gateway::tokenizer::hub::download_tokenizer_from_hf; // Test 3: Qwen3-Next has chat template in tokenizer_config.json match download_tokenizer_from_hf("Qwen/Qwen3-Next-80B-A3B-Instruct").await { @@ -466,7 +466,7 @@ async fn test_qwen3_next_embedded_template() { #[tokio::test] async fn test_qwen3_vl_json_template_priority() { - use sglang_router_rs::tokenizer::hub::download_tokenizer_from_hf; + use sgl_model_gateway::tokenizer::hub::download_tokenizer_from_hf; // Test 4: Qwen3-VL has both tokenizer_config.json template and chat_template.json // Should prioritize chat_template.json @@ -508,7 +508,7 @@ async fn test_qwen3_vl_json_template_priority() { #[tokio::test] async fn test_llava_separate_jinja_template() { - use sglang_router_rs::tokenizer::hub::download_tokenizer_from_hf; + use sgl_model_gateway::tokenizer::hub::download_tokenizer_from_hf; // Test 5: llava has chat_template.jinja as a separate file, not in tokenizer_config.json match download_tokenizer_from_hf("llava-hf/llava-1.5-7b-hf").await { diff --git a/sgl-router/tests/tool_parser_deepseek.rs b/sgl-router/tests/tool_parser_deepseek.rs index d3db93145..c47082895 100644 --- a/sgl-router/tests/tool_parser_deepseek.rs +++ b/sgl-router/tests/tool_parser_deepseek.rs @@ -1,6 +1,6 @@ //! DeepSeek V3 Parser Integration Tests -use sglang_router_rs::tool_parser::{DeepSeekParser, ToolParser}; +use sgl_model_gateway::tool_parser::{DeepSeekParser, ToolParser}; mod common; use common::create_test_tools; diff --git a/sgl-router/tests/tool_parser_edge_cases.rs b/sgl-router/tests/tool_parser_edge_cases.rs index 2f11689a1..6fc4f6bcb 100644 --- a/sgl-router/tests/tool_parser_edge_cases.rs +++ b/sgl-router/tests/tool_parser_edge_cases.rs @@ -2,7 +2,7 @@ //! //! Tests for malformed input, edge cases, and error recovery -use sglang_router_rs::tool_parser::{ +use sgl_model_gateway::tool_parser::{ JsonParser, MistralParser, PythonicParser, QwenParser, ToolParser, }; diff --git a/sgl-router/tests/tool_parser_fallback.rs b/sgl-router/tests/tool_parser_fallback.rs index 16f185325..96b71bfe0 100644 --- a/sgl-router/tests/tool_parser_fallback.rs +++ b/sgl-router/tests/tool_parser_fallback.rs @@ -3,7 +3,7 @@ //! When tool call parsing fails, the original text should be preserved as normal text //! rather than being lost. This ensures graceful degradation. -use sglang_router_rs::tool_parser::{ +use sgl_model_gateway::tool_parser::{ DeepSeekParser, JsonParser, LlamaParser, MistralParser, QwenParser, ToolParser, }; diff --git a/sgl-router/tests/tool_parser_glm4_moe.rs b/sgl-router/tests/tool_parser_glm4_moe.rs index 86d161c9e..1e001a9f6 100644 --- a/sgl-router/tests/tool_parser_glm4_moe.rs +++ b/sgl-router/tests/tool_parser_glm4_moe.rs @@ -1,6 +1,6 @@ //! GLM-4 MoE Parser Integration Tests -use sglang_router_rs::tool_parser::{Glm4MoeParser, ToolParser}; +use sgl_model_gateway::tool_parser::{Glm4MoeParser, ToolParser}; mod common; use common::create_test_tools; diff --git a/sgl-router/tests/tool_parser_json.rs b/sgl-router/tests/tool_parser_json.rs index 8e44d8d1e..fd3ca8f03 100644 --- a/sgl-router/tests/tool_parser_json.rs +++ b/sgl-router/tests/tool_parser_json.rs @@ -3,7 +3,7 @@ //! Tests for the JSON parser which handles OpenAI, Claude, and generic JSON formats use serde_json::json; -use sglang_router_rs::tool_parser::{JsonParser, ToolParser}; +use sgl_model_gateway::tool_parser::{JsonParser, ToolParser}; mod common; use common::{create_test_tools, streaming_helpers::*}; @@ -166,7 +166,7 @@ async fn test_json_format_detection() { // Streaming tests for JSON array format #[tokio::test] async fn test_json_array_streaming_required_mode() { - use sglang_router_rs::protocols::common::Tool; + use sgl_model_gateway::protocols::common::Tool; // Test that simulates the exact streaming pattern from required mode let mut parser = JsonParser::new(); @@ -174,7 +174,7 @@ async fn test_json_array_streaming_required_mode() { // Define test tools let tools = vec![Tool { tool_type: "function".to_string(), - function: sglang_router_rs::protocols::common::Function { + function: sgl_model_gateway::protocols::common::Function { name: "get_weather".to_string(), description: Some("Get weather".to_string()), parameters: serde_json::json!({}), @@ -240,7 +240,7 @@ async fn test_json_array_streaming_required_mode() { #[tokio::test] async fn test_json_array_multiple_tools_streaming() { - use sglang_router_rs::protocols::common::Tool; + use sgl_model_gateway::protocols::common::Tool; // Test with multiple tools in array let mut parser = JsonParser::new(); @@ -248,7 +248,7 @@ async fn test_json_array_multiple_tools_streaming() { let tools = vec![ Tool { tool_type: "function".to_string(), - function: sglang_router_rs::protocols::common::Function { + function: sgl_model_gateway::protocols::common::Function { name: "get_weather".to_string(), description: Some("Get weather".to_string()), parameters: serde_json::json!({}), @@ -257,7 +257,7 @@ async fn test_json_array_multiple_tools_streaming() { }, Tool { tool_type: "function".to_string(), - function: sglang_router_rs::protocols::common::Function { + function: sgl_model_gateway::protocols::common::Function { name: "get_news".to_string(), description: Some("Get news".to_string()), parameters: serde_json::json!({}), @@ -305,14 +305,14 @@ async fn test_json_array_multiple_tools_streaming() { #[tokio::test] async fn test_json_array_closing_bracket_separate_chunk() { - use sglang_router_rs::protocols::common::Tool; + use sgl_model_gateway::protocols::common::Tool; // Test case where the closing ] comes as a separate chunk let mut parser = JsonParser::new(); let tools = vec![Tool { tool_type: "function".to_string(), - function: sglang_router_rs::protocols::common::Function { + function: sgl_model_gateway::protocols::common::Function { name: "get_weather".to_string(), description: Some("Get weather".to_string()), parameters: json!({}), @@ -366,14 +366,14 @@ async fn test_json_array_closing_bracket_separate_chunk() { #[tokio::test] async fn test_json_single_object_with_trailing_text() { - use sglang_router_rs::protocols::common::Tool; + use sgl_model_gateway::protocols::common::Tool; // Test single object format (no array) with trailing text let mut parser = JsonParser::new(); let tools = vec![Tool { tool_type: "function".to_string(), - function: sglang_router_rs::protocols::common::Function { + function: sgl_model_gateway::protocols::common::Function { name: "get_weather".to_string(), description: Some("Get weather".to_string()), parameters: serde_json::json!({}), @@ -420,14 +420,14 @@ async fn test_json_single_object_with_trailing_text() { #[tokio::test] async fn test_json_single_object_with_bracket_in_text() { - use sglang_router_rs::protocols::common::Tool; + use sgl_model_gateway::protocols::common::Tool; // Test that ] in normal text is NOT stripped for single object format let mut parser = JsonParser::new(); let tools = vec![Tool { tool_type: "function".to_string(), - function: sglang_router_rs::protocols::common::Function { + function: sgl_model_gateway::protocols::common::Function { name: "get_weather".to_string(), description: Some("Get weather".to_string()), parameters: serde_json::json!({}), @@ -472,14 +472,14 @@ async fn test_json_single_object_with_bracket_in_text() { #[tokio::test] async fn test_json_array_bracket_in_text_after_tools() { - use sglang_router_rs::protocols::common::Tool; + use sgl_model_gateway::protocols::common::Tool; // Test that ] in normal text AFTER array tools is preserved let mut parser = JsonParser::new(); let tools = vec![Tool { tool_type: "function".to_string(), - function: sglang_router_rs::protocols::common::Function { + function: sgl_model_gateway::protocols::common::Function { name: "get_weather".to_string(), description: Some("Get weather".to_string()), parameters: serde_json::json!({}), diff --git a/sgl-router/tests/tool_parser_kimik2.rs b/sgl-router/tests/tool_parser_kimik2.rs index f7f0a6c96..f7e8462a2 100644 --- a/sgl-router/tests/tool_parser_kimik2.rs +++ b/sgl-router/tests/tool_parser_kimik2.rs @@ -1,6 +1,6 @@ //! Kimi K2 Parser Integration Tests -use sglang_router_rs::tool_parser::{KimiK2Parser, ToolParser}; +use sgl_model_gateway::tool_parser::{KimiK2Parser, ToolParser}; mod common; use common::create_test_tools; diff --git a/sgl-router/tests/tool_parser_llama.rs b/sgl-router/tests/tool_parser_llama.rs index a29912178..b07ff4acf 100644 --- a/sgl-router/tests/tool_parser_llama.rs +++ b/sgl-router/tests/tool_parser_llama.rs @@ -2,7 +2,7 @@ //! //! Tests for the Llama parser which handles <|python_tag|> format and plain JSON -use sglang_router_rs::tool_parser::{LlamaParser, ToolParser}; +use sgl_model_gateway::tool_parser::{LlamaParser, ToolParser}; mod common; use common::{create_test_tools, streaming_helpers::*}; diff --git a/sgl-router/tests/tool_parser_minimax_m2.rs b/sgl-router/tests/tool_parser_minimax_m2.rs index a6b296ec5..d47342ee0 100644 --- a/sgl-router/tests/tool_parser_minimax_m2.rs +++ b/sgl-router/tests/tool_parser_minimax_m2.rs @@ -1,6 +1,6 @@ //! MiniMax M2 Parser Integration Tests -use sglang_router_rs::tool_parser::{MinimaxM2Parser, ToolParser}; +use sgl_model_gateway::tool_parser::{MinimaxM2Parser, ToolParser}; mod common; use common::create_test_tools; diff --git a/sgl-router/tests/tool_parser_mistral.rs b/sgl-router/tests/tool_parser_mistral.rs index 42b75a0cf..321aa6686 100644 --- a/sgl-router/tests/tool_parser_mistral.rs +++ b/sgl-router/tests/tool_parser_mistral.rs @@ -3,7 +3,7 @@ //! Tests for the Mistral parser which handles [TOOL_CALLS] format use serde_json::json; -use sglang_router_rs::tool_parser::{MistralParser, ToolParser}; +use sgl_model_gateway::tool_parser::{MistralParser, ToolParser}; #[tokio::test] async fn test_mistral_single_tool() { @@ -158,14 +158,14 @@ Let me execute these searches for you."#; #[tokio::test] async fn test_mistral_streaming_closing_bracket() { - use sglang_router_rs::protocols::common::Tool; + use sgl_model_gateway::protocols::common::Tool; // Test that closing ] is stripped for Mistral array format let mut parser = MistralParser::new(); let tools = vec![Tool { tool_type: "function".to_string(), - function: sglang_router_rs::protocols::common::Function { + function: sgl_model_gateway::protocols::common::Function { name: "get_weather".to_string(), description: Some("Get weather".to_string()), parameters: json!({}), @@ -218,14 +218,14 @@ async fn test_mistral_streaming_closing_bracket() { #[tokio::test] async fn test_mistral_streaming_bracket_in_text_after_tools() { - use sglang_router_rs::protocols::common::Tool; + use sgl_model_gateway::protocols::common::Tool; // Test that ] in normal text AFTER tool calls is preserved let mut parser = MistralParser::new(); let tools = vec![Tool { tool_type: "function".to_string(), - function: sglang_router_rs::protocols::common::Function { + function: sgl_model_gateway::protocols::common::Function { name: "get_weather".to_string(), description: Some("Get weather".to_string()), parameters: json!({}), diff --git a/sgl-router/tests/tool_parser_mixed_edge_cases.rs b/sgl-router/tests/tool_parser_mixed_edge_cases.rs index d722ee1a2..db3898df2 100644 --- a/sgl-router/tests/tool_parser_mixed_edge_cases.rs +++ b/sgl-router/tests/tool_parser_mixed_edge_cases.rs @@ -3,7 +3,7 @@ //! Tests for edge cases across parsers and mixed format scenarios use serde_json::json; -use sglang_router_rs::tool_parser::{ +use sgl_model_gateway::tool_parser::{ JsonParser, LlamaParser, MistralParser, PythonicParser, QwenParser, ToolParser, }; diff --git a/sgl-router/tests/tool_parser_partial_json.rs b/sgl-router/tests/tool_parser_partial_json.rs index 36d493651..e3c28a237 100644 --- a/sgl-router/tests/tool_parser_partial_json.rs +++ b/sgl-router/tests/tool_parser_partial_json.rs @@ -2,7 +2,7 @@ //! //! Tests for the partial JSON parser with allow_partial_strings flag behavior -use sglang_router_rs::tool_parser::partial_json::PartialJson; +use sgl_model_gateway::tool_parser::partial_json::PartialJson; #[test] fn test_partial_string_flag_disallows_incomplete_strings() { diff --git a/sgl-router/tests/tool_parser_pythonic.rs b/sgl-router/tests/tool_parser_pythonic.rs index 1215bbe4c..a5c0b46de 100644 --- a/sgl-router/tests/tool_parser_pythonic.rs +++ b/sgl-router/tests/tool_parser_pythonic.rs @@ -3,7 +3,7 @@ //! Tests for the Pythonic parser which handles Python function call syntax use serde_json::json; -use sglang_router_rs::tool_parser::{PythonicParser, ToolParser}; +use sgl_model_gateway::tool_parser::{PythonicParser, ToolParser}; mod common; use common::create_test_tools; diff --git a/sgl-router/tests/tool_parser_qwen.rs b/sgl-router/tests/tool_parser_qwen.rs index 01fee8fbf..c26164d59 100644 --- a/sgl-router/tests/tool_parser_qwen.rs +++ b/sgl-router/tests/tool_parser_qwen.rs @@ -3,7 +3,7 @@ //! Tests for the Qwen parser which handles ... format use serde_json::json; -use sglang_router_rs::tool_parser::{QwenParser, ToolParser}; +use sgl_model_gateway::tool_parser::{QwenParser, ToolParser}; mod common; use common::{create_test_tools, streaming_helpers::*}; diff --git a/sgl-router/tests/tool_parser_step3.rs b/sgl-router/tests/tool_parser_step3.rs index 85cbacfae..03913e661 100644 --- a/sgl-router/tests/tool_parser_step3.rs +++ b/sgl-router/tests/tool_parser_step3.rs @@ -1,6 +1,6 @@ //! Step3 Parser Integration Tests -use sglang_router_rs::tool_parser::{Step3Parser, ToolParser}; +use sgl_model_gateway::tool_parser::{Step3Parser, ToolParser}; mod common; use common::create_test_tools; diff --git a/sgl-router/tests/workflow_test.rs b/sgl-router/tests/workflow_test.rs index 6b2f58ee2..be36030c3 100644 --- a/sgl-router/tests/workflow_test.rs +++ b/sgl-router/tests/workflow_test.rs @@ -8,7 +8,7 @@ use std::{ time::Duration, }; -use sglang_router_rs::core::workflow::*; +use sgl_model_gateway::core::workflow::*; use tokio::time::sleep; // Test step that counts invocations