Expand description
Composable request validators (plan #84).
Borrowed from MAX’s pipelines/core/context_validators.py. Each
validation rule is a small composable function returning
Result<(), ValidationError>. Pipelines pick which to apply for
their request type.
Why composable instead of a single validate_request()?
- Different request types (text embed, image embed, generation) share some rules (max length) but not others (image bounds).
- Adding a rule = one function, not editing a monolith.
- Easy to test rules in isolation.
Used by future serving paths (#31, #32 in PLAN.md). Today the benchmark runners can use it for input sanity checks.
Structs§
- Channels
Allowed - Image
Context - Image
MaxBounds - MaxBatch
Size - MaxSeq
Len - Text
Context - Context fields a text request typically carries.
- Token
IdsIn Vocab - Validation
Error
Traits§
- Validator
- A single check on a context value.
Functions§
- run_
chain - Run a chain of validators; return the first error or
Ok(()).