Expand description
Opt-in, partial validation of parsed protocol values.
Select one contract namespace: openai, vllm, or sglang. Each
namespace exposes field helpers and a request trait for the covered request
types. The engine namespaces reuse the OpenAI operation where the engine
matches it and define an override where it differs. Engine contracts are not
supersets of OpenAI, so do not run the OpenAI checks before an engine’s checks.
All operations in this module follow the same contract:
- They are read-only. They never mutate, normalize, insert defaults, or dispatch.
- Field helpers are named
validate_<field>and take the request field’s parsed type.None(omitted or null at the typed boundary) always succeeds. - Float helpers reject NaN and infinities. They check parsed
f32values and do not reproduce JSON coercion, null admission, or backend HTTP diagnostics. - Request traits run their covered checks in a documented order and return the first failure. Success does not establish complete endpoint admission.
Coverage and known gaps are tracked in the temporary coverage tracker.
use dynamo_protocols::{
normalization,
types::CreateCompletionRequest,
validation::{openai::OpenAIValidation, vllm::VllmValidation},
};
let mut request = CreateCompletionRequest {
logprobs: Some(10),
..Default::default()
};
normalization::vllm::normalize_completion_logprobs(&mut request.logprobs);
// vLLM accepts 10 completion logprobs; the OpenAI baseline allows at most 5.
assert!(VllmValidation::validate(&request).is_ok());
assert!(OpenAIValidation::validate(&request).is_err());
assert_eq!(request.logprobs, Some(10));A server still owns prompt, model, runtime, and other admission checks.
Modules§
- openai
- OpenAI baseline contract.
- sglang
- SGLang contract: OpenAI reuse, shared engine operations, and SGLang overrides.
- vllm
- vLLM contract: OpenAI reuse, shared engine operations, and vLLM overrides.
Structs§
- Validation
Error - A library diagnostic for the first failed covered check.