diff --git a/litellm/llms/vertex_httpx.py b/litellm/llms/vertex_httpx.py index 954a30b801..db61b129b3 100644 --- a/litellm/llms/vertex_httpx.py +++ b/litellm/llms/vertex_httpx.py @@ -182,7 +182,12 @@ class GoogleAIStudioGeminiConfig: # key diff from VertexAI - 'frequency_penalty if param == "max_tokens": optional_params["max_output_tokens"] = value if param == "response_format" and value["type"] == "json_object": # type: ignore - optional_params["response_mime_type"] = "application/json" + if value["type"] == "json_object": # type: ignore + optional_params["response_mime_type"] = "application/json" + elif value["type"] == "text": # type: ignore + optional_params["response_mime_type"] = "text/plain" + if "response_schema" in value: # type: ignore + optional_params["response_schema"] = value["response_schema"] # type: ignore if param == "tools" and isinstance(value, list): gtool_func_declarations = [] for tool in value: diff --git a/litellm/tests/test_amazing_vertex_completion.py b/litellm/tests/test_amazing_vertex_completion.py index f0b243c36e..4338d63ba6 100644 --- a/litellm/tests/test_amazing_vertex_completion.py +++ b/litellm/tests/test_amazing_vertex_completion.py @@ -903,10 +903,10 @@ from litellm.tests.test_completion import response_format_tests @pytest.mark.parametrize( "model", [ - # "vertex_ai/mistral-large@2407", - # "vertex_ai/mistral-nemo@2407", + "vertex_ai/mistral-large@2407", + "vertex_ai/mistral-nemo@2407", "vertex_ai/codestral@2405", - # "vertex_ai/meta/llama3-405b-instruct-maas", + "vertex_ai/meta/llama3-405b-instruct-maas", ], # ) # "vertex_ai", @pytest.mark.parametrize( @@ -1347,6 +1347,7 @@ def vertex_httpx_mock_post_invalid_schema_response_anthropic(*args, **kwargs): "model, vertex_location, supports_response_schema", [ ("vertex_ai_beta/gemini-1.5-pro-001", "us-central1", True), + ("gemini/gemini-1.5-pro", None, True), ("vertex_ai_beta/gemini-1.5-flash", "us-central1", False), ("vertex_ai/claude-3-5-sonnet@20240620", "us-east5", False), ],