44from typing import Any , Dict
55from unittest .mock import Mock , patch
66
7- import pytest
7+ import pytest # type: ignore
88
99
1010class TestLiteLLMIntegration :
@@ -23,11 +23,11 @@ def test_trace_litellm_raises_import_error_without_dependency(self):
2323 with patch ('openlayer.lib.integrations.litellm_tracer.HAVE_LITELLM' , False ):
2424 from openlayer .lib .integrations .litellm_tracer import trace_litellm
2525
26- with pytest .raises (ImportError ) as exc_info :
26+ with pytest .raises (ImportError ) as exc_info : # type: ignore
2727 trace_litellm ()
2828
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
3131
3232 @patch ('openlayer.lib.integrations.litellm_tracer.HAVE_LITELLM' , True )
3333 @patch ('openlayer.lib.integrations.litellm_tracer.litellm' )
@@ -52,14 +52,14 @@ def test_detect_provider_from_model_name(self):
5252 from openlayer .lib .integrations .litellm_tracer import detect_provider_from_model_name
5353
5454 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 " ),
6363 ("unknown-model" , "unknown" ),
6464 ]
6565
@@ -225,11 +225,11 @@ def mock_import(name: str, *args: Any, **kwargs: Any) -> Any:
225225 return original_import (name , * args , ** kwargs )
226226
227227 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
229229 trace_litellm ()
230230
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
233233
234234 @patch ('openlayer.lib.integrations.litellm_tracer.HAVE_LITELLM' , True )
235235 def test_extract_litellm_metadata (self ):
0 commit comments