Skip to content

Handle strict tool-schema incompatibility on Bedrock/Claude paths #67

Closed as not planned

Description

@WZHKAWF

Summary

claude-sonnet-5 behind the rbi_genai gateway can accept normal openai-responses requests, but tool-calling fails because tools[].custom.strict is being sent down a Bedrock/Claude path that rejects it.

Observed upstream error:

Provider unavailable

WHAT HAPPENED: the provider rejected the request. litellm.BadRequestError: BedrockException - {"message":"The model returned the following errors: tools.0.custom.strict: Extra inputs are not permitted"}. Received Model Group=claude-sonnet-5
Available Model Group Fallbacks=None

NEXT STEP: retry; if it persists, switch provider/model.

Why this looks like a real compatibility leak

This does not look like "Claude must globally use Anthropic compatibility".

The same provider/model path was already able to serve non-tool requests via the configured OpenAI-compatible surface. The failure only appears once tool schema is involved.

So the likely bug is narrower:

  • a tool-schema field from the OpenAI-style surface (custom.strict) is leaking into a Bedrock/Claude path that does not accept it, or
  • the provider adapter lacks capability metadata for this model/path and should not emit strict there.

Expected behavior

vis should not send tool-schema fields that the selected provider/model path cannot accept.

Possible fixes

One of:

  1. Strip tools[].custom.strict for provider/model paths that do not support it.
  2. Add capability metadata such as supports_strict_tool_schema = false.
  3. Normalize tool payloads per compatibility surface before they hit the provider.
  4. If tool-calling on this path really requires a different transport, encode that as a feature/path-specific capability decision, not a blanket provider-level switch.

Why this may belong in blockether/svar

If vis is delegating provider request shaping / compatibility translation to svar, the actual fix may belong there rather than in the top-level UI/app layer. I am filing here first because this is where the user-facing failure surfaced, but the payload-normalization bug might be lower in the stack.

Repro shape

  • provider: rbi_genai
  • configured compatibility: openai-responses
  • model: claude-sonnet-5
  • non-tool request: succeeds
  • tool request: fails with tools.0.custom.strict: Extra inputs are not permitted

Expected outcome

Tool-calling should either:

  • work on this provider/model path with the unsupported field removed, or
  • fail with a specific, actionable capability error instead of leaking an upstream schema mismatch.

Activity

  1. kwojcik-blockether commented on Jul 29, 2026

    @kwojcik-blockether
    Contributor

    Root cause is upstream, not in Vis.

    Vis/svar never emit strict (nor a tool-level additionalProperties) in a tool definition — tool-def->wire (svar/internal/llm.clj) emits exactly {name, description, parameters|input_schema} for every api-style, and there is no type: "custom" anywhere. The field is injected by LiteLLM: PR BerriAI/litellm#29814 started forwarding strict/additionalProperties into the Bedrock Converse toolSpec, gated only on get_bedrock_base_model(model).startswith("anthropic"). Bedrock then routes some Claude variants through an Anthropic-compatible validator that maps toolSpec to the native custom tool shape and rejects the extra key — tools.0.custom.strict: Extra inputs are not permitted.

    Upstream fixes/state: litellm#31582 → #31585/#31923 (Opus 4.7/4.8), #31943 (Sonnet 4), driven by a bedrock_converse_supports_strict_tools: false flag in model_prices_and_context_window.json; #33193 tracks Sonnet 5. So the actual remedy is: upgrade the gateway, or set that flag for the model in the gateway model map.

    What Vis ships now (7abfd12, svar b84dc40040): the failure is no longer a generic "provider rejected the request / retry". provider_error.clj detects a gateway-injected tool field, classifies it as the terminal :tool-schema kind (non-retryable), titles it Gateway sent an unsupported tool field: strict, states that Vis never sends that field, and the NEXT STEP points at the gateway (bedrock_converse_supports_strict_tools: false / newer LiteLLM) or a model switch instead of falsely blaming an extension schema. svar enrich-tool-schema-rejection now also resolves tools.N.custom.strict to the canonical tool name/field. Covered by provider_error_test/gateway-injected-tool-field-test and llm_tool_calling_test.

    Closing: nothing left to change in Vis — no payload we control carries the rejected field.

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