mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
fix(proxy_server.py): support langfuse logging for rejected requests on /v1/chat/completions
This commit is contained in:
parent
017af34866
commit
7618ec43b3
7 changed files with 74 additions and 33 deletions
|
@ -31,6 +31,7 @@ from litellm.caching import DualCache, RedisCache
|
|||
from litellm.exceptions import RejectedRequestError
|
||||
from litellm.integrations.custom_logger import CustomLogger
|
||||
from litellm.integrations.slack_alerting import SlackAlerting
|
||||
from litellm.litellm_core_utils.litellm_logging import Logging
|
||||
from litellm.llms.custom_httpx.httpx_handler import HTTPHandler
|
||||
from litellm.proxy._types import (
|
||||
AlertType,
|
||||
|
@ -595,6 +596,23 @@ class ProxyLogging:
|
|||
)
|
||||
)
|
||||
|
||||
### LOGGING ###
|
||||
litellm_logging_obj: Optional[Logging] = request_data.get(
|
||||
"litellm_logging_obj", None
|
||||
)
|
||||
|
||||
if (
|
||||
isinstance(original_exception, HTTPException)
|
||||
and litellm_logging_obj is not None
|
||||
):
|
||||
# log the custom exception
|
||||
await litellm_logging_obj.async_failure_handler(
|
||||
exception=original_exception,
|
||||
traceback_exception=traceback.format_exc(),
|
||||
start_time=time.time(),
|
||||
end_time=time.time(),
|
||||
)
|
||||
|
||||
for callback in litellm.callbacks:
|
||||
try:
|
||||
_callback: Optional[CustomLogger] = None
|
||||
|
@ -611,6 +629,7 @@ class ProxyLogging:
|
|||
)
|
||||
except Exception as e:
|
||||
raise e
|
||||
|
||||
return
|
||||
|
||||
async def post_call_success_hook(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue