From 857ceb40bc33ad04670e568242c5c79bf0e2cdec Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 3 Jun 2024 07:53:52 -0700 Subject: [PATCH] feat - log raw_request to langfuse / other logging providers --- litellm/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/litellm/utils.py b/litellm/utils.py index 7769027080..510add7ce8 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -1305,6 +1305,13 @@ class Logging: ) else: verbose_logger.info(f"\033[92m{curl_command}\033[0m\n") + + # check if user wants the raw request logged to their logging provider (like LangFuse) + _litellm_params = self.model_call_details.get("litellm_params", {}) + _metadata = _litellm_params.get("metadata", {}) or {} + if _metadata.get("log_raw_request", False) is True: + _metadata["raw_request"] = curl_command + if self.logger_fn and callable(self.logger_fn): try: self.logger_fn(