Prompt templates with create_stuff_documents_chain not working with v1.0. What is the new approach?

from langchain.chains.combine_documents import create_stuff_documents_chain


ModuleNotFoundError Traceback (most recent call last)
/tmp/ipython-input-3179483470.py in <cell line: 0>()
----> 1 from langchain.chains.combine_documents import create_stuff_documents_chain
2 # create_stuff_documents_chain :
3 # Create a chain for passing a list of Documents to a model.
4
5 llm = ChatOpenAI(api_key=os.environ[“OPENAI_API_KEY”])

/usr/local/lib/python3.12/dist-packages/langchain/chains/base.py in
21 Callbacks,
22 )
—> 23 from langchain_core.memory import BaseMemory
24 from langchain_core.outputs import RunInfo
25 from langchain_core.runnables import (

ModuleNotFoundError: No module named ‘langchain_core.memory’

Hello,

If you install langchain-classic and update your imports things should work as before: LangChain v1 migration guide - Docs by LangChain

You can also check out this tutorial for the latest recommendations on building RAG systems with LangChain.