fix(pass_through_endpoints.py): fix returned response headers for pass-through endpoitns

This commit is contained in:
Krrish Dholakia 2024-08-17 09:00:00 -07:00
parent 08411f37b4
commit b56ecd7e02
2 changed files with 11 additions and 7 deletions

View file

@ -1,6 +1,4 @@
model_list:
- model_name: "text-embedding-ada-002"
- model_name: "*"
litellm_params:
model: "azure/azure-embedding-model"
api_base: os.environ/AZURE_API_BASE
api_key: os.environ/AZURE_API_KEY
model: "*"

View file

@ -308,7 +308,6 @@ async def pass_through_request(
)
async_client = httpx.AsyncClient()
response = await async_client.request(
method=request.method,
url=url,
@ -362,10 +361,17 @@ async def pass_through_request(
cache_hit=False,
)
excluded_headers = {"transfer-encoding", "content-encoding"}
headers = {
key: value
for key, value in response.headers.items()
if key.lower() not in excluded_headers
}
return Response(
content=content,
status_code=response.status_code,
headers=dict(response.headers),
headers=headers,
)
except Exception as e:
verbose_proxy_logger.exception(
@ -423,7 +429,7 @@ def create_pass_through_route(
)
except Exception:
verbose_proxy_logger.warning("Defaulting to target being a url.")
verbose_proxy_logger.debug("Defaulting to target being a url.")
async def endpoint_func(
request: Request,