Skip to content

Commit ce04620

Browse files
committed
monkey patch
1 parent c5d17e4 commit ce04620

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

eval_protocol/pytest/default_single_turn_rollout_process.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
import litellm
99
from typing import Dict
1010

11-
# Fix LiteLLM event loop binding issues by setting logging to ERROR level
12-
# This disables the logging worker that causes event loop binding problems
13-
import os
14-
15-
if os.environ.get("LITELLM_LOG") is None:
16-
os.environ["LITELLM_LOG"] = "ERROR"
11+
# Fix LiteLLM event loop binding issues by disabling the logging worker
12+
try:
13+
# Disable LiteLLM's async logging worker to prevent event loop binding issues
14+
import litellm.litellm_core_utils.logging_worker
15+
16+
# Monkey patch to disable the worker entirely
17+
original_start_worker = litellm.litellm_core_utils.logging_worker.start_worker
18+
litellm.litellm_core_utils.logging_worker.start_worker = lambda *args, **kwargs: None
19+
except Exception:
20+
pass # Best effort
1721

1822
from eval_protocol.dataset_logger import default_logger
1923
from eval_protocol.models import EvaluationRow, Message

0 commit comments

Comments
 (0)