langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
94.28k stars 15.24k forks source link

No module named 'langchain.transformers' #24251

Closed mustangs0786 closed 1 week ago

mustangs0786 commented 3 months ago

Checked other resources

Example Code

I am trying to use LLMGraphTransformer Despite upgrading everything still facing this issue `from langchain.transformers import LLMGraphTransformer ModuleNotFoundError Traceback (most recent call last) Cell In[6], line 2 1 from langchain.llms import OpenAI ----> 2 from langchain.transformers import LLMGraphTransformer 3 import getpass 4 import os

ModuleNotFoundError: No module named 'langchain.transformers'`

Error Message and Stack Trace (if applicable)

No response

Description

I am trying to use LLMGraphTransformer Despite upgrading everything still facing this issue `from langchain.transformers import LLMGraphTransformer ModuleNotFoundError Traceback (most recent call last) Cell In[6], line 2 1 from langchain.llms import OpenAI ----> 2 from langchain.transformers import LLMGraphTransformer 3 import getpass 4 import os

ModuleNotFoundError: No module named 'langchain.transformers'`

System Info

I am trying to use LLMGraphTransformer Despite upgrading everything still facing this issue `from langchain.transformers import LLMGraphTransformer ModuleNotFoundError Traceback (most recent call last) Cell In[6], line 2 1 from langchain.llms import OpenAI ----> 2 from langchain.transformers import LLMGraphTransformer 3 import getpass 4 import os

ModuleNotFoundError: No module named 'langchain.transformers'`

tibor-reiss commented 3 months ago

Hi @mustangs0786, I assume you read some docs about an earlier version. In v0.2: from langchain_experimental.graph_transformers import LLMGraphTransformer, see https://python.langchain.com/v0.2/docs/how_to/graph_constructing/#llm-graph-transformer

mustangs0786 commented 3 months ago

Thanks for the reply, yes i have seen above doc, and following same code, but getting above error.

tibor-reiss commented 3 months ago

Using Python 3.11.9 (ubuntu 22.04), with below packages (pip install langchain-experimental), there are no errors with the line I gave above: from langchain_experimental.graph_transformers import LLMGraphTransformer

langchain 0.2.8 langchain-community 0.2.7 langchain-core 0.2.19 langchain-experimental 0.0.62 langchain-text-splitters 0.2.2