pythonllama-index

llama_index.indices.list.retrievers import error


from llama_index import GPTListIndex
from llama_index.indices.list.retrievers import ListIndexLLMRetriever

documents = SimpleDirectoryReader('./data').load_data()
index = GPTListIndex.from_documents(documents, service_context=service_context)
retriever = ListIndexLLMRetriever()
....

I try to import my python program with
python 3.8.1 and 3.11.0
pip install llama-index==0.5.6
pip install langchain==0.0.148
these versions are suggested in this github https://github.com/langchain-ai/langchain/issues/4064

but all get the error message:
ModuleNotFoundError: No module named 'llama_index.indices.list.retrievers'

Does anyone have any suggestions to solve it?


Solution

  • In llama-index, ListIndexLLMRetriever was added only as part of the release 0.6.13. This requires Langchain version to be 0.0.154.

    Therefore, changing the version to the one specified below should solve your problem.

    pip install llama_index==0.6.13
    pip install langchain==0.0.154
    

    Note: Do verify that other parts of the code are not broken by this change.