@@ -66,6 +66,20 @@ def test_extract_model_name_with_models_prefix(self):
6666 assert extract_model_name ('models/gemini-2.5-pro' ) == 'gemini-2.5-pro'
6767 assert extract_model_name ('models/gemini-2.5-flash' ) == 'gemini-2.5-flash'
6868
69+ def test_extract_model_name_provider_prefixed_model (self ):
70+ """Test extraction of provider-prefixed Gemini model names."""
71+ assert extract_model_name ('gemini/gemini-2.5-flash' ) == 'gemini-2.5-flash'
72+ assert extract_model_name ('vertex_ai/gemini-2.5-flash' ) == (
73+ 'gemini-2.5-flash'
74+ )
75+ assert (
76+ extract_model_name ('openrouter/google/gemini-2.5-pro:online' )
77+ == 'gemini-2.5-pro:online'
78+ )
79+ assert extract_model_name ('openrouter/anthropic/claude-sonnet-4' ) == (
80+ 'openrouter/anthropic/claude-sonnet-4'
81+ )
82+
6983 def test_extract_model_name_invalid_path (self ):
7084 """Test that invalid path formats return the original string."""
7185 invalid_paths = [
@@ -118,6 +132,13 @@ def test_is_gemini_model_path_based_names(self):
118132 non_gemini_path = 'projects/265104255505/locations/us-central1/publishers/google/models/claude-3-sonnet'
119133 assert is_gemini_model (non_gemini_path ) is False
120134
135+ def test_is_gemini_model_provider_prefixed_names (self ):
136+ """Test Gemini model detection with provider-prefixed model names."""
137+ assert is_gemini_model ('gemini/gemini-2.5-flash' ) is True
138+ assert is_gemini_model ('vertex_ai/gemini-2.5-flash' ) is True
139+ assert is_gemini_model ('openrouter/google/gemini-2.5-pro:online' ) is True
140+ assert is_gemini_model ('openrouter/anthropic/claude-sonnet-4' ) is False
141+
121142 def test_is_gemini_model_edge_cases (self ):
122143 """Test edge cases for Gemini model detection."""
123144 # Test with None
@@ -170,6 +191,13 @@ def test_is_gemini_1_model_path_based_names(self):
170191 gemini_2_path = 'projects/265104255505/locations/us-central1/publishers/google/models/gemini-2.5-flash'
171192 assert is_gemini_1_model (gemini_2_path ) is False
172193
194+ def test_is_gemini_1_model_provider_prefixed_names (self ):
195+ """Test Gemini 1.x detection with provider-prefixed model names."""
196+ assert is_gemini_1_model ('gemini/gemini-1.5-flash' ) is True
197+ assert is_gemini_1_model ('vertex_ai/gemini-1.5-flash' ) is True
198+ assert is_gemini_1_model ('openrouter/google/gemini-1.5-pro:online' ) is True
199+ assert is_gemini_1_model ('openrouter/google/gemini-2.5-pro' ) is False
200+
173201 def test_is_gemini_1_model_edge_cases (self ):
174202 """Test edge cases for Gemini 1.x model detection."""
175203 # Test with None
@@ -217,6 +245,17 @@ def test_is_gemini_2_or_above_path_based_names(self):
217245 gemini_3_path = 'projects/12345/locations/us-east1/publishers/google/models/gemini-3.0-pro'
218246 assert is_gemini_2_or_above (gemini_3_path ) is True
219247
248+ def test_is_gemini_2_or_above_provider_prefixed_names (self ):
249+ """Test Gemini 2.0+ detection with provider-prefixed model names."""
250+ assert is_gemini_2_or_above ('gemini/gemini-2.5-flash' ) is True
251+ assert is_gemini_2_or_above ('vertex_ai/gemini-2.5-flash' ) is True
252+ assert (
253+ is_gemini_2_or_above ('openrouter/google/gemini-2.5-pro:online' ) is True
254+ )
255+ assert (
256+ is_gemini_2_or_above ('openrouter/google/gemini-1.5-pro:online' ) is False
257+ )
258+
220259 def test_is_gemini_2_or_above_edge_cases (self ):
221260 """Test edge cases for Gemini 2.0+ model detection."""
222261 # Test with None
@@ -245,6 +284,8 @@ def test_model_classification_consistency(self):
245284 'gemini-2.5-flash' ,
246285 'gemini-2.5-pro' ,
247286 'gemini-3.0-pro' ,
287+ 'gemini/gemini-2.5-flash' ,
288+ 'openrouter/google/gemini-2.5-pro:online' ,
248289 'projects/123/locations/us-central1/publishers/google/models/gemini-1.5-pro' ,
249290 'projects/123/locations/us-central1/publishers/google/models/gemini-2.5-flash' ,
250291 'projects/123/locations/us-central1/publishers/google/models/gemini-3.0-pro' ,
0 commit comments