A novel approach has been developed to calculate the temperature dependence of the optical response of a semiconductor. The dielectric function is averaged over several thermally perturbed configurations that are extracted from molecular dynamic simulations. The calculated temperature dependence of the imaginary part of the dielectric function of GaAs is presented in the range from 0 to 700 K. This approach that explicitly takes into account lattice vibrations describes well the observed thermally-induced energy shifts and broadening of the dielectric function.