The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
[Fix]: Handle non-serializable objects in Langfuse logging (#15148)
Ishaan Jaff09106222c747
diff --git a/litellm/integrations/langfuse/langfuse.py b/litellm/integrations/langfuse/langfuse.pyindex 69943a0fe4d..1a44b4706a0 100644--- a/litellm/integrations/langfuse/langfuse.py+++ b/litellm/integrations/langfuse/langfuse.py@@ -1,6 +1,5 @@#### What this does ##### On success, logs events to Langfuse-import copyimport osimport tracebackfrom datetime import datetime@@ -11,6 +10,7 @@ from packaging.version import Versionimport litellmfrom litellm._logging import verbose_loggerfrom litellm.constants import MAX_LANGFUSE_INITIALIZED_CLIENTS+from litellm.litellm_core_utils.core_helpers import safe_deep_copyfrom litellm.litellm_core_utils.redact_messages import redact_user_api_key_infofrom litellm.llms.custom_httpx.http_handler import _get_httpx_clientfrom litellm.secret_managers.main import str_to_bool@@ -222,7 +222,7 @@ class LangFuseLogger:litellm_params.get("metadata", {}) or {}) # if litellm_params['metadata'] == Nonemetadata = self.add_metadata_from_header(litellm_params, metadata)- optional_params = copy.deepcopy(kwargs.get("optional_params", {}))+ optional_params = safe_deep_copy(kwargs.get("optional_params", {}))prompt = {"messages": kwargs.get("messages")}