fix - support dimension for titan embed v2

This commit is contained in:
Ishaan Jaff 2024-05-03 16:13:27 -07:00
parent bf048ecda4
commit 4a39b95acc

View file

@ -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"