From dfb34dfe921bd4e259b85d6099bee4bf39c6ff6b Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 23 Nov 2024 01:23:03 +0530 Subject: [PATCH] fix(main.py): pass extra_headers param to openai Fixes https://github.com/BerriAI/litellm/issues/6836 --- litellm/main.py | 4 ++++ tests/local_testing/test_embedding.py | 1 + 2 files changed, 5 insertions(+) diff --git a/litellm/main.py b/litellm/main.py index 5d433eb36..5095ce518 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -3440,6 +3440,10 @@ def embedding( # noqa: PLR0915 or litellm.openai_key or get_secret_str("OPENAI_API_KEY") ) + + if extra_headers is not None: + optional_params["extra_headers"] = extra_headers + api_type = "openai" api_version = None diff --git a/tests/local_testing/test_embedding.py b/tests/local_testing/test_embedding.py index 23d712b00..096dfc419 100644 --- a/tests/local_testing/test_embedding.py +++ b/tests/local_testing/test_embedding.py @@ -1085,6 +1085,7 @@ def test_cohere_img_embeddings(input, input_type): @pytest.mark.parametrize("sync_mode", [True, False]) @pytest.mark.asyncio async def test_embedding_with_extra_headers(sync_mode): + input = ["hello world"] from litellm.llms.custom_httpx.http_handler import HTTPHandler, AsyncHTTPHandler