Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update import for ChatOpenAI due to deprecation #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anouardbt
Copy link

Description:

This PR addresses the deprecation warnings and import errors encountered in the 02_🧠_LLM.py script of the dbt-sl-streamlit project. The following changes have been made:

  1. Import Fix:

    • Updated the import statement for ChatOpenAI to reflect the latest package structure.
    • The previous import from langchain_community.llms has been corrected to from langchain_openai import ChatOpenAI.
  2. Initialization Adjustment:

    • Modified the initialization of ChatOpenAI in the script to align with the new recommended method.

Background:
The project was encountering the following warnings and errors due to deprecated import paths and initialization methods for ChatOpenAI:

  • LangChainDeprecationWarning: Importing LLMs from langchain is deprecated.
  • UserWarning: The method of initializing chat models was outdated.
  • ImportError: ChatOpenAI could not be imported from langchain_community.llms.

By updating the import statement and initialization method, these issues have been resolved, ensuring compatibility with the latest version of langchain.

Testing:

  • Verified that the script runs without warnings or errors after the changes.
  • Tested the functionality of ChatOpenAI to ensure it operates as expected.

Dependencies:

  • Ensure that the langchain-openai package is installed and updated to the latest version:
    pip install -U langchain-openai

Notes:

  • Users should update their local environments to align with these changes.
  • Refer to the langchain documentation for any further updates on package structures and initialization methods.

Please review the changes and provide feedback or approval for merging into the main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant