|
1 | 1 | """Test LiteLLM integration.""" |
2 | 2 |
|
3 | 3 | import builtins |
| 4 | +from typing import Any, Dict |
4 | 5 | from unittest.mock import Mock, patch |
5 | 6 |
|
6 | 7 | import pytest |
@@ -30,7 +31,7 @@ def test_trace_litellm_raises_import_error_without_dependency(self): |
30 | 31 |
|
31 | 32 | @patch('openlayer.lib.integrations.litellm_tracer.HAVE_LITELLM', True) |
32 | 33 | @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: |
34 | 35 | """Test that trace_litellm successfully patches litellm.completion.""" |
35 | 36 | from openlayer.lib.integrations.litellm_tracer import trace_litellm |
36 | 37 |
|
@@ -177,7 +178,7 @@ def test_create_trace_args(self): |
177 | 178 | """Test trace arguments creation.""" |
178 | 179 | from openlayer.lib.integrations.litellm_tracer import create_trace_args |
179 | 180 |
|
180 | | - args = create_trace_args( |
| 181 | + args: Dict[str, Any] = create_trace_args( |
181 | 182 | end_time=1234567890.0, |
182 | 183 | inputs={"prompt": "test"}, |
183 | 184 | output="response", |
@@ -218,7 +219,7 @@ def test_lib_init_trace_litellm_import_error(self): |
218 | 219 |
|
219 | 220 | # Mock import to fail for litellm specifically |
220 | 221 | original_import = builtins.__import__ |
221 | | - def mock_import(name, *args, **kwargs): |
| 222 | + def mock_import(name: str, *args: Any, **kwargs: Any) -> Any: |
222 | 223 | if name == 'litellm': |
223 | 224 | raise ImportError("No module named 'litellm'") |
224 | 225 | return original_import(name, *args, **kwargs) |
@@ -261,7 +262,7 @@ def test_extract_litellm_metadata(self): |
261 | 262 |
|
262 | 263 | @patch('openlayer.lib.integrations.litellm_tracer.HAVE_LITELLM', True) |
263 | 264 | @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: |
265 | 266 | """Test provider detection using LiteLLM's get_llm_provider method.""" |
266 | 267 | from openlayer.lib.integrations.litellm_tracer import detect_provider_from_response |
267 | 268 |
|
|
0 commit comments