Skip to content

Constrain Claude Code completions to the caller's JSON Schema once $.model.complete takes one #5955

Open

Description

@max-sixty

Trigger: Claude Code's $.model.complete accepts a JSON Schema or output format for the reply. As of 2.1.322 its request takes only model, prompt, system, maxTokens, effort and timeoutMs.

Until then, Leaf asks for JSON in the system prompt and validates the answer in Python (inference.answering and inference.answered, used by inference.claude_code_generator since #5835). That held for every one of 452 title requests. The widget builder's Leaf-catalog request has a nested $defs schema, and 3 of 60 answers came back malformed: one dropped a key, one left a bracket unclosed, and one repeated the whole object. Each failure rejects generate rather than reaching the widget.

Once the field exists, pass the caller's schema in the request and drop answering from Claude Code's path. Keep answered only as long as the reply still arrives as text.

This was written by Claude Code on behalf of max-sixty

Activity

  1. added
    backlog
    etc
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogetc

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions