Skip to content

Conversation

@evalstate
Copy link
Owner

Implement Anthropic's new native structured outputs feature (via output_format parameter) for supported models (Claude Sonnet 4.5, Opus 4.1+, Haiku 4.5).

Changes:

  • Add native_structured_output field to ModelParameters in model_database.py
  • Create new model parameter configs for Anthropic models with structured output support
  • Add supports_native_structured_output() method to ModelDatabase
  • Add default_headers support to AnthropicSettings in config.py
  • Modify AnthropicLLM to use native structured outputs when supported:
    • Uses beta API with structured-outputs-2025-11-13 header
    • Falls back to tool-based method for unsupported models
    • Automatically adds additionalProperties: false to JSON schemas
  • Add comprehensive unit tests for the new functionality

Implement Anthropic's new native structured outputs feature (via output_format
parameter) for supported models (Claude Sonnet 4.5, Opus 4.1+, Haiku 4.5).

Changes:
- Add native_structured_output field to ModelParameters in model_database.py
- Create new model parameter configs for Anthropic models with structured output support
- Add supports_native_structured_output() method to ModelDatabase
- Add default_headers support to AnthropicSettings in config.py
- Modify AnthropicLLM to use native structured outputs when supported:
  - Uses beta API with structured-outputs-2025-11-13 header
  - Falls back to tool-based method for unsupported models
  - Automatically adds additionalProperties: false to JSON schemas
- Add comprehensive unit tests for the new functionality
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.

3 participants