def get_model_name(model_name: str) -> str:
    """Extract base model name from region-prefixed model identifier."""
    # Check for region prefixes (us, eu, apac)
    REGION_PREFIXES = ["us.", "eu.", "apac."]

    # If no region prefix, return the original model name
    if not any(prefix in model_name for prefix in REGION_PREFIXES):
        return model_name

    # Remove region prefix to get the base model name
    base_model_name = model_name[model_name.find(".") + 1 :]

    if base_model_name not in BEDROCK_INFERENCE_PROFILE_SUPPORTED_MODELS:
        raise ValueError(
            f"Model does not support inference profiles but has an inference profile prefix: {model_name}. "
            "Please provide a valid Bedrock model name. "
            "Known models are: " + ", ".join(BEDROCK_INFERENCE_PROFILE_SUPPORTED_MODELS)
        )

    return base_model_name
Extract base model name from region-prefixed model identifier.
llama-index-integrations/llms/llama-index-llms-bedrock-converse/llama_index/llms/bedrock_converse/utils.py