A comprehensive performance evaluation of proprietary and open-source language models in closed and open-domain tasks