mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-11 08:22:40 +00:00
test_proxy_custom_logger.py::test_chat_completio
This commit is contained in:
@@ -677,11 +677,6 @@ async def add_litellm_data_to_request( # noqa: PLR0915
|
||||
from litellm.proxy.proxy_server import llm_router, premium_user
|
||||
from litellm.types.proxy.litellm_pre_call_utils import SecretFields
|
||||
|
||||
safe_add_api_version_from_query_params(data, request)
|
||||
_metadata_variable_name = _get_metadata_variable_name(request)
|
||||
if data.get(_metadata_variable_name, None) is None:
|
||||
data[_metadata_variable_name] = {}
|
||||
|
||||
|
||||
_headers = clean_headers(
|
||||
request.headers,
|
||||
@@ -692,6 +687,24 @@ async def add_litellm_data_to_request( # noqa: PLR0915
|
||||
),
|
||||
)
|
||||
|
||||
##########################################################
|
||||
# Init - Proxy Server Request
|
||||
# we do this as soon as entering so we track the original request
|
||||
##########################################################
|
||||
data["proxy_server_request"] = {
|
||||
"url": str(request.url),
|
||||
"method": request.method,
|
||||
"headers": _headers,
|
||||
"body": copy.copy(data), # use copy instead of deepcopy
|
||||
}
|
||||
|
||||
safe_add_api_version_from_query_params(data, request)
|
||||
_metadata_variable_name = _get_metadata_variable_name(request)
|
||||
if data.get(_metadata_variable_name, None) is None:
|
||||
data[_metadata_variable_name] = {}
|
||||
|
||||
|
||||
|
||||
data.update(
|
||||
LiteLLMProxyRequestSetup.add_litellm_data_for_backend_llm_call(
|
||||
headers=_headers,
|
||||
@@ -721,13 +734,6 @@ async def add_litellm_data_to_request( # noqa: PLR0915
|
||||
if "user" not in data:
|
||||
data["user"] = user
|
||||
|
||||
# Include original request and headers in the data
|
||||
data["proxy_server_request"] = {
|
||||
"url": str(request.url),
|
||||
"method": request.method,
|
||||
"headers": _headers,
|
||||
"body": copy.copy(data), # use copy instead of deepcopy
|
||||
}
|
||||
|
||||
data["secret_fields"] = SecretFields(raw_headers=dict(request.headers))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user