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(langsmith.py): support langsmith 'extra' field object
Krrish Dholakiaa9a32820311a
diff --git a/litellm/integrations/langsmith.py b/litellm/integrations/langsmith.pyindex 12ed1ac7081..97242a2616b 100644--- a/litellm/integrations/langsmith.py+++ b/litellm/integrations/langsmith.py@@ -66,9 +66,28 @@ class LangsmithLogger(CustomLogger):def _prepare_log_data(self, kwargs, response_obj, start_time, end_time):import datetime+ from datetime import datetime as dtfrom datetime import timezonemetadata = kwargs.get("litellm_params", {}).get("metadata", {}) or {}+ new_metadata = {}+ for key, value in metadata.items():+ if (+ isinstance(value, list)+ or isinstance(value, str)+ or isinstance(value, int)+ or isinstance(value, float)+ ):+ new_metadata[key] = value+ elif isinstance(value, BaseModel):+ new_metadata[key] = value.model_dump_json()+ elif isinstance(value, dict):+ for k, v in value.items():+ if isinstance(v, dt):+ value[k] = v.isoformat()+ new_metadata[key] = value++ metadata = new_metadatakwargs["user_api_key"] = metadata.get("user_api_key", None)kwargs["user_api_key_user_id"] = metadata.get("user_api_key_user_id", None)@@ -124,6 +143,7 @@ class LangsmithLogger(CustomLogger):"start_time": start_time,"end_time": end_time,"tags": tags,+ "extra": metadata,}if run_id:diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yamlindex 1c789d3913a..87a561e3183 100644--- a/litellm/proxy/_new_secret_config.yaml+++ b/litellm/proxy/_new_secret_config.yaml@@ -3,5 +3,5 @@ model_list:litellm_params:model: "*"-general_settings:- disable_spend_logs: true\ No newline at end of file+litellm_settings:+ success_callback: ["langsmith"]\ No newline at end of file