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 to , where is a prime and is a positive integer with . 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 to is presented.