Short-term electricity demand forecasting represents a fundamental tool for decision-making by entities engaged in electricity management since it allows the development of strategies to meet variations in electricity demand in short periods. The accuracy of predictive models is an important factor for energy operations and the scheduling of energy generation sources to meet the demand at each instant. Intelligent models based on Recurrent Neural Networks (RNN) require hyperparameter adjustment. These models have several hyperparameters that substantially affect their performance. Our paper implements a Long-Short Term Memory (LSTM) model and four search methods to adjust its hyperparameters. First, we select the length of historical window and the hidden state size of LSTM cells for optimization. Second, we draw comparisons between the grid search, random search, a Bayesian scheme, and a genetic algorithm. The data set used for training and validation of the model includes hourly electricity consumption and meteorological variables recorded in Paraguay from 2015 to 2021. The proposed model was evaluated through numerical experiments with classical error measures such as the root mean square error (RMSE), the correlation, the runtime, and the mean absolute percentage error (MAPE). Our comparative study shows that grid search and genetic algorithm give the optimal hyperparameters with high validation accuracy on the test dataset. However, it is important to note that grid search may require much more evaluations and computational resources.