I am trying to follow various tutorials on langchain and streamlit and I have encountered many problems regarding the names of imports. My main problem is that I can't seem to import ConversationalRetrievalChain from langchain.chains. This isn't the first case of this strange issue, for example
from langchain.chains import ConversationBufferMemory
this line of code doesn't work, and returns the error: cannot import name 'ConversationBufferMemory' from 'langchain.chains' (/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/langchain/chains/init.py)
However, when I write the following code
from langchain.chains.conversation.memory import ConversationBufferMemory
It works fine. It would appear as if specifying the path to the packet I want to use in the import statement is imperative for it to work.
With this in mind I was wondering if anyone had any insight as to what path ConversationalRetrievalChain was in. I tried this, but langchain.chains.conversational_retrieval doesn't exist and many other websites like the [official langchain website] (https://python.langchain.com/docs/modules/memory/conversational_customization) have only lead me more astray.
Does anyone know where ConversationalRetrievalChain is located in Langchain version 0.0.27, or how I might go about finding it myself. Many thanks :)
What I have tried in my code:
other things:
Where I have gone to look:
I had quite similar issue:
ImportError: cannot import name 'ConversationalRetrievalChain' from 'langchain.chains'
For me upgrading to the newest langchain package version helped:
pip install langchain --upgrade
Actual version is '0.0.266', so maybe install that instead of '0.0.208' which somebody pointed.
Please also install the newest version of Python (I'm using v.3.11), as the older ones may not support langchain in newer versions.