mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
Add /openai
pass through route on litellm proxy (#7412)
* add pt oai route - proxy * pass through use safe read request body
This commit is contained in:
parent
005f2fa1aa
commit
7c44b9f25f
2 changed files with 63 additions and 14 deletions
|
@ -22,6 +22,7 @@ from litellm.proxy._types import (
|
|||
UserAPIKeyAuth,
|
||||
)
|
||||
from litellm.proxy.auth.user_api_key_auth import user_api_key_auth
|
||||
from litellm.proxy.common_utils.http_parsing_utils import _read_request_body
|
||||
from litellm.secret_managers.main import get_secret_str
|
||||
from litellm.types.llms.custom_http import httpxSpecialProvider
|
||||
|
||||
|
@ -330,15 +331,7 @@ async def pass_through_request( # noqa: PLR0915
|
|||
if custom_body:
|
||||
_parsed_body = custom_body
|
||||
else:
|
||||
request_body = await request.body()
|
||||
if request_body == b"" or request_body is None:
|
||||
_parsed_body = None
|
||||
else:
|
||||
body_str = request_body.decode()
|
||||
try:
|
||||
_parsed_body = ast.literal_eval(body_str)
|
||||
except Exception:
|
||||
_parsed_body = json.loads(body_str)
|
||||
_parsed_body = await _read_request_body(request)
|
||||
verbose_proxy_logger.debug(
|
||||
"Pass through endpoint sending request to \nURL {}\nheaders: {}\nbody: {}\n".format(
|
||||
url, headers, _parsed_body
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue