Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Anthropic provider: structured-output schema rejected (minimum/maximum on integer/number) #76

Description

@repowazdogz-droid

Summary
In v2.1.4, the Anthropic provider fails on every LLM-mode scan: the structured-output
schema it sends includes minimum/maximum, which the Anthropic structured-output API
rejects.

Environment
SkillSpector 2.1.4 (from source, main) · Python 3.13 · SKILLSPECTOR_PROVIDER=anthropic ·
LLM mode (i.e. not --no-llm).

What happens
The semantic analyzers fail with two successive HTTP 400s from the Anthropic API — it
rejects minimum/maximum, once on an integer field and once on a number field.

Root cause
The output models declare start_line: int = Field(ge=1) and
confidence: float = Field(ge=0, le=1). Pydantic serializes these to JSON-Schema
minimum/maximum, and Anthropic's structured-output endpoint does not accept those
keywords on integer/number types.

Repro
Run skillspector scan <path> in LLM mode with SKILLSPECTOR_PROVIDER=anthropic and a
valid ANTHROPIC_API_KEY (no --no-llm). → two 400s, analyzers fail. Static --no-llm
mode is unaffected.

Suggested fix
Keep the Pydantic constraints (they're valid validation) and sanitize the schema sent to
Anthropic — strip minimum/maximum from the structured-output schema in the Anthropic
provider. (Confirmed locally that removing the constraints unblocks all three semantic
analyzers; schema-sanitization is the correct upstream form that preserves validation.)

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions