[Router] Refactor protocol definitions: split spec.rs into modular files (#11677)
Co-authored-by: Chang Su <chang.s.su@oracle.com>
This commit is contained in:
@@ -7,10 +7,10 @@ use std::time::Duration;
|
||||
use tonic::{transport::Channel, Request, Streaming};
|
||||
use tracing::{debug, warn};
|
||||
|
||||
use crate::protocols::spec::{
|
||||
ChatCompletionRequest, GenerateRequest, ResponseFormat,
|
||||
SamplingParams as GenerateSamplingParams, StringOrArray,
|
||||
};
|
||||
use crate::protocols::chat::ChatCompletionRequest;
|
||||
use crate::protocols::common::{ResponseFormat, StringOrArray, ToolChoice, ToolChoiceValue};
|
||||
use crate::protocols::generate::GenerateRequest;
|
||||
use crate::protocols::sampling_params::SamplingParams as GenerateSamplingParams;
|
||||
|
||||
// Include the generated protobuf code
|
||||
pub mod proto {
|
||||
@@ -306,9 +306,7 @@ impl SglangSchedulerClient {
|
||||
// Handle skip_special_tokens: set to false if tools are present and tool_choice is not "none"
|
||||
let skip_special_tokens = if request.tools.is_some() {
|
||||
match &request.tool_choice {
|
||||
Some(crate::protocols::spec::ToolChoice::Value(
|
||||
crate::protocols::spec::ToolChoiceValue::None,
|
||||
)) => request.skip_special_tokens,
|
||||
Some(ToolChoice::Value(ToolChoiceValue::None)) => request.skip_special_tokens,
|
||||
Some(_) => false, // tool_choice is not "none"
|
||||
None => false, // TODO: this assumes tool_choice defaults to "auto" when tools present
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user