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: Literal AI llm completion logging (#6096)
Willy Douhardac6fb0cbef0d
diff --git a/litellm/integrations/literal_ai.py b/litellm/integrations/literal_ai.pyindex 0a7f2f67558..f83b714e5d5 100644--- a/litellm/integrations/literal_ai.py+++ b/litellm/integrations/literal_ai.py@@ -2,7 +2,6 @@# This file contains the LiteralAILogger class which is used to log steps to the LiteralAI observability platform.import asyncioimport os-import tracebackimport uuidfrom typing import Optional@@ -10,7 +9,6 @@ import httpxfrom litellm._logging import verbose_loggerfrom litellm.integrations.custom_batch_logger import CustomBatchLogger-from litellm.litellm_core_utils.redact_messages import redact_user_api_key_infofrom litellm.llms.custom_httpx.http_handler import (HTTPHandler,get_async_httpx_client,@@ -92,7 +90,6 @@ class LiteralAILogger(CustomBatchLogger):url = f"{self.literalai_api_url}/api/graphql"query = self._steps_query_builder(self.log_queue)variables = self._steps_variables_builder(self.log_queue)-try:response = self.sync_http_handler.post(url=url,@@ -102,7 +99,6 @@ class LiteralAILogger(CustomBatchLogger):},headers=self.headers,)- response.raise_for_status()if response.status_code >= 300:verbose_logger.error(@@ -170,8 +166,6 @@ class LiteralAILogger(CustomBatchLogger):},headers=self.headers,)- response.raise_for_status()-if response.status_code >= 300:verbose_logger.error(f"Literal AI Error: {response.status_code} - {response.text}"@@ -200,6 +194,8 @@ class LiteralAILogger(CustomBatchLogger):settings = logging_payload["model_parameters"]messages = logging_payload["messages"]+ choices = logging_payload.get("response", {}).get("choices", [])+ message_completion = choices[0]["message"] if choices else Noneprompt_id = Nonevariables = None@@ -238,6 +234,7 @@ class LiteralAILogger(CustomBatchLogger):"duration": (end_time - start_time).total_seconds(),"settings": settings,"messages": messages,+ "messageCompletion": message_completion,"tools": tools,},}