fix(main.py): pass extra_headers param to openai

Fixes https://github.com/BerriAI/litellm/issues/6836
This commit is contained in:
Krrish Dholakia 2024-11-23 01:23:03 +05:30
parent 250d66b335
commit dfb34dfe92
2 changed files with 5 additions and 0 deletions

View file

@ -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

View file

@ -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