litellm/tests/litellm
shin-bot-litellm 84934a7258
fix(anthropic): filter unsupported JSON schema constraints for structured outputs (#20813)
* fix(anthropic): filter unsupported JSON schema constraints for structured outputs

Fixes 400 error when using Anthropic models with structured outputs that have
min/max constraints.

The Anthropic API doesn't support these JSON schema constraints:
- minimum/maximum (numeric)
- exclusiveMinimum/exclusiveMaximum (numeric)
- minLength/maxLength (string)
- minItems/maxItems (array)

This mirrors the transformation done by the official Anthropic Python SDK.
See: https://platform.claude.com/docs/en/build-with-claude/structured-outputs#how-sdk-transformation-works

Adds tests for the schema filtering function.

* fix: update descriptions with removed constraint info in filter_anthropic_output_schema

Address review feedback: the function now appends removed constraint
information to the description field (matching Anthropic SDK behavior),
rather than silently dropping constraints.

---------

Co-authored-by: OpenClaw <openclaw@users.noreply.github.com>
2026-02-14 09:07:40 -08:00
..
a2a_protocol/providers/pydantic_ai_agents [Feat] New provider - Agent Gateway, add pydantic ai agents (#18013) 2025-12-15 17:40:58 -08:00
llms fix(anthropic): filter unsupported JSON schema constraints for structured outputs (#20813) 2026-02-14 09:07:40 -08:00
proxy fix(proxy): skip premium check for empty metadata fields on team/key update 2026-02-06 14:50:24 -05:00
test_batch_completion_models_all_responses.py fix(batch_completion): submit all model futures before waiting (#20705) 2026-02-11 15:44:37 +05:30
test_bedrock_extended_beta_models.py feat(bedrock): add support for 4 new beta models (#20974) 2026-02-13 18:32:12 +05:30
test_proxy_auth.py feat(sdk): add proxy_auth for auto OAuth2/JWT token management (#20238) 2026-02-02 22:04:08 -08:00
test_router_retry_backoff_headers.py fix(router): use current retry exception for retry backoff (#20725) 2026-02-10 22:44:25 -08:00
test_stream_chunk_builder_images.py Fix stream_chunk_builder to preserve images from streaming chunks (#19654) 2026-01-28 21:31:06 -08:00