Skip to content

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]

fix literal ai typing errors

Ishaan Jaffa0bebc34137b
diff --git a/litellm/integrations/literal_ai.py b/litellm/integrations/literal_ai.py
index f83b714e5d5..5bf9afd7eb4 100644
--- a/litellm/integrations/literal_ai.py
+++ b/litellm/integrations/literal_ai.py
@@ -3,7 +3,7 @@
import asyncio
import os
import uuid
-from typing import Optional
+from typing import List, Optional
import httpx
@@ -192,9 +192,11 @@ class LiteralAILogger(CustomBatchLogger):
metadata = kwargs.get("litellm_params", {}).get("metadata", {})
settings = logging_payload["model_parameters"]
-
messages = logging_payload["messages"]
- choices = logging_payload.get("response", {}).get("choices", [])
+ response = logging_payload["response"]
+ choices: List = []
+ if isinstance(response, dict) and "choices" in response:
+ choices = response["choices"]
message_completion = choices[0]["message"] if choices else None
prompt_id = None
variables = None