mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
fix: ensure checks show gemini-3-flash-preview supports responseJsonS… (#30696)
* fix: ensure checks show gemini-3-flash-preview supports responseJsonSchema. * fix: remove async keyword from test.
This commit is contained in:
parent
18564992a3
commit
3edfc0c405
2 changed files with 20 additions and 6 deletions
|
|
@ -271,7 +271,7 @@ def supports_response_json_schema(model: str) -> bool:
|
|||
|
||||
# Gemini 2.0+ and 2.5+ models support responseJsonSchema
|
||||
# Pattern matches: gemini-2.0-*, gemini-2.5-*, gemini-3-*, etc.
|
||||
gemini_2_plus_pattern = re.compile(r"gemini-([2-9]|[1-9]\d+)\.")
|
||||
gemini_2_plus_pattern = re.compile(r"gemini-(?:[2-9]|[1-9]\d+)(?:\.|\-)")
|
||||
|
||||
return bool(gemini_2_plus_pattern.search(model_lower))
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ from litellm.llms.vertex_ai.common_utils import (
|
|||
get_vertex_project_id_from_url,
|
||||
pop_vertex_request_labels,
|
||||
set_schema_property_ordering,
|
||||
supports_response_json_schema,
|
||||
vertex_request_labels_from_litellm_params,
|
||||
)
|
||||
|
||||
|
|
@ -150,6 +151,23 @@ async def test_get_supports_system_message():
|
|||
assert result == False
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"model, expected",
|
||||
[
|
||||
("gemini-2.0-flash", True),
|
||||
("gemini-1.5-pro", False),
|
||||
("random-model-name", False),
|
||||
("gemini-3-flash-preview", True),
|
||||
("gemini-123-pro", True),
|
||||
("vertex_ai/gemini-3.1-pro-preview", True),
|
||||
],
|
||||
)
|
||||
def test_supports_response_json_schema(model: str, expected: bool):
|
||||
"""Test supports_response_json_schema correctly detects Gemini 2.0+ model names"""
|
||||
|
||||
assert supports_response_json_schema(model) == expected
|
||||
|
||||
|
||||
def test_set_schema_property_ordering_with_excessive_nesting():
|
||||
"""Test set_schema_property_ordering with excessive nesting > max levels +1 deep."""
|
||||
# generate a schema with excessive nesting
|
||||
|
|
@ -1526,11 +1544,7 @@ def test_vertex_request_labels_from_litellm_params_extracts_requester_metadata()
|
|||
|
||||
|
||||
def test_vertex_request_labels_from_litellm_params_accepts_litellm_metadata():
|
||||
lp = {
|
||||
"litellm_metadata": {
|
||||
"requester_metadata": {"team": "platform", "count": 3}
|
||||
}
|
||||
}
|
||||
lp = {"litellm_metadata": {"requester_metadata": {"team": "platform", "count": 3}}}
|
||||
assert vertex_request_labels_from_litellm_params(lp) == {"team": "platform"}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue