fix(converse_transformation.py): fix encoding model

This commit is contained in:
Krrish Dholakia 2025-03-15 14:03:37 -07:00
parent 95328d5447
commit 5dc46f0cf7
4 changed files with 441 additions and 324 deletions

View file

@ -279,16 +279,30 @@ class BaseAWSLLM:
return None
def _get_aws_region_name(
self, optional_params: dict, model: Optional[str] = None
self,
optional_params: dict,
model: Optional[str] = None,
model_id: Optional[str] = None,
) -> str:
"""
Get the AWS region name from the environment variables
Get the AWS region name from the environment variables.
Parameters:
optional_params (dict): Optional parameters for the model call
model (str): The model name
model_id (str): The model ID. This is the ARN of the model, if passed in as a separate param.
Returns:
str: The AWS region name
"""
aws_region_name = optional_params.get("aws_region_name", None)
### SET REGION NAME ###
if aws_region_name is None:
# check model arn #
aws_region_name = self._get_aws_region_from_model_arn(model)
if model_id is not None:
aws_region_name = self._get_aws_region_from_model_arn(model_id)
else:
aws_region_name = self._get_aws_region_from_model_arn(model)
# check env #
litellm_aws_region_name = get_secret("AWS_REGION_NAME", None)