LLMs as Repositories of Factual Knowledge: Limitations and Solutions