Principle:Predibase Lorax Schema Constrained Request
| Knowledge Sources | |
|---|---|
| Domains | Structured_Output, Validation |
| Last Updated | 2026-02-08 02:00 GMT |
Overview
A request validation pipeline that extracts JSON schema constraints from the request format specification and threads them through to the token generation layer.
Description
Schema Constrained Request bridges the gap between the user-facing response format specification and the internal token-level constraint enforcement. The pipeline:
- Client includes ResponseFormat with JSON schema in the request
- Server-side validation (Validation::validate()) extracts the schema string
- Schema is serialized and passed as NextTokenChooserParameters.schema
- The schema string reaches the logits processor which compiles the FSM
If no schema is provided but json_object type is specified, a default permissive JSON schema is used.
Usage
Applied automatically when response_format is included in a request. No additional configuration needed beyond providing the schema.
Theoretical Basis
Pseudo-code:
# Schema extraction pipeline
def validate(request):
if request.response_format:
if request.response_format.schema:
schema_str = json.dumps(request.response_format.schema)
else:
schema_str = default_json_schema()
params.schema = schema_str
return validated_request