Skip to content

Conversation

@Anas20001
Copy link

@Anas20001 Anas20001 commented Nov 19, 2025

Overview

Implements Anthropic's structured outputs beta feature (structured-outputs-2025-11-13) for Claude models, addressing issue #3428.

…sformer and strict tool calls

Implements Anthropic's structured outputs beta feature for Claude models.

- Implement AnthropicJsonSchemaTransformer following Anthropic docs
- Add strict mode support with correct truthy check (not 'is not None')
- Set additionalProperties: false for objects (required by Anthropic)
- Mark all properties as required in strict mode
- Integrate with Anthropic's transform_schema helper (optional)
- Add comprehensive tests covering all edge cases

Addresses pydantic#3428
@Anas20001 Anas20001 force-pushed the anthropic-native-json-strict-tools branch from 860ed1c to cb75151 Compare November 19, 2025 05:25
- Change strict check from truthy to explicit True comparison
- Update test expectations for Anthropic strict mode behavior
- Add mock provider to test_anthropic_strict_mode_tool_mapping
- Update inline snapshots for auto-strict mode on compatible schemas

Fixes all 16 failing test jobs across Python 3.10-3.13
@DouweM
Copy link
Collaborator

DouweM commented Nov 19, 2025

@Anas20001 Hey Anas, thanks for filing this but I've already been reviewing #3457 so I'll focus on that one.

@DouweM DouweM closed this Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants