Skip to content

Add support for Global inference profile in AmazonBedrockGenerator #2663

@sjrl

Description

@sjrl

When trying to use a global inference profile in the Generator (not ChatGenerator) Bedrock component we get an error

Error: Could not auto-detect model family of global.anthropic.claude-sonnet-4-5-20250929-v1:0. model_familyparameter must be one of ('amazon.titan-text', 'ai21.j2', 'cohere.command', 'cohere.command-r', 'anthropic.claude', 'meta.llama', 'mistral'). We highly recommend using theAmazonBedrockChatGenerator instead. It has additional support for Amazon's Nova Canvas, Nova Lite, Nova Pro, DeepSeek's DeepSeek-R1, and more models.

This is due to the regex matching we do here

SUPPORTED_MODEL_PATTERNS: ClassVar[dict[str, type[BedrockModelAdapter]]] = {
r"([a-z]{2}\.)?amazon.titan-text.*": AmazonTitanAdapter,
r"([a-z]{2}\.)?ai21.j2.*": AI21LabsJurassic2Adapter,
r"([a-z]{2}\.)?cohere.command-[^r].*": CohereCommandAdapter,
r"([a-z]{2}\.)?cohere.command-r.*": CohereCommandRAdapter,
r"([a-z]{2}\.)?anthropic.claude.*": AnthropicClaudeAdapter,
r"([a-z]{2}\.)?meta.llama.*": MetaLlamaAdapter,
r"([a-z]{2}\.)?mistral.*": MistralAdapter,
}

Seems the issue is we only allow for 2 characters to appear before the anthropic.claude name which was fine until they added the global inference profile vs just eu or us

We should update the regex patterns to also allow it to match global

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions