Skip to content

Importing Cohere from langchain root module is no longer supported. #8

@ibrahim-string

Description

@ibrahim-string

when I run test.py or test2.py either one gives me error.
I guess there are some updates required in the module importing part.

  warnings.warn(
D:\github\virenv\Lib\site-packages\langchain\__init__.py:29: UserWarning: Importing LLMChain from langchain root module is no longer supported. Please use langchain.chains.LLMChain instead.
  warnings.warn(
D:\github\virenv\Lib\site-packages\langchain\__init__.py:29: UserWarning: Importing OpenAI from langchain root module is no longer supported. Please use langchain_community.llms.OpenAI instead.
  warnings.warn(
D:\github\virenv\Lib\site-packages\langchain\chat_models\__init__.py:31: LangChainDeprecationWarning: Importing chat models from langchain is deprecated. Importing from langchain will no longer be supported as of langchain==0.2.0. Please import from langchain-community instead:

`from langchain_community.chat_models import ChatOpenAI`.

To install langchain-community run `pip install -U langchain-community`.
  warnings.warn(
D:\github\virenv\Lib\site-packages\langchain\llms\__init__.py:548: LangChainDeprecationWarning: Importing LLMs from langchain is deprecated. Importing from langchain will no longer be supported as of langchain==0.2.0. Please import from langchain-community instead:

`from langchain_community.llms import AI21`.

To install langchain-community run `pip install -U langchain-community`.
  warnings.warn(
Traceback (most recent call last):
  File "d:\github\blackmaria\blackmaria\examples\test2.py", line 1, in <module>
    from blackmaria import maria
  File "D:\github\virenv\Lib\site-packages\blackmaria\maria.py", line 11, in <module>
    from gpt_index import (GPTSimpleVectorIndex, PromptHelper,
  File "D:\github\virenv\Lib\site-packages\gpt_index\__init__.py", line 18, in <module>
    from gpt_index.indices.common.struct_store.base import SQLDocumentContextBuilder
  File "D:\github\virenv\Lib\site-packages\gpt_index\indices\__init__.py", line 4, in <module>
    from gpt_index.indices.keyword_table.base import GPTKeywordTableIndex
  File "D:\github\virenv\Lib\site-packages\gpt_index\indices\keyword_table\__init__.py", line 4, in <module>
    from gpt_index.indices.keyword_table.base import GPTKeywordTableIndex
  File "D:\github\virenv\Lib\site-packages\gpt_index\indices\keyword_table\base.py", line 16, in <module>
    from gpt_index.indices.base import DOCUMENTS_INPUT, BaseGPTIndex
  File "D:\github\virenv\Lib\site-packages\gpt_index\indices\base.py", line 23, in <module>
    from gpt_index.indices.prompt_helper import PromptHelper
  File "D:\github\virenv\Lib\site-packages\gpt_index\indices\prompt_helper.py", line 12, in <module>    
    from gpt_index.langchain_helpers.chain_wrapper import LLMPredictor
  File "D:\github\virenv\Lib\site-packages\gpt_index\langchain_helpers\chain_wrapper.py", line 6, in <module>
    from gpt_index.llm_predictor.base import (  # noqa: F401
  File "D:\github\virenv\Lib\site-packages\gpt_index\llm_predictor\__init__.py", line 4, in <module>    
    from gpt_index.llm_predictor.base import LLMPredictor
  File "D:\github\virenv\Lib\site-packages\gpt_index\llm_predictor\base.py", line 12, in <module>       
    from langchain.schema import BaseLanguageModel
ImportError: cannot import name 'BaseLanguageModel' from 'langchain.schema' (D:\github\virenv\Lib\site-packages\langchain\schema\__init__.py)```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions