Problem/Motivation
Claude Haiku 4.5 models do not appear when filtering by ChatJsonOutput capability. The regex in getConfiguredModels() excludes Haiku:
'/claude-3\.[57]|claude-3-[57]|claude-4|claude-(opus|sonnet)-4/i'
This matches claude-opus-4 and claude-sonnet-4 but not claude-haiku-4.
Steps to reproduce
- Call
getConfiguredModels('chat', [AiModelCapability::ChatJsonOutput]) - Claude Haiku 4.5 models are not returned
Proposed resolution
Add haiku to the regex pattern:
'/claude-3\.[57]|claude-3-[57]|claude-4|claude-(opus|sonnet|haiku)-4/i'
Remaining tasks
- Update regex in
getConfiguredModels()
User interface changes
Haiku 4.5 models will appear in model selection when JSON output capability is required.
API changes
None.
Data model changes
None.
Issue fork ai_provider_anthropic-3566246
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
camoa commentedAdded haiku to the regex pattern on line 49 of AnthropicProvider.php:
-claude-(opus|sonnet)-4
+claude-(opus|sonnet|haiku)-4
Haiku 4.5 supports JSON output via prompt engineering and tool/function calling, which aligns with the current ChatJsonOutput capability definition. The Anthropic /v1/models API doesn't provide capability
metadata, so the regex-based approach is the only option for now.
MR ready for review.
Comment #4
shreyal999 commentedComment #5
shreyal999 commentedThe regex is working as expected. Good to go.
Comment #6
shreyal999 commented