4
4
from typing import Any , Dict
5
5
from unittest .mock import Mock , patch
6
6
7
- import pytest
7
+ import pytest # type: ignore
8
8
9
9
10
10
class TestLiteLLMIntegration :
@@ -23,11 +23,11 @@ def test_trace_litellm_raises_import_error_without_dependency(self):
23
23
with patch ('openlayer.lib.integrations.litellm_tracer.HAVE_LITELLM' , False ):
24
24
from openlayer .lib .integrations .litellm_tracer import trace_litellm
25
25
26
- with pytest .raises (ImportError ) as exc_info :
26
+ with pytest .raises (ImportError ) as exc_info : # type: ignore
27
27
trace_litellm ()
28
28
29
- assert "LiteLLM library is not installed" in str (exc_info .value )
30
- assert "pip install litellm" in str (exc_info .value )
29
+ assert "LiteLLM library is not installed" in str (exc_info .value ) # type: ignore
30
+ assert "pip install litellm" in str (exc_info .value ) # type: ignore
31
31
32
32
@patch ('openlayer.lib.integrations.litellm_tracer.HAVE_LITELLM' , True )
33
33
@patch ('openlayer.lib.integrations.litellm_tracer.litellm' )
@@ -52,14 +52,14 @@ def test_detect_provider_from_model_name(self):
52
52
from openlayer .lib .integrations .litellm_tracer import detect_provider_from_model_name
53
53
54
54
test_cases = [
55
- ("gpt-4" , "openai " ),
56
- ("gpt-3.5-turbo" , "openai " ),
57
- ("claude-3-opus-20240229" , "anthropic " ),
58
- ("claude-3-haiku-20240307" , "anthropic " ),
59
- ("gemini-pro" , "google " ),
60
- ("llama-2-70b" , "meta " ),
61
- ("mistral-large-latest" , "mistral " ),
62
- ("command-r-plus" , "cohere " ),
55
+ ("gpt-4" , "OpenAI " ),
56
+ ("gpt-3.5-turbo" , "OpenAI " ),
57
+ ("claude-3-opus-20240229" , "Anthropic " ),
58
+ ("claude-3-haiku-20240307" , "Anthropic " ),
59
+ ("gemini-pro" , "Google " ),
60
+ ("llama-2-70b" , "Meta " ),
61
+ ("mistral-large-latest" , "Mistral " ),
62
+ ("command-r-plus" , "Cohere " ),
63
63
("unknown-model" , "unknown" ),
64
64
]
65
65
@@ -225,11 +225,11 @@ def mock_import(name: str, *args: Any, **kwargs: Any) -> Any:
225
225
return original_import (name , * args , ** kwargs )
226
226
227
227
with patch ('builtins.__import__' , side_effect = mock_import ):
228
- with pytest .raises (ImportError ) as exc_info :
228
+ with pytest .raises (ImportError ) as exc_info : # type: ignore
229
229
trace_litellm ()
230
230
231
- assert "litellm is required for LiteLLM tracing" in str (exc_info .value )
232
- assert "pip install litellm" in str (exc_info .value )
231
+ assert "litellm is required for LiteLLM tracing" in str (exc_info .value ) # type: ignore
232
+ assert "pip install litellm" in str (exc_info .value ) # type: ignore
233
233
234
234
@patch ('openlayer.lib.integrations.litellm_tracer.HAVE_LITELLM' , True )
235
235
def test_extract_litellm_metadata (self ):
0 commit comments