"""AWS Bedrock provider โ€” Claude via the Converse API and cross-Region inference profiles. Authentication uses the standard boto3 credential chain (environment variables, shared config/SSO, or an attached IAM role) โ€” there is no single API-key env var like the other providers. The region is read from ``BEDROCK_REGION`` (matching the terraform-infra convention), falling back to ``AWS_REGION`` / ``AWS_DEFAULT_REGION``, then ``us-east-1``. The default model IDs are cross-Region inference profiles (the ``us.`` prefix), which route across US regions for availability. The exact version-dated profile ID must match what is enabled in your account and the Bedrock IAM policy (see this provider's notes in TASK.md ยง11) โ€” override per run with ``--model`` / ``EVAL_MODEL`` / ``[skill_eval.models]``. """ from environs import Env from langchain_aws import ChatBedrockConverse from langchain_core.language_models import BaseChatModel from skill_eval_runner.providers import Provider, register DEFAULT_REGION = "us-east-1" _env = Env() _env.read_env() def make_model(model_name: str) -> BaseChatModel: """Build a ``ChatBedrockConverse`` model using the boto3 credential chain.""" region = ( _env.str("BEDROCK_REGION", None) or _env.str("AWS_REGION", None) or _env.str("AWS_DEFAULT_REGION", None) or DEFAULT_REGION ) model: BaseChatModel = ChatBedrockConverse( model=model_name, region_name=region, max_tokens=8192, ) return model register( Provider( name="bedrock", default_model="us.anthropic.claude-sonnet-4-6", small_model="us.anthropic.claude-haiku-4-5", large_model="us.anthropic.claude-sonnet-4-6", make_model=make_model, ) )