Skip to content

Commit 1595389

Browse files
authored
Merge pull request #266 from asamal4/print-to-logging
chore: replace pending print statement with logger
2 parents 6ff47a6 + 16ca2d8 commit 1595389

4 files changed

Lines changed: 17 additions & 11 deletions

File tree

src/lightspeed_evaluation/core/llm/deepeval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(self, model_name: str, llm_params: dict[str, Any]):
6262
**self.llm_params.get("parameters", {}),
6363
)
6464

65-
print(f"✅ DeepEval LLM Manager: {self.model_name}")
65+
logger.info("DeepEval LLM Manager: %s", self.model_name)
6666

6767
def _patch_deepeval_retries(self, max_retries: int) -> None:
6868
"""Monkey-patch DeepEval's retry decorators to use configured max_retries.

src/lightspeed_evaluation/core/metrics/custom/custom.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Custom metrics using direct LLM integration."""
22

33
import json
4+
import logging
45
import re
56
from typing import TYPE_CHECKING, Any, Optional
67

@@ -23,6 +24,8 @@
2324
if TYPE_CHECKING:
2425
from lightspeed_evaluation.core.metrics.manager import MetricManager
2526

27+
logger = logging.getLogger(__name__)
28+
2629

2730
class CustomMetrics: # pylint: disable=too-few-public-methods
2831
"""Handles custom metrics using LLMManager for direct LLM calls."""
@@ -54,7 +57,7 @@ def __init__(
5457
),
5558
}
5659

57-
print(f"✅ Custom Metrics initialized: {self.llm.model_name}")
60+
logger.info("Custom Metrics initialized: %s", self.llm.model_name)
5861

5962
def evaluate(
6063
self,

src/lightspeed_evaluation/core/output/data_persistence.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Simple data persistence utilities for evaluation framework."""
22

3+
import logging
34
from datetime import UTC, datetime
45
from pathlib import Path
56
from typing import Any, Optional
@@ -10,6 +11,8 @@
1011
from lightspeed_evaluation.core.models import EvaluationData
1112
from lightspeed_evaluation.core.models.data import DatasetMetadata
1213

14+
logger = logging.getLogger(__name__)
15+
1316

1417
def save_evaluation_data(
1518
evaluation_data: list[EvaluationData],
@@ -62,9 +65,9 @@ def save_evaluation_data(
6265
indent=2,
6366
)
6467

65-
print(f"💾 Amended evaluation data saved to: {amended_data_path}")
68+
logger.info("Amended evaluation data saved to: %s", amended_data_path)
6669
return str(amended_data_path)
6770

6871
except (OSError, yaml.YAMLError) as e:
69-
print(f"❌ Failed to save amended evaluation data: {e}")
72+
logger.error("Failed to save amended evaluation data: %s", e)
7073
return None

tests/unit/core/llm/test_deepeval_manager.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,17 @@ def test_get_model_info(self, llm_params: dict, mocker: MockerFixture) -> None:
7777
assert info["temperature"] == 0.5
7878
assert info["max_completion_tokens"] == 1024
7979

80-
def test_initialization_prints_message(
81-
self, llm_params: dict, mocker: MockerFixture, capsys: pytest.CaptureFixture
80+
def test_initialization_logs_message(
81+
self, llm_params: dict, mocker: MockerFixture, caplog: pytest.LogCaptureFixture
8282
) -> None:
83-
"""Test that initialization prints configuration message."""
83+
"""Test that initialization logs configuration message."""
8484
mocker.patch("lightspeed_evaluation.core.llm.deepeval.LiteLLMModel")
8585

86-
DeepEvalLLMManager("gpt-4", llm_params)
86+
with caplog.at_level("INFO", logger="lightspeed_evaluation.core.llm.deepeval"):
87+
DeepEvalLLMManager("gpt-4", llm_params)
8788

88-
captured = capsys.readouterr()
89-
assert "DeepEval LLM Manager" in captured.out
90-
assert "gpt-4" in captured.out
89+
assert "DeepEval LLM Manager" in caplog.text
90+
assert "gpt-4" in caplog.text
9191

9292
def test_drop_params_always_enabled(self, mocker: MockerFixture) -> None:
9393
"""Test drop_params is always enabled for cross-provider compatibility."""

0 commit comments

Comments
 (0)