mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
Bing Search Pass Thru
This commit is contained in:
parent
f66029470f
commit
75b713974f
4 changed files with 110 additions and 1 deletions
|
@ -75,6 +75,11 @@ google_ai_studio_api_key_header = APIKeyHeader(
|
|||
auto_error=False,
|
||||
description="If google ai studio client used.",
|
||||
)
|
||||
bing_search_header = APIKeyHeader(
|
||||
name=SpecialHeaders.bing_search_authorization.value,
|
||||
auto_error=False,
|
||||
description="Custom header for Bing Search requests",
|
||||
)
|
||||
|
||||
|
||||
def _get_bearer_token(
|
||||
|
@ -284,6 +289,7 @@ async def _user_api_key_auth_builder( # noqa: PLR0915
|
|||
azure_api_key_header: str,
|
||||
anthropic_api_key_header: Optional[str],
|
||||
google_ai_studio_api_key_header: Optional[str],
|
||||
bing_search_header: Optional[str],
|
||||
request_data: dict,
|
||||
) -> UserAPIKeyAuth:
|
||||
|
||||
|
@ -327,6 +333,8 @@ async def _user_api_key_auth_builder( # noqa: PLR0915
|
|||
api_key = anthropic_api_key_header
|
||||
elif isinstance(google_ai_studio_api_key_header, str):
|
||||
api_key = google_ai_studio_api_key_header
|
||||
elif isinstance(bing_search_header, str):
|
||||
api_key = bing_search_header
|
||||
elif pass_through_endpoints is not None:
|
||||
for endpoint in pass_through_endpoints:
|
||||
if endpoint.get("path", "") == route:
|
||||
|
@ -1152,6 +1160,7 @@ async def user_api_key_auth(
|
|||
google_ai_studio_api_key_header: Optional[str] = fastapi.Security(
|
||||
google_ai_studio_api_key_header
|
||||
),
|
||||
bing_search_header: Optional[str] = fastapi.Security(bing_search_header),
|
||||
) -> UserAPIKeyAuth:
|
||||
"""
|
||||
Parent function to authenticate user api key / jwt token.
|
||||
|
@ -1165,6 +1174,7 @@ async def user_api_key_auth(
|
|||
azure_api_key_header=azure_api_key_header,
|
||||
anthropic_api_key_header=anthropic_api_key_header,
|
||||
google_ai_studio_api_key_header=google_ai_studio_api_key_header,
|
||||
bing_search_header=bing_search_header,
|
||||
request_data=request_data,
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue