From f8d17206904ae86e6eec7fdbfa53cc03bcfc4ab5 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Thu, 11 Jan 2024 19:02:17 +0530 Subject: [PATCH] fix(utils.py): bug fixes --- litellm/tests/test_caching.py | 1 + litellm/tests/test_custom_callback_input.py | 2 +- litellm/utils.py | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/litellm/tests/test_caching.py b/litellm/tests/test_caching.py index ec99e9c95..11d4fda15 100644 --- a/litellm/tests/test_caching.py +++ b/litellm/tests/test_caching.py @@ -290,6 +290,7 @@ async def test_embedding_caching_azure_individual_items(): embedding_val_2 = await aembedding( model="azure/azure-embedding-model", input=embedding_2, caching=True ) + print(f"embedding_val_2: {embedding_val_2}") if ( embedding_val_2["data"][0]["embedding"] != embedding_val_1["data"][0]["embedding"] diff --git a/litellm/tests/test_custom_callback_input.py b/litellm/tests/test_custom_callback_input.py index 537e38a28..8b41dfabb 100644 --- a/litellm/tests/test_custom_callback_input.py +++ b/litellm/tests/test_custom_callback_input.py @@ -673,7 +673,7 @@ async def test_async_embedding_bedrock(): response = await litellm.aembedding( model="bedrock/cohere.embed-multilingual-v3", input=["good morning from litellm"], - aws_region_name="os.environ/AWS_REGION_NAME_2", + aws_region_name="us-east-1", ) await asyncio.sleep(1) print(f"customHandler_success.errors: {customHandler_success.errors}") diff --git a/litellm/utils.py b/litellm/utils.py index e4c67c0e8..45889835e 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -2341,7 +2341,7 @@ def client(original_function): for val in non_null_list: idx, cr = val # (idx, cr) tuple if cr is not None: - final_embedding_cached_response.data[idx] = val + final_embedding_cached_response.data[idx] = cr if len(remaining_list) == 0: # LOG SUCCESS @@ -2485,9 +2485,9 @@ def client(original_function): for item in final_embedding_cached_response.data: if item is None: final_data_list.append(result.data[idx]) + idx += 1 else: final_data_list.append(item) - idx += 1 final_embedding_cached_response.data = final_data_list return final_embedding_cached_response