Deprecations and Breaking Changes
This code contains a list of deprecations and removals in the langchain
and langchain-core
packages.
New features and improvements are not listed here. See the overview for a summary of what's new in this release.
Breaking changesβ
As of release 0.2.0, langchain
is required to be integration-agnostic. This means that code in langchain
should not by default instantiate any specific chat models, llms, embedding models, vectorstores etc; instead, the user will be required to specify those explicitly.
The following functions and classes require an explicit LLM to be passed as an argument:
langchain.agents.agent_toolkits.vectorstore.toolkit.VectorStoreToolkit
langchain.agents.agent_toolkits.vectorstore.toolkit.VectorStoreRouterToolkit
langchain.chains.openai_functions.get_openapi_chain
langchain.chains.router.MultiRetrievalQAChain.from_retrievers
langchain.indexes.VectorStoreIndexWrapper.query
langchain.indexes.VectorStoreIndexWrapper.query_with_sources
langchain.indexes.VectorStoreIndexWrapper.aquery_with_sources
langchain.chains.flare.FlareChain
The following classes now require passing an explicit Embedding model as an argument:
langchain.indexes.VectostoreIndexCreator
The following code has been removed:
langchain.natbot.NatBotChain.from_default
removed in favor of thefrom_llm
class method.
Behavior was changed for the following code:
@tool decoratorβ
@tool
decorator now assigns the function doc-string as the tool description. Previously, the @tool
decorator
using to prepend the function signature.
Before 0.2.0:
@tool
def my_tool(x: str) -> str:
"""Some description."""
return "something"
print(my_tool.description)
Would result in: my_tool: (x: str) -> str - Some description.
As of 0.2.0:
It will result in: Some description.
Code that moved to another packageβ
Code that was moved from langchain
into another package (e.g, langchain-community
)
If you try to import it from langchain
, the import will keep on working, but will raise a deprecation warning. The warning will provide a replacement import statement.
python -c "from langchain.document_loaders.markdown import UnstructuredMarkdownLoader"
LangChainDeprecationWarning: Importing UnstructuredMarkdownLoader from langchain.document_loaders is deprecated. Please replace deprecated imports:
>> from langchain.document_loaders import UnstructuredMarkdownLoader
with new imports of:
>> from langchain_community.document_loaders import UnstructuredMarkdownLoader
We will continue supporting the imports in langchain
until release 0.4 as long as the relevant package where the code lives is installed. (e.g., as long as langchain_community
is installed.)
However, we advise for users to not rely on these imports and instead migrate to the new imports. To help with this process, weβre releasing a migration script via the LangChain CLI. See further instructions in migration guide.
Code targeted for removalβ
Code that has better alternatives available and will eventually be removed, so thereβs only a single way to do things. (e.g., predict_messages
method in ChatModels has been deprecated in favor of invoke
).