*   [](/v0.2/)
*   Versions
*   [v0.2](/v0.2/docs/versions/v0_2/)
*   Changes

On this page

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](/v0.2/docs/versions/overview/) for a summary of what's new in this release.

Breaking changes[​](#breaking-changes "Direct link to 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 the `from_llm` class method.

Behavior was changed for the following code:

### @tool decorator[​](#tool-decorator "Direct link to @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:

    @tooldef 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-moved-to-another-package "Direct link to 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 UnstructuredMarkdownLoaderwith 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-targeted-for-removal "Direct link to 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`).

### astream events V1[​](#astream-events-v1 "Direct link to astream events V1")

If you are using `astream_events`, please review how to [migrate to astream events v2](/v0.2/docs/versions/v0_2/migrating_astream_events/).

### langchain\_core[​](#langchain_core "Direct link to langchain_core")

#### try\_load\_from\_hub[​](#try_load_from_hub "Direct link to try_load_from_hub")

In module: `utils.loading` Deprecated: 0.1.30 Removal: 0.3.0

Alternative: Using the hwchase17/langchain-hub repo for prompts is deprecated. Please use [https://smith.langchain.com/hub](https://smith.langchain.com/hub) instead.

#### BaseLanguageModel.predict[​](#baselanguagemodelpredict "Direct link to BaseLanguageModel.predict")

In module: `language_models.base` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: invoke

#### BaseLanguageModel.predict\_messages[​](#baselanguagemodelpredict_messages "Direct link to BaseLanguageModel.predict_messages")

In module: `language_models.base` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: invoke

#### BaseLanguageModel.apredict[​](#baselanguagemodelapredict "Direct link to BaseLanguageModel.apredict")

In module: `language_models.base` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: ainvoke

#### BaseLanguageModel.apredict\_messages[​](#baselanguagemodelapredict_messages "Direct link to BaseLanguageModel.apredict_messages")

In module: `language_models.base` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: ainvoke

#### RunTypeEnum[​](#runtypeenum "Direct link to RunTypeEnum")

In module: `tracers.schemas` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: Use string instead.

#### TracerSessionV1Base[​](#tracersessionv1base "Direct link to TracerSessionV1Base")

In module: `tracers.schemas` Deprecated: 0.1.0 Removal: 0.3.0

Alternative:

#### TracerSessionV1Create[​](#tracersessionv1create "Direct link to TracerSessionV1Create")

In module: `tracers.schemas` Deprecated: 0.1.0 Removal: 0.3.0

Alternative:

#### TracerSessionV1[​](#tracersessionv1 "Direct link to TracerSessionV1")

In module: `tracers.schemas` Deprecated: 0.1.0 Removal: 0.3.0

Alternative:

#### TracerSessionBase[​](#tracersessionbase "Direct link to TracerSessionBase")

In module: `tracers.schemas` Deprecated: 0.1.0 Removal: 0.3.0

Alternative:

#### TracerSession[​](#tracersession "Direct link to TracerSession")

In module: `tracers.schemas` Deprecated: 0.1.0 Removal: 0.3.0

Alternative:

#### BaseRun[​](#baserun "Direct link to BaseRun")

In module: `tracers.schemas` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: Run

#### LLMRun[​](#llmrun "Direct link to LLMRun")

In module: `tracers.schemas` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: Run

#### ChainRun[​](#chainrun "Direct link to ChainRun")

In module: `tracers.schemas` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: Run

#### ToolRun[​](#toolrun "Direct link to ToolRun")

In module: `tracers.schemas` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: Run

#### BaseChatModel.**call**[​](#basechatmodelcall "Direct link to basechatmodelcall")

In module: `language_models.chat_models` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: invoke

#### BaseChatModel.call\_as\_llm[​](#basechatmodelcall_as_llm "Direct link to BaseChatModel.call_as_llm")

In module: `language_models.chat_models` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: invoke

#### BaseChatModel.predict[​](#basechatmodelpredict "Direct link to BaseChatModel.predict")

In module: `language_models.chat_models` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: invoke

#### BaseChatModel.predict\_messages[​](#basechatmodelpredict_messages "Direct link to BaseChatModel.predict_messages")

In module: `language_models.chat_models` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: invoke

#### BaseChatModel.apredict[​](#basechatmodelapredict "Direct link to BaseChatModel.apredict")

In module: `language_models.chat_models` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: ainvoke

#### BaseChatModel.apredict\_messages[​](#basechatmodelapredict_messages "Direct link to BaseChatModel.apredict_messages")

In module: `language_models.chat_models` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: ainvoke

#### BaseLLM.**call**[​](#basellmcall "Direct link to basellmcall")

In module: `language_models.llms` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: invoke

#### BaseLLM.predict[​](#basellmpredict "Direct link to BaseLLM.predict")

In module: `language_models.llms` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: invoke

#### BaseLLM.predict\_messages[​](#basellmpredict_messages "Direct link to BaseLLM.predict_messages")

In module: `language_models.llms` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: invoke

#### BaseLLM.apredict[​](#basellmapredict "Direct link to BaseLLM.apredict")

In module: `language_models.llms` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: ainvoke

#### BaseLLM.apredict\_messages[​](#basellmapredict_messages "Direct link to BaseLLM.apredict_messages")

In module: `language_models.llms` Deprecated: 0.1.7 Removal: 0.3.0

Alternative: ainvoke

#### BaseRetriever.get\_relevant\_documents[​](#baseretrieverget_relevant_documents "Direct link to BaseRetriever.get_relevant_documents")

In module: `retrievers` Deprecated: 0.1.46 Removal: 0.3.0

Alternative: invoke

#### BaseRetriever.aget\_relevant\_documents[​](#baseretrieveraget_relevant_documents "Direct link to BaseRetriever.aget_relevant_documents")

In module: `retrievers` Deprecated: 0.1.46 Removal: 0.3.0

Alternative: ainvoke

#### ChatPromptTemplate.from\_role\_strings[​](#chatprompttemplatefrom_role_strings "Direct link to ChatPromptTemplate.from_role_strings")

In module: `prompts.chat` Deprecated: 0.0.1 Removal:

Alternative: from\_messages classmethod

#### ChatPromptTemplate.from\_strings[​](#chatprompttemplatefrom_strings "Direct link to ChatPromptTemplate.from_strings")

In module: `prompts.chat` Deprecated: 0.0.1 Removal:

Alternative: from\_messages classmethod

#### BaseTool.**call**[​](#basetoolcall "Direct link to basetoolcall")

In module: `tools` Deprecated: 0.1.47 Removal: 0.3.0

Alternative: invoke

#### convert\_pydantic\_to\_openai\_function[​](#convert_pydantic_to_openai_function "Direct link to convert_pydantic_to_openai_function")

In module: `utils.function_calling` Deprecated: 0.1.16 Removal: 0.3.0

Alternative: langchain\_core.utils.function\_calling.convert\_to\_openai\_function()

#### convert\_pydantic\_to\_openai\_tool[​](#convert_pydantic_to_openai_tool "Direct link to convert_pydantic_to_openai_tool")

In module: `utils.function_calling` Deprecated: 0.1.16 Removal: 0.3.0

Alternative: langchain\_core.utils.function\_calling.convert\_to\_openai\_tool()

#### convert\_python\_function\_to\_openai\_function[​](#convert_python_function_to_openai_function "Direct link to convert_python_function_to_openai_function")

In module: `utils.function_calling` Deprecated: 0.1.16 Removal: 0.3.0

Alternative: langchain\_core.utils.function\_calling.convert\_to\_openai\_function()

#### format\_tool\_to\_openai\_function[​](#format_tool_to_openai_function "Direct link to format_tool_to_openai_function")

In module: `utils.function_calling` Deprecated: 0.1.16 Removal: 0.3.0

Alternative: langchain\_core.utils.function\_calling.convert\_to\_openai\_function()

#### format\_tool\_to\_openai\_tool[​](#format_tool_to_openai_tool "Direct link to format_tool_to_openai_tool")

In module: `utils.function_calling` Deprecated: 0.1.16 Removal: 0.3.0

Alternative: langchain\_core.utils.function\_calling.convert\_to\_openai\_tool()

### langchain[​](#langchain "Direct link to langchain")

#### AgentType[​](#agenttype "Direct link to AgentType")

In module: `agents.agent_types` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: Use [LangGraph](/v0.2/docs/how_to/migrate_agent/) or new agent constructor methods like create\_react\_agent, create\_json\_agent, create\_structured\_chat\_agent, etc.

#### Chain.**call**[​](#chaincall "Direct link to chaincall")

In module: `chains.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: invoke

#### Chain.acall[​](#chainacall "Direct link to Chain.acall")

In module: `chains.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: ainvoke

#### Chain.run[​](#chainrun-1 "Direct link to Chain.run")

In module: `chains.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: invoke

#### Chain.arun[​](#chainarun "Direct link to Chain.arun")

In module: `chains.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: ainvoke

#### Chain.apply[​](#chainapply "Direct link to Chain.apply")

In module: `chains.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: batch

#### LLMChain[​](#llmchain "Direct link to LLMChain")

In module: `chains.llm` Deprecated: 0.1.17 Removal: 0.3.0

Alternative: [RunnableSequence](/v0.2/docs/how_to/sequence/), e.g., `prompt | llm`

#### LLMSingleActionAgent[​](#llmsingleactionagent "Direct link to LLMSingleActionAgent")

In module: `agents.agent` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: Use [LangGraph](/v0.2/docs/how_to/migrate_agent/) or new agent constructor methods like create\_react\_agent, create\_json\_agent, create\_structured\_chat\_agent, etc.

#### Agent[​](#agent "Direct link to Agent")

In module: `agents.agent` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: Use [LangGraph](/v0.2/docs/how_to/migrate_agent/) or new agent constructor methods like create\_react\_agent, create\_json\_agent, create\_structured\_chat\_agent, etc.

#### OpenAIFunctionsAgent[​](#openaifunctionsagent "Direct link to OpenAIFunctionsAgent")

In module: `agents.openai_functions_agent.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: create\_openai\_functions\_agent

#### ZeroShotAgent[​](#zeroshotagent "Direct link to ZeroShotAgent")

In module: `agents.mrkl.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: create\_react\_agent

#### MRKLChain[​](#mrklchain "Direct link to MRKLChain")

In module: `agents.mrkl.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative:

#### ConversationalAgent[​](#conversationalagent "Direct link to ConversationalAgent")

In module: `agents.conversational.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: create\_react\_agent

#### ConversationalChatAgent[​](#conversationalchatagent "Direct link to ConversationalChatAgent")

In module: `agents.conversational_chat.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: create\_json\_chat\_agent

#### ChatAgent[​](#chatagent "Direct link to ChatAgent")

In module: `agents.chat.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: create\_react\_agent

#### OpenAIMultiFunctionsAgent[​](#openaimultifunctionsagent "Direct link to OpenAIMultiFunctionsAgent")

In module: `agents.openai_functions_multi_agent.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: create\_openai\_tools\_agent

#### ReActDocstoreAgent[​](#reactdocstoreagent "Direct link to ReActDocstoreAgent")

In module: `agents.react.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative:

#### DocstoreExplorer[​](#docstoreexplorer "Direct link to DocstoreExplorer")

In module: `agents.react.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative:

#### ReActTextWorldAgent[​](#reacttextworldagent "Direct link to ReActTextWorldAgent")

In module: `agents.react.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative:

#### ReActChain[​](#reactchain "Direct link to ReActChain")

In module: `agents.react.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative:

#### SelfAskWithSearchAgent[​](#selfaskwithsearchagent "Direct link to SelfAskWithSearchAgent")

In module: `agents.self_ask_with_search.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: create\_self\_ask\_with\_search

#### SelfAskWithSearchChain[​](#selfaskwithsearchchain "Direct link to SelfAskWithSearchChain")

In module: `agents.self_ask_with_search.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative:

#### StructuredChatAgent[​](#structuredchatagent "Direct link to StructuredChatAgent")

In module: `agents.structured_chat.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: create\_structured\_chat\_agent

#### RetrievalQA[​](#retrievalqa "Direct link to RetrievalQA")

In module: `chains.retrieval_qa.base` Deprecated: 0.1.17 Removal: 0.3.0

Alternative: [create\_retrieval\_chain](https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval.create_retrieval_chain.html#langchain-chains-retrieval-create-retrieval-chain)

#### load\_agent\_from\_config[​](#load_agent_from_config "Direct link to load_agent_from_config")

In module: `agents.loading` Deprecated: 0.1.0 Removal: 0.3.0

Alternative:

#### load\_agent[​](#load_agent "Direct link to load_agent")

In module: `agents.loading` Deprecated: 0.1.0 Removal: 0.3.0

Alternative:

#### initialize\_agent[​](#initialize_agent "Direct link to initialize_agent")

In module: `agents.initialize` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: Use [LangGraph](/v0.2/docs/how_to/migrate_agent/) or new agent constructor methods like create\_react\_agent, create\_json\_agent, create\_structured\_chat\_agent, etc.

#### XMLAgent[​](#xmlagent "Direct link to XMLAgent")

In module: `agents.xml.base` Deprecated: 0.1.0 Removal: 0.3.0

Alternative: create\_xml\_agent

#### CohereRerank[​](#coherererank "Direct link to CohereRerank")

In module: `retrievers.document_compressors.cohere_rerank` Deprecated: 0.0.30 Removal: 0.3.0

Alternative: langchain\_cohere.CohereRerank

#### ConversationalRetrievalChain[​](#conversationalretrievalchain "Direct link to ConversationalRetrievalChain")

In module: `chains.conversational_retrieval.base` Deprecated: 0.1.17 Removal: 0.3.0

Alternative: [create\_history\_aware\_retriever](https://api.python.langchain.com/en/latest/chains/langchain.chains.history_aware_retriever.create_history_aware_retriever.html) together with [create\_retrieval\_chain](https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval.create_retrieval_chain.html#langchain-chains-retrieval-create-retrieval-chain) (see example in docstring)

#### create\_extraction\_chain\_pydantic[​](#create_extraction_chain_pydantic "Direct link to create_extraction_chain_pydantic")

In module: `chains.openai_tools.extraction` Deprecated: 0.1.14 Removal: 0.3.0

Alternative: [with\_structured\_output](/v0.2/docs/how_to/structured_output/#the-with_structured_output-method) method on chat models that support tool calling.

#### create\_openai\_fn\_runnable[​](#create_openai_fn_runnable "Direct link to create_openai_fn_runnable")

In module: `chains.structured_output.base` Deprecated: 0.1.14 Removal: 0.3.0

Alternative: [with\_structured\_output](/v0.2/docs/how_to/structured_output/#the-with_structured_output-method) method on chat models that support tool calling.

#### create\_structured\_output\_runnable[​](#create_structured_output_runnable "Direct link to create_structured_output_runnable")

In module: `chains.structured_output.base` Deprecated: 0.1.17 Removal: 0.3.0

Alternative: [with\_structured\_output](/v0.2/docs/how_to/structured_output/#the-with_structured_output-method) method on chat models that support tool calling.

#### create\_openai\_fn\_chain[​](#create_openai_fn_chain "Direct link to create_openai_fn_chain")

In module: `chains.openai_functions.base` Deprecated: 0.1.1 Removal: 0.3.0

Alternative: create\_openai\_fn\_runnable

#### create\_structured\_output\_chain[​](#create_structured_output_chain "Direct link to create_structured_output_chain")

In module: `chains.openai_functions.base` Deprecated: 0.1.1 Removal: 0.3.0

Alternative: ChatOpenAI.with\_structured\_output

#### create\_extraction\_chain[​](#create_extraction_chain "Direct link to create_extraction_chain")

In module: `chains.openai_functions.extraction` Deprecated: 0.1.14 Removal: 0.3.0

Alternative: [with\_structured\_output](/v0.2/docs/how_to/structured_output/#the-with_structured_output-method) method on chat models that support tool calling.

#### create\_extraction\_chain\_pydantic[​](#create_extraction_chain_pydantic-1 "Direct link to create_extraction_chain_pydantic")

In module: `chains.openai_functions.extraction` Deprecated: 0.1.14 Removal: 0.3.0

Alternative: [with\_structured\_output](/v0.2/docs/how_to/structured_output/#the-with_structured_output-method) method on chat models that support tool calling.

[Edit this page](https://github.com/langchain-ai/langchain/edit/master/docs/docs/versions/v0_2/deprecations.mdx)

* * *

#### Was this page helpful?

  

#### You can also leave detailed feedback [on GitHub](https://github.com/langchain-ai/langchain/issues/new?assignees=&labels=03+-+Documentation&projects=&template=documentation.yml&title=DOC%3A+%3CPlease+write+a+comprehensive+title+after+the+%27DOC%3A+%27+prefix%3E).

[

Previous

astream\_events v2

](/v0.2/docs/versions/v0_2/migrating_astream_events/)[

Next

Security

](/v0.2/docs/security/)

*   [Breaking changes](#breaking-changes)
    *   [@tool decorator](#tool-decorator)
*   [Code that moved to another package](#code-that-moved-to-another-package)
*   [Code targeted for removal](#code-targeted-for-removal)
    *   [astream events V1](#astream-events-v1)
    *   [langchain\_core](#langchain_core)
    *   [langchain](#langchain)