mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
resolved merge conflict
This commit is contained in:
parent
3830a48c4c
commit
c6d1998de1
1 changed files with 27 additions and 21 deletions
|
|
@ -966,27 +966,6 @@ def test_bedrock_embedding_with_aws_external_id():
|
|||
test_api_key = "test-bearer-token-12345"
|
||||
model = "bedrock/amazon.titan-embed-text-v1"
|
||||
embed_response = {"embedding": [0.1, 0.2, 0.3], "inputTextTokenCount": 10}
|
||||
@pytest.mark.parametrize(
|
||||
"encoding_format,expected_embedding_types",
|
||||
[
|
||||
("float", ["float"]),
|
||||
("base64", ["base64"]),
|
||||
(["float", "int8"], ["float", "int8"]),
|
||||
],
|
||||
)
|
||||
def test_bedrock_cohere_embedding_types_wrapped_as_list(
|
||||
encoding_format, expected_embedding_types
|
||||
):
|
||||
"""
|
||||
Bedrock Cohere expects `embedding_types` as a JSON array, not a raw string.
|
||||
|
||||
Regression test for: Bedrock returns
|
||||
Malformed input request: #/embedding_types: expected type: JSONArray, found: String
|
||||
when `encoding_format` is passed as a string.
|
||||
"""
|
||||
litellm.set_verbose = True
|
||||
client = HTTPHandler()
|
||||
model = "bedrock/cohere.embed-multilingual-v3"
|
||||
|
||||
with patch.object(client, "post") as mock_post:
|
||||
mock_response = Mock()
|
||||
|
|
@ -1019,6 +998,33 @@ def test_bedrock_cohere_embedding_types_wrapped_as_list(
|
|||
kwargs.get("aws_role_name")
|
||||
== "arn:aws:iam::123456789012:role/test-role"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"encoding_format,expected_embedding_types",
|
||||
[
|
||||
("float", ["float"]),
|
||||
("base64", ["base64"]),
|
||||
(["float", "int8"], ["float", "int8"]),
|
||||
],
|
||||
)
|
||||
def test_bedrock_cohere_embedding_types_wrapped_as_list(
|
||||
encoding_format, expected_embedding_types
|
||||
):
|
||||
"""
|
||||
Bedrock Cohere expects `embedding_types` as a JSON array, not a raw string.
|
||||
|
||||
Regression test for: Bedrock returns
|
||||
Malformed input request: #/embedding_types: expected type: JSONArray, found: String
|
||||
when `encoding_format` is passed as a string.
|
||||
"""
|
||||
litellm.set_verbose = True
|
||||
client = HTTPHandler()
|
||||
model = "bedrock/cohere.embed-multilingual-v3"
|
||||
|
||||
with patch.object(client, "post") as mock_post:
|
||||
mock_response = Mock()
|
||||
mock_response.status_code = 200
|
||||
mock_response.text = json.dumps(cohere_embedding_response)
|
||||
mock_response.json = lambda: json.loads(mock_response.text)
|
||||
mock_post.return_value = mock_response
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue