diff --git a/litellm/utils.py b/litellm/utils.py index 80d26f58b..e124358b6 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -4743,6 +4743,21 @@ def get_optional_params_embeddings( status_code=500, message=f"Setting user/encoding format is not supported by {custom_llm_provider}. To drop it from the call, set `litellm.drop_params = True`.", ) + if custom_llm_provider == "bedrock": + if "amazon.titan-embed-text-v2" in model: + # embed-text-v2 supports the dimension param + non_default_params.pop("dimensions", None) + if len(non_default_params.keys()) > 0: + if litellm.drop_params is True: # drop the unsupported non-default values + keys = list(non_default_params.keys()) + for k in keys: + non_default_params.pop(k, None) + final_params = {**non_default_params, **kwargs} + return final_params + raise UnsupportedParamsError( + status_code=500, + message=f"Setting user/encoding format is not supported by {custom_llm_provider}. To drop it from the call, set `litellm.drop_params = True`.", + ) if ( custom_llm_provider != "openai"