Optimal codebooks meeting the Welch bound with equality are desirable in many areas, such as direct spread code division multiple access communications, compressed sensing and so on. However, it is difficult to construct such optimal codebooks. There have been a number of attempts to construct codebooks nearly meeting the Welch bound. In this paper, we introduce a generic construction of codebooks using generalized bent functions from [Formula: see text] to [Formula: see text], where [Formula: see text] is a prime and [Formula: see text] is a positive integer with [Formula: see text]. With this construction, we obtain two new families of codebooks nearly meeting the Welch bound. These codebooks have new parameters and could have a small alphabet size. In particular, a class of regular generalized bent functions from [Formula: see text] to [Formula: see text] is presented.