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

Langchain 0.0.302 breaks langchain integration #307

Closed
timothyjlaurent opened this issue Sep 26, 2023 · 2 comments · Fixed by #308
Closed

Langchain 0.0.302 breaks langchain integration #307

timothyjlaurent opened this issue Sep 26, 2023 · 2 comments · Fixed by #308
Labels
bug Something isn't working third party Third-party software (integrations etc.)

Comments

@timothyjlaurent
Copy link

See the stacktrace below

File ~/.pyenv/versions/3.11.3/envs/document_classifier/lib/python3.11/site-packages/spacy_llm/models/langchain/model.py:106, in LangChain.register_models()
     98 if not has_langchain or any(
     99     [
    100         (handle.startswith("langchain"))
    101         for handle in registry.llm_models.get_all()
    102     ]
    103 ):
    104     return
--> 106 for class_id, cls in LangChain.get_type_to_cls_dict().items():
    107     registry.llm_models.register(
    108         f"langchain.{cls.__name__}.v1",
    109         func=LangChain._langchain_model_maker(class_id=class_id),
    110     )

File ~/.pyenv/versions/3.11.3/envs/document_classifier/lib/python3.11/site-packages/spacy_llm/models/langchain/model.py:38, in LangChain.get_type_to_cls_dict()
     33 @staticmethod
     34 def get_type_to_cls_dict() -> Dict[str, Type["langchain.llms.base.BaseLLM"]]:
     35     """Returns langchain.llms.type_to_cls_dict.
     36     RETURNS (Dict[str, Type[langchain.llms.base.BaseLLM]]): langchain.llms.type_to_cls_dict.
     37     """
---> 38     return langchain.llms.type_to_cls_dict

File ~/.pyenv/versions/3.11.3/envs/document_classifier/lib/python3.11/site-packages/langchain/__init__.py:308, in __getattr__(name)
    306     return SerpAPIWrapper
    307 else:
--> 308     raise AttributeError(f"Could not find: {name}")

AttributeError: Could not find: llms

spacy_llm/models/langchain/model.py:38, imports langchain.llms.type_to_cls_dict but as of yesterday's Langchain release - https://github.com/langchain-ai/langchain/pull/11017/files they make this import raise an Attribute error that isn't present in their init.py`

They warn:

    warnings.warn(
        f"Importing {name} from langchain root module is no longer supported."
    )
@rmitsch rmitsch added bug Something isn't working third party Third-party software (integrations etc.) labels Sep 27, 2023
@rmitsch
Copy link
Collaborator

rmitsch commented Sep 27, 2023

Hi @timothyjlaurent, thanks for reporting this! Unfortunately the langchain API is rather unstable, which is why we pinned it to a specific version in spacy-llm. We'll look into supporting and pinning to 0.0.302 soon.

@rmitsch rmitsch linked a pull request Sep 27, 2023 that will close this issue
3 tasks
@rmitsch
Copy link
Collaborator

rmitsch commented Oct 2, 2023

This is fixed in main and will be available in the next release (published probably this week).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working third party Third-party software (integrations etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants