Skip to content

Commit 2a4a23d

Browse files
author
User
committed
fix: Add None check before OpikLogger instantiation
- Check if OpikLogger is None before calling constructor - Add type: ignore[misc] for the instantiation - Ensures mypy passes with all optional dependency scenarios mypy now reports: Success: no issues found in 16 source files
1 parent 9ee00fc commit 2a4a23d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ace/observability/opik_integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,14 @@ def setup_litellm_callback(self) -> bool:
285285
Returns:
286286
bool: True if callback was successfully configured, False otherwise
287287
"""
288-
if not self.enabled or not LITELLM_OPIK_AVAILABLE:
288+
if not self.enabled or not LITELLM_OPIK_AVAILABLE or OpikLogger is None:
289289
return False
290290

291291
try:
292292
import litellm
293293

294294
# Initialize OpikLogger
295-
opik_logger = OpikLogger()
295+
opik_logger = OpikLogger() # type: ignore[misc]
296296

297297
# Add to LiteLLM callbacks if not already present
298298
if not hasattr(litellm, "callbacks") or litellm.callbacks is None:

0 commit comments

Comments
 (0)