Langchain integration documentation is out of date

(UPDATE: I originally only pasted two of the three warnings.)

The example on this page still works, but it gives three deprecation warnings:

Output:

/tavily_demo.py:10: LangChainDeprecationWarning: The class `ChatOpenAI` was deprecated in LangChain 0.0.10 and will be removed in 1.0. An updated version of the class exists in the :class:`~langchain-openai package and should be used instead. To use it run `pip install -U :class:`~langchain-openai` and import as `from :class:`~langchain_openai import ChatOpenAI``.
  llm = ChatOpenAI(model_name="gpt-4", temperature=0.7)
tavily_demo.py:15: LangChainDeprecationWarning: The function `initialize_agent` was deprecated in LangChain 0.1.0 and will be removed in 1.0. Use :meth:`~Use new agent constructor methods like create_react_agent, create_json_agent, create_structured_chat_agent, etc.` instead.
tavily_demo.py:32: LangChainDeprecationWarning: The method `Chain.run` was deprecated in langchain 0.1.0 and will be removed in 1.0. Use :meth:`~invoke` instead.
  agent_chain.run(

The first and third are trivial to fix. The second one not so much, as I’m not sure how to do something equivalent with the suggested new functions; haven’t got it working it. I’ll follow up if I do.

This is with these versions installed:

# requirements.txt
langchain==0.3.4
langchain-core==0.3.13
langchain-openai==0.2.4
langchain-anthropic==0.2.3
langchain-community==0.3.3
tavily-python==0.5.0
langchain-text-splitters==0.3.0
chromadb==0.5.11
langchain-chroma==0.1.4

I figured it out and made a PR to fix the docs:

1 Like