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: timezone issue of opik

Franklinf5785ae41be4
diff --git a/litellm/integrations/opik/opik.py b/litellm/integrations/opik/opik.py
index 8cbfb9e6535..9f90d2384d8 100644
--- a/litellm/integrations/opik/opik.py
+++ b/litellm/integrations/opik/opik.py
@@ -3,6 +3,7 @@ Opik Logger that logs LLM events to an Opik server
"""
import asyncio
+from datetime import timezone
import json
import traceback
from typing import Dict, List
@@ -291,8 +292,8 @@ class OpikLogger(CustomBatchLogger):
"project_name": project_name,
"id": trace_id,
"name": trace_name,
- "start_time": start_time.isoformat() + "Z",
- "end_time": end_time.isoformat() + "Z",
+ "start_time": start_time.astimezone(timezone.utc).isoformat().replace("+00:00", "Z"),
+ "end_time": end_time.astimezone(timezone.utc).isoformat().replace("+00:00", "Z"),
"input": input_data,
"output": output_data,
"metadata": metadata,
@@ -312,8 +313,8 @@ class OpikLogger(CustomBatchLogger):
"parent_span_id": parent_span_id,
"name": span_name,
"type": "llm",
- "start_time": start_time.isoformat() + "Z",
- "end_time": end_time.isoformat() + "Z",
+ "start_time": start_time.astimezone(timezone.utc).isoformat().replace("+00:00", "Z"),
+ "end_time": end_time.astimezone(timezone.utc).isoformat().replace("+00:00", "Z"),
"input": input_data,
"output": output_data,
"metadata": metadata,