mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
Litellm dev 01 22 2025 p4 (#7932)
* feat(main.py): add new 'provider_specific_header' param allows passing extra header for specific provider * fix(litellm_pre_call_utils.py): add unit test for pre call utils * test(test_bedrock_completion.py): skip test now that bedrock supports this
This commit is contained in:
parent
65ca5f74b0
commit
bf1639cb92
5 changed files with 119 additions and 5 deletions
|
@ -20,6 +20,7 @@ from litellm.proxy._types import (
|
|||
from litellm.types.llms.anthropic import ANTHROPIC_API_HEADERS
|
||||
from litellm.types.services import ServiceTypes
|
||||
from litellm.types.utils import (
|
||||
ProviderSpecificHeader,
|
||||
StandardLoggingUserAPIKeyMetadata,
|
||||
SupportedCacheControls,
|
||||
)
|
||||
|
@ -729,19 +730,20 @@ def add_provider_specific_headers_to_request(
|
|||
data: dict,
|
||||
headers: dict,
|
||||
):
|
||||
|
||||
extra_headers = data.get("extra_headers", {}) or {}
|
||||
|
||||
anthropic_headers = {}
|
||||
# boolean to indicate if a header was added
|
||||
added_header = False
|
||||
for header in ANTHROPIC_API_HEADERS:
|
||||
if header in headers:
|
||||
header_value = headers[header]
|
||||
extra_headers.update({header: header_value})
|
||||
anthropic_headers[header] = header_value
|
||||
added_header = True
|
||||
|
||||
if added_header is True:
|
||||
data["extra_headers"] = extra_headers
|
||||
data["provider_specific_header"] = ProviderSpecificHeader(
|
||||
custom_llm_provider="anthropic",
|
||||
extra_headers=anthropic_headers,
|
||||
)
|
||||
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue