Skip to content

Commit cda21db

Browse files
committed
test: fix tests
1 parent 34061e9 commit cda21db

File tree

3 files changed

+9
-325
lines changed

3 files changed

+9
-325
lines changed

examples/tracing/litellm/test_local_litellm.py

Lines changed: 0 additions & 317 deletions
This file was deleted.

src/openlayer/lib/integrations/litellm_tracer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,19 +342,19 @@ def get_model_parameters(kwargs: Dict[str, Any]) -> Dict[str, Any]:
342342

343343
def create_trace_args(
344344
end_time: float,
345-
inputs: Dict,
345+
inputs: Dict[str, Any],
346346
output: str,
347347
latency: float,
348348
tokens: int,
349349
prompt_tokens: int,
350350
completion_tokens: int,
351351
model: str,
352-
model_parameters: Optional[Dict] = None,
353-
metadata: Optional[Dict] = None,
352+
model_parameters: Optional[Dict[str, Any]] = None,
353+
metadata: Optional[Dict[str, Any]] = None,
354354
raw_output: Optional[str] = None,
355355
id: Optional[str] = None,
356356
cost: Optional[float] = None,
357-
) -> Dict:
357+
) -> Dict[str, Any]:
358358
"""Returns a dictionary with the trace arguments."""
359359
trace_args = {
360360
"end_time": end_time,

tests/test_litellm_integration.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Test LiteLLM integration."""
22

33
import builtins
4+
from typing import Any, Dict
45
from unittest.mock import Mock, patch
56

67
import pytest
@@ -30,7 +31,7 @@ def test_trace_litellm_raises_import_error_without_dependency(self):
3031

3132
@patch('openlayer.lib.integrations.litellm_tracer.HAVE_LITELLM', True)
3233
@patch('openlayer.lib.integrations.litellm_tracer.litellm')
33-
def test_trace_litellm_patches_completion(self, mock_litellm):
34+
def test_trace_litellm_patches_completion(self, mock_litellm: Mock) -> None:
3435
"""Test that trace_litellm successfully patches litellm.completion."""
3536
from openlayer.lib.integrations.litellm_tracer import trace_litellm
3637

@@ -177,7 +178,7 @@ def test_create_trace_args(self):
177178
"""Test trace arguments creation."""
178179
from openlayer.lib.integrations.litellm_tracer import create_trace_args
179180

180-
args = create_trace_args(
181+
args: Dict[str, Any] = create_trace_args(
181182
end_time=1234567890.0,
182183
inputs={"prompt": "test"},
183184
output="response",
@@ -218,7 +219,7 @@ def test_lib_init_trace_litellm_import_error(self):
218219

219220
# Mock import to fail for litellm specifically
220221
original_import = builtins.__import__
221-
def mock_import(name, *args, **kwargs):
222+
def mock_import(name: str, *args: Any, **kwargs: Any) -> Any:
222223
if name == 'litellm':
223224
raise ImportError("No module named 'litellm'")
224225
return original_import(name, *args, **kwargs)
@@ -261,7 +262,7 @@ def test_extract_litellm_metadata(self):
261262

262263
@patch('openlayer.lib.integrations.litellm_tracer.HAVE_LITELLM', True)
263264
@patch('openlayer.lib.integrations.litellm_tracer.litellm')
264-
def test_detect_provider_with_litellm_method(self, mock_litellm):
265+
def test_detect_provider_with_litellm_method(self, mock_litellm: Mock) -> None:
265266
"""Test provider detection using LiteLLM's get_llm_provider method."""
266267
from openlayer.lib.integrations.litellm_tracer import detect_provider_from_response
267268

0 commit comments

Comments
 (0)