From 5e4585e7f40c4a68c8d079844965ddd891e2bb4c Mon Sep 17 00:00:00 2001 From: Marcus Koolaard Date: Wed, 11 Jun 2025 15:16:52 +1200 Subject: [PATCH] Fix serverless endpoint configuration field name conversion Fixes field name conversion bug where acronyms in snake_case were not properly capitalized when converted to PascalCase for AWS API calls: - memory_size_in_mb now converts to MemorySizeInMB (not MemorySizeInMb) - supported_response_mime_types now converts to SupportedResponseMIMETypes (not SupportedResponseMimeTypes) This resolves parameter validation failures when creating serverless endpoint configurations and inference specifications. Also removed duplicate snake_to_pascal function definition. --- src/sagemaker_core/main/utils.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/sagemaker_core/main/utils.py b/src/sagemaker_core/main/utils.py index 126aa556..8d82d74c 100644 --- a/src/sagemaker_core/main/utils.py +++ b/src/sagemaker_core/main/utils.py @@ -64,16 +64,6 @@ def convert_to_snake_case(entity_name): return re.sub("([a-z0-9])([A-Z])", r"\1_\2", snake_case).lower() -def snake_to_pascal(snake_str): - """ - Convert a snake_case string to PascalCase. - Args: - snake_str (str): The snake_case string to be converted. - Returns: - str: The PascalCase string. - """ - components = snake_str.split("_") - return "".join(x.title() for x in components[0:]) def reformat_file_with_black(filename): @@ -198,6 +188,8 @@ def get_textual_rich_logger(name: str, log_level: str = "INFO") -> logging.Logge SPECIAL_SNAKE_TO_PASCAL_MAPPINGS = { "volume_size_in_g_b": "VolumeSizeInGB", "volume_size_in_gb": "VolumeSizeInGB", + "memory_size_in_mb": "MemorySizeInMB", + "supported_response_mime_types": "SupportedResponseMIMETypes", }