def test_prepare_chat_with_tools_non_gemini_no_tool_config(
        self, mock_chat_from_pretrained, mock_text_from_pretrained
    ):
        """Test that non-Gemini models don't include tool_config regardless of tool_required."""
        mock_chat_client = Mock()
        mock_text_client = Mock()
        mock_chat_from_pretrained.return_value = mock_chat_client
        mock_text_from_pretrained.return_value = mock_text_client

        # Use a non-Gemini model name
        llm = Vertex(model="text-bison", project="test-project")

        # Test with tool_required=True for non-Gemini model
        result = llm._prepare_chat_with_tools(tools=[search_tool], tool_required=True)

        # Non-Gemini models should not have tool_config
        assert "tool_config" not in result
        assert len(result["tools"]) == 1
        assert result["tools"][0]["name"] == "search_tool"

        # Test with tool_required=False for non-Gemini model
        result = llm._prepare_chat_with_tools(tools=[search_tool], tool_required=False)

        # Non-Gemini models should not have tool_config
        assert "tool_config" not in result
        assert len(result["tools"]) == 1
        assert result["tools"][0]["name"] == "search_tool"
Test that non-Gemini models don't include tool_config regardless of tool_required.
llama-index-integrations/llms/llama-index-llms-vertex/tests/test_tool_required.py