Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Predibase Lorax Schema Constrained Request

From Leeroopedia
Revision as of 17:32, 16 February 2026 by Admin (talk | contribs) (Auto-imported from principles/Predibase_Lorax_Schema_Constrained_Request.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


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:

  1. Client includes ResponseFormat with JSON schema in the request
  2. Server-side validation (Validation::validate()) extracts the schema string
  3. Schema is serialized and passed as NextTokenChooserParameters.schema
  4. 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

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment