From f211009263bb42b2471259e6f841faea485dc614 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Fri, 5 Jan 2024 15:22:17 +0530 Subject: [PATCH] (test) openai embedding cost calculation --- litellm/tests/test_embedding.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/litellm/tests/test_embedding.py b/litellm/tests/test_embedding.py index ae59424f6..954a53e2a 100644 --- a/litellm/tests/test_embedding.py +++ b/litellm/tests/test_embedding.py @@ -79,7 +79,7 @@ def test_openai_azure_embedding_simple(): pytest.fail(f"Error occurred: {e}") -test_openai_azure_embedding_simple() +# test_openai_azure_embedding_simple() def test_openai_azure_embedding_timeouts(): @@ -265,15 +265,22 @@ def test_aembedding(): input=["good morning from litellm", "this is another item"], ) print(response) + return response except Exception as e: pytest.fail(f"Error occurred: {e}") - asyncio.run(embedding_call()) + response = asyncio.run(embedding_call()) + print("Before caclulating cost, response", response) + + cost = litellm.completion_cost(completion_response=response) + + print("COST=", cost) + assert cost == float("1e-06") except Exception as e: pytest.fail(f"Error occurred: {e}") -# test_aembedding() +test_aembedding() def test_aembedding_azure():