fix - by default log raw curl command on langfuse

This commit is contained in:
Ishaan Jaff 2024-06-04 16:30:25 -07:00
parent 48f399bcc4
commit 3b823c7587

View file

@ -1270,7 +1270,11 @@ class Logging:
api_base api_base
) # used for alerting ) # used for alerting
masked_headers = { masked_headers = {
k: (v[:-20] + "*" * 20) if (isinstance(v, str) and len(v) > 20) else v k: (
(v[:-44] + "*" * 44)
if (isinstance(v, str) and len(v) > 44)
else "*****"
)
for k, v in headers.items() for k, v in headers.items()
} }
formatted_headers = " ".join( formatted_headers = " ".join(
@ -1309,7 +1313,6 @@ class Logging:
# check if user wants the raw request logged to their logging provider (like LangFuse) # check if user wants the raw request logged to their logging provider (like LangFuse)
_litellm_params = self.model_call_details.get("litellm_params", {}) _litellm_params = self.model_call_details.get("litellm_params", {})
_metadata = _litellm_params.get("metadata", {}) or {} _metadata = _litellm_params.get("metadata", {}) or {}
if _metadata.get("log_raw_request", False) is True:
_metadata["raw_request"] = curl_command _metadata["raw_request"] = curl_command
if self.logger_fn and callable(self.logger_fn): if self.logger_fn and callable(self.logger_fn):