From 6488de36c4310c311e7f07e071dc0e2b005c64a0 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Tue, 30 Jan 2024 08:12:43 -0800 Subject: [PATCH] (test) bedrock input validation - exceptions --- litellm/tests/test_embedding.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/litellm/tests/test_embedding.py b/litellm/tests/test_embedding.py index a005a6ad1..681471e3d 100644 --- a/litellm/tests/test_embedding.py +++ b/litellm/tests/test_embedding.py @@ -302,6 +302,25 @@ def test_bedrock_embedding_cohere(): # test_bedrock_embedding_cohere() +def test_demo_tokens_as_input_to_embeddings_fails_for_titan(): + litellm.set_verbose = True + + with pytest.raises( + litellm.BadRequestError, + match="BedrockException - Bedrock Embedding API input must be type str | List[str]", + ): + litellm.embedding(model="amazon.titan-embed-text-v1", input=[[1]]) + + with pytest.raises( + litellm.BadRequestError, + match="BedrockException - Bedrock Embedding API input must be type str | List[str]", + ): + litellm.embedding( + model="amazon.titan-embed-text-v1", + input=[1], + ) + + # comment out hf tests - since hf endpoints are unstable def test_hf_embedding(): try: