From 2655fb19772478ca3cb0cc12d95374e2c230b313 Mon Sep 17 00:00:00 2001 From: terylt <30874627+terylt@users.noreply.github.com> Date: Sat, 10 May 2025 15:40:07 -0600 Subject: [PATCH] fix: headers parameter to default to None rather than empty dict (#10728) Signed-off-by: Teryl Taylor Co-authored-by: Teryl Taylor --- litellm/llms/custom_httpx/llm_http_handler.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.py index 000d511d03..cd894a459a 100644 --- a/litellm/llms/custom_httpx/llm_http_handler.py +++ b/litellm/llms/custom_httpx/llm_http_handler.py @@ -245,7 +245,7 @@ class BaseLLMHTTPHandler: stream: Optional[bool] = False, fake_stream: bool = False, api_key: Optional[str] = None, - headers: Optional[dict] = {}, + headers: Optional[Dict[str, Any]] = None, client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None, provider_config: Optional[BaseConfig] = None, ): @@ -680,7 +680,7 @@ class BaseLLMHTTPHandler: api_key: Optional[str] = None, client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None, aembedding: bool = False, - headers={}, + headers: Optional[Dict[str, Any]] = None, ) -> EmbeddingResponse: provider_config = ProviderConfigManager.get_provider_embedding_config( model=model, provider=litellm.LlmProviders(custom_llm_provider) @@ -688,7 +688,7 @@ class BaseLLMHTTPHandler: # get config from model, custom llm provider headers = provider_config.validate_environment( api_key=api_key, - headers=headers, + headers=headers or {}, model=model, messages=[], optional_params=optional_params, @@ -821,7 +821,7 @@ class BaseLLMHTTPHandler: timeout: Optional[Union[float, httpx.Timeout]], model_response: RerankResponse, _is_async: bool = False, - headers: dict = {}, + headers: Optional[Dict[str, Any]] = None, api_key: Optional[str] = None, api_base: Optional[str] = None, client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None, @@ -829,7 +829,7 @@ class BaseLLMHTTPHandler: # get config from model, custom llm provider headers = provider_config.validate_environment( api_key=api_key, - headers=headers, + headers=headers or {}, model=model, ) @@ -951,7 +951,7 @@ class BaseLLMHTTPHandler: custom_llm_provider: str, client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None, atranscription: bool = False, - headers: dict = {}, + headers: Optional[Dict[str, Any]] = None, provider_config: Optional[BaseAudioTranscriptionConfig] = None, ) -> TranscriptionResponse: if provider_config is None: @@ -960,7 +960,7 @@ class BaseLLMHTTPHandler: ) headers = provider_config.validate_environment( api_key=api_key, - headers=headers, + headers=headers or {}, model=model, messages=[], optional_params=optional_params,