dynamo_protocols/normalization.rs
1// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4//! Explicit normalization of parsed request fields, separate from validation.
5//!
6//! Namespaces mirror [`crate::validation`]: `openai` is the baseline and the
7//! engine namespaces reuse it where their behavior matches. Only completion
8//! `logprobs` is covered. Model defaults, sentinel rewrites, greedy
9//! transformations, and request-wide normalization are not implemented.
10
11pub mod openai {
12 /// Preserves completion `logprobs` unchanged: no default is inserted for `None`,
13 /// and explicit values, including invalid ones, are left for validation.
14 ///
15 /// Call after parsing and before the selected logprobs validator. Parsing already
16 /// maps both a missing key and explicit null to `None`, and serialization omits
17 /// the key for `None`; this operation cannot recover that distinction. It cannot
18 /// fail and is idempotent. Later engine conversion owns the effective count.
19 pub fn normalize_completion_logprobs(_value: &mut Option<u8>) {}
20}
21
22/// vLLM normalization; currently identical to the OpenAI baseline.
23pub mod vllm {
24 pub use super::openai::normalize_completion_logprobs;
25}
26
27/// SGLang normalization; currently identical to the OpenAI baseline.
28pub mod sglang {
29 pub use super::openai::normalize_completion_logprobs;
30}