Add support for forwarding client headers

This commit is contained in:
Sameer Kankute 2025-12-12 17:35:22 +05:30
parent cf5dab7f52
commit cf286e6885
2 changed files with 4 additions and 3 deletions

View file

@ -34,7 +34,7 @@ class BedrockRerankHandler(BaseAWSLLM):
if client is None:
client = get_async_httpx_client(llm_provider=litellm.LlmProviders.BEDROCK)
try:
response = await client.post(url=prepared_request["endpoint_url"], headers=prepared_request["prepped"].headers, data=prepared_request["body"]) # type: ignore
response = await client.post(url=prepared_request["endpoint_url"], headers=dict(prepared_request["prepped"].headers), data=prepared_request["body"])
response.raise_for_status()
except httpx.HTTPStatusError as err:
error_code = err.response.status_code
@ -84,7 +84,7 @@ class BedrockRerankHandler(BaseAWSLLM):
additional_args={
"complete_input_dict": data,
"api_base": prepared_request["endpoint_url"],
"headers": prepared_request["prepped"].headers,
"headers": dict(prepared_request["prepped"].headers),
},
)
@ -94,7 +94,7 @@ class BedrockRerankHandler(BaseAWSLLM):
if client is None or not isinstance(client, HTTPHandler):
client = _get_httpx_client()
try:
response = client.post(url=prepared_request["endpoint_url"], headers=prepared_request["prepped"].headers, data=prepared_request["body"]) # type: ignore
response = client.post(url=prepared_request["endpoint_url"], headers=dict(prepared_request["prepped"].headers), data=prepared_request["body"])
response.raise_for_status()
except httpx.HTTPStatusError as err:
error_code = err.response.status_code

View file

@ -358,6 +358,7 @@ def rerank( # noqa: PLR0915
_is_async=_is_async,
optional_params=optional_params.model_dump(exclude_unset=True),
api_base=api_base,
extra_headers=headers or litellm.headers or {},
logging_obj=litellm_logging_obj,
client=client,
)