Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion litellm/llms/bedrock/embed/cohere_transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ def __init__(self) -> None:
pass

def get_supported_openai_params(self) -> List[str]:
return ["encoding_format"]
return ["encoding_format", "dimensions"]

def map_openai_params(
self, non_default_params: dict, optional_params: dict
) -> dict:
for k, v in non_default_params.items():
if k == "encoding_format":
optional_params["embedding_types"] = v
elif k == "dimensions":
optional_params["output_dimension"] = v
return optional_params

def _is_v3_model(self, model: str) -> bool:
Expand Down
1 change: 1 addition & 0 deletions litellm/types/llms/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ class CohereEmbeddingRequest(TypedDict, total=False):
input_type: Required[COHERE_EMBEDDING_INPUT_TYPES]
truncate: Literal["NONE", "START", "END"]
embedding_types: Literal["float", "int8", "uint8", "binary", "ubinary"]
output_dimension: int


class CohereEmbeddingRequestWithModel(CohereEmbeddingRequest):
Expand Down
2 changes: 1 addition & 1 deletion litellm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3242,7 +3242,7 @@ def _check_valid_arg(supported_params: Optional[list]):
object = litellm.AmazonTitanMultimodalEmbeddingG1Config()
elif "amazon.titan-embed-text-v2:0" in model:
object = litellm.AmazonTitanV2Config()
elif "cohere.embed-multilingual-v3" in model:
elif "cohere.embed-multilingual-v3" in model or "cohere.embed-v4" in model:
object = litellm.BedrockCohereEmbeddingConfig()
elif "twelvelabs" in model or "marengo" in model:
object = litellm.TwelveLabsMarengoEmbeddingConfig()
Expand Down
Loading