large-language-modelllama-indexrag

NameError: name 'LangchainLLM' is not defined


I am following some tutorials online relating to RAG systems. As part of it I am trying to use LangChainLLM from LlamaIndex. I am working on Google Colab. As per the LlamaIndex docs I have imported LangChainLLM as follows:

from llama_index.llms.langchain import LangChainLLM

This does not throw an error when run

However when I try to use LangChainLLM as follows:

langchain_llm = LangchainLLM(llm_chain=llm_chain)

It throws the error NameError: name 'LangchainLLM' is not defined

I have checked the documentation and searched online for a solution but I cant see why this error is arising. I have rerun the notebook but there is no impact. If anyone can help it would be greatly appreciated


Solution

  • You have a typo error LangChainLLM not LangchainLLM(llm_chain=llm_chain)